CN119378282B - Brush stroke simulation method and device based on physical interaction - Google Patents
Brush stroke simulation method and device based on physical interaction Download PDFInfo
- Publication number
- CN119378282B CN119378282B CN202411977308.1A CN202411977308A CN119378282B CN 119378282 B CN119378282 B CN 119378282B CN 202411977308 A CN202411977308 A CN 202411977308A CN 119378282 B CN119378282 B CN 119378282B
- Authority
- CN
- China
- Prior art keywords
- touch
- initial
- track
- brush
- stroke
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F30/00—Computer-aided design [CAD]
- G06F30/20—Design optimisation, verification or simulation
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/01—Input arrangements or combined input and output arrangements for interaction between user and computer
- G06F3/016—Input arrangements with force or tactile feedback as computer generated output to the user
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/01—Input arrangements or combined input and output arrangements for interaction between user and computer
- G06F3/03—Arrangements for converting the position or the displacement of a member into a coded form
- G06F3/041—Digitisers, e.g. for touch screens or touch pads, characterised by the transducing means
- G06F3/0412—Digitisers structurally integrated in a display
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/01—Input arrangements or combined input and output arrangements for interaction between user and computer
- G06F3/03—Arrangements for converting the position or the displacement of a member into a coded form
- G06F3/041—Digitisers, e.g. for touch screens or touch pads, characterised by the transducing means
- G06F3/0414—Digitisers, e.g. for touch screens or touch pads, characterised by the transducing means using force sensing means to determine a position
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F2119/00—Details relating to the type or aim of the analysis or the optimisation
- G06F2119/14—Force analysis or force optimisation, e.g. static or dynamic forces
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02T—CLIMATE CHANGE MITIGATION TECHNOLOGIES RELATED TO TRANSPORTATION
- Y02T90/00—Enabling technologies or technologies with a potential or indirect contribution to GHG emissions mitigation
Landscapes
- Engineering & Computer Science (AREA)
- General Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Human Computer Interaction (AREA)
- Computer Hardware Design (AREA)
- Evolutionary Computation (AREA)
- Geometry (AREA)
- User Interface Of Digital Computer (AREA)
- Processing Or Creating Images (AREA)
Abstract
The disclosure provides a writing brush touch simulation method and device based on physical interaction, equipment, media and products, and relates to the technical field of graphic processing. The method comprises the steps of responding to the detected interaction motion generated based on the touch equipment, obtaining force feedback parameters of the interaction motion, generating an initial pen touch track according to the force feedback parameters and a preset writing brush nib model, adjusting ink permeation parameters and/or pen touch texture characteristics of the initial pen touch track to obtain a rendered writing brush touch graph, and controlling the display screen of the touch equipment to display the writing brush touch graph.
Description
Technical Field
The disclosure relates to the technical field of graphic processing, in particular to a writing brush stroke simulation method based on physical interaction.
Background
With the development of graphic processing technology and man-machine interaction technology, digital painting and calligraphy creation is becoming an important way of artistic expression and cultural propagation.
However, in the digital processing process of the traditional writing brush writing, the phenomena of poor pen touch simulation effect and limited ink rendering mode exist.
Disclosure of Invention
The disclosure provides a writing brush stroke simulation method and device based on physical interaction.
According to one aspect of the disclosure, a writing brush touch simulation method based on physical interaction is provided, and the writing brush touch simulation method comprises the steps of responding to detected interaction generated based on touch equipment, obtaining force feedback parameters of the interaction, generating an initial pen touch track according to the force feedback parameters and a preset writing brush pen point model, adjusting ink permeation parameters and/or pen touch texture characteristics of the initial pen touch track to obtain rendered writing brush touch patterns, and controlling the rendering of the writing brush touch patterns on a display screen of the touch equipment.
In some embodiments, the acquiring the force feedback parameters of the interaction action in response to the detected interaction action generated based on the touch control device comprises acquiring at least one of the following parameters of the interaction action, namely the current moving speed, the pressure value parameter, the interaction position parameter and the interaction angle parameter, as the force feedback parameters in response to the detected interaction action.
In some embodiments, the generating an initial stroke track according to the force feedback parameter and a preset writing brush nib model comprises determining a reverse cone direction and a cone vertex position according to the interaction position parameter and the interaction angle parameter based on a pre-constructed reverse cone model, determining a region radius of a stroke region formed by projecting the reverse cone on a paper surface according to the pressure value parameter, and generating the initial stroke track according to the reverse cone direction, the cone vertex position and the region radius of the stroke region.
In some embodiments, the ink penetration parameters comprise ink transparency, the ink penetration parameters of the initial pen touch track are adjusted to obtain a rendered writing brush pen touch graph, the ink penetration parameters comprise the ink transparency matched with the target track point according to the distance between the target track point and the center of a pen touch area and the pressure value born by the target track point aiming at any target track point in the initial pen touch track, and the initial pen touch track is rendered according to the ink transparency matched with any target track point to obtain the rendered writing brush pen touch graph.
In some embodiments, the ink penetration parameters comprise ink diffusivity, and the ink penetration parameters of the initial pen touch track are adjusted to obtain a rendered brush pen touch graph, and the method comprises the steps of calculating gray value gradient amplitude of each pixel point in the initial pen touch track, performing binarization operation on the gray value gradient amplitude to obtain a binarization mask matched with the corresponding pixel point, and adjusting the ink diffusivity matched with the corresponding pixel point according to the binarization mask to obtain the rendered brush pen touch graph.
In some embodiments, the adjusting the ink diffusivity matching the corresponding pixel according to the binarization mask to obtain the rendered brush pen touch graph comprises adjusting the ink diffusivity matching the corresponding pixel according to at least one of the binarization mask and parameters including dynamic noise density, ink diffusion range, ink solubility and paper density constants.
In some embodiments, adjusting the ink penetration parameter of the initial stroke track to obtain a rendered brush stroke pattern comprises controlling a random boundary of the initial stroke track by using a dynamic noise generation algorithm to obtain the rendered brush stroke pattern.
In some embodiments, adjusting the brush stroke texture features of the initial brush stroke track to obtain a rendered brush stroke pattern comprises performing track profile detection on the initial brush stroke track to obtain an internal coloring region of the initial brush stroke track, and overlaying a preset brush stroke texture map on the internal coloring region of the initial brush stroke track to obtain the brush stroke pattern with an erosion effect.
In some embodiments, the track profile detection of the initial pen-touch track to obtain an internal coloring area of the initial pen-touch track comprises calculating a vector dot product based on a vertex normal vector of a corresponding track point and a preset view angle direction vector for any track point in the initial pen-touch track, and identifying the internal coloring area of the initial pen-touch track according to an absolute value of the vector dot product.
In some embodiments, the method for obtaining the brush pen touch graph with the erosion effect by superposing the preset brush pen touch texture map on the internal coloring area of the initial brush pen touch track comprises the steps of sampling the brush pen touch texture map based on any area point in the internal coloring area to obtain a target sampling map matched with a corresponding area point, superposing the target sampling map on the position of the corresponding area point to obtain an initial erosion effect value based on the corresponding area point, adjusting the initial erosion effect value by using a power exponent to obtain an erosion effect value with sharpness adjusted, scaling the erosion effect value with sharpness adjusted to obtain a target erosion effect value based on the corresponding area point, and applying the target erosion effect value to the corresponding area point in the internal coloring area to obtain the brush pen touch graph with the erosion effect.
In some embodiments, the scaling the sharpness-adjusted erosion effect value to obtain a target erosion effect value based on a corresponding region point includes scaling the sharpness-adjusted erosion effect value to obtain a transitional erosion effect value, limiting an output value of the transitional erosion effect value within a preset range to obtain a smooth erosion effect value, and performing a threshold inversion process on the smooth erosion effect value based on a preset threshold inversion parameter to obtain the target erosion effect value based on the corresponding region point.
In some embodiments, the adjusting of the brush stroke texture features of the initial brush stroke trajectory results in a rendered brush stroke graphic, further comprising adjusting pixel coordinates corresponding to the brush stroke texture map to effect displacement, rotation, and scaling operations of the brush stroke texture map.
In some embodiments, the method further comprises persisting the brush stroke pattern matching the interaction into a memory of a storage device in response to the detected interaction.
According to another aspect of the disclosure, a writing brush stroke simulation device is provided, which comprises a first processing module, a second processing module, a third processing module and a fourth processing module, wherein the first processing module is used for responding to a detected interaction motion generated based on a touch device and obtaining force feedback parameters of the interaction motion, the second processing module is used for generating an initial stroke track according to the force feedback parameters and a preset writing brush nib model, the third processing module is used for adjusting ink permeation parameters and/or stroke texture characteristics of the initial stroke track to obtain a rendered writing brush stroke graph, and the fourth processing module is used for controlling the display screen of the touch device to display the writing brush stroke graph.
According to another aspect of the present disclosure, an electronic device is provided that includes at least one processor and a memory communicatively coupled to the at least one processor. The memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor, so that the at least one processor can execute the writing brush stroke simulation method.
According to another aspect of the present disclosure, there is provided a non-transitory computer-readable storage medium storing computer instructions for causing the computer to perform the above-described brush stroke simulation method.
According to another aspect of the present disclosure, there is provided a computer program product comprising a computer program which, when executed by a processor, implements the brush stroke simulation method described above.
It should be understood that the description in this section is not intended to identify key or critical features of the embodiments of the disclosure, nor is it intended to be used to limit the scope of the disclosure. Other features of the present disclosure will become apparent from the following specification.
Drawings
The drawings are for a better understanding of the present solution and are not to be construed as limiting the present disclosure. Wherein:
FIG. 1 schematically illustrates a system architecture of a writing brush stroke simulation method and apparatus according to an embodiment of the present disclosure;
FIG. 2 schematically illustrates a flow chart of a brush stroke simulation method according to an embodiment of the present disclosure;
FIG. 3 schematically illustrates a schematic diagram of a reverse taper model according to an embodiment of the present disclosure;
FIG. 4 schematically illustrates a schematic diagram of an initial pen-touch trajectory according to an embodiment of the present disclosure;
Fig. 5 schematically illustrates a process diagram of rendering an initial stroke trajectory according to an embodiment of the present disclosure.
FIG. 6 schematically illustrates a schematic diagram of a pen-touch texture map according to an embodiment of the present disclosure;
FIG. 7 schematically illustrates a schematic diagram of a brush stroke pattern according to an embodiment of the present disclosure;
FIG. 8 schematically illustrates a block diagram of a writing brush stroke simulation apparatus according to an embodiment of the present disclosure;
fig. 9 schematically illustrates a block diagram of an electronic device for performing brush stroke simulation according to an embodiment of the disclosure.
Detailed Description
Exemplary embodiments of the present disclosure are described below in conjunction with the accompanying drawings, which include various details of the embodiments of the present disclosure to facilitate understanding, and should be considered as merely exemplary. Accordingly, one of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the present disclosure. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the disclosure. The terms "comprises," "comprising," and/or the like, as used herein, specify the presence of stated features, steps, operations, and/or components, but do not preclude the presence or addition of one or more other features, steps, operations, or components.
All terms (including technical and scientific terms) used herein have the same meaning as commonly understood by one of ordinary skill in the art unless otherwise defined. It should be noted that the terms used herein should be construed to have meanings consistent with the context of the present specification and should not be construed in an idealized or overly formal manner.
Where a convention analogous to "at least one of A, B and C, etc." is used, in general such a convention should be interpreted in accordance with the meaning of one of skill in the art having generally understood the convention (e.g., "a system having at least one of A, B and C" would include, but not be limited to, systems having a alone, B alone, C alone, a and B together, a and C together, B and C together, and/or A, B, C together, etc.).
With the development of graphic processing technology and man-machine interaction technology, digital painting and calligraphy creation is becoming an important way of artistic expression and cultural propagation.
However, in the digital processing process of the traditional writing brush writing, the phenomena of poor pen touch simulation effect and limited ink rendering mode may exist. For example, the existing painting software supports the generation of the simulated writing brush strokes with different thicknesses depending on the pressure sensing equipment, but the traditional painting software is insufficient in strokes, ink shade, dynamic ink diffusion and other aspects, so that the simulation effect of the writing brush strokes is poor.
The embodiment of the disclosure provides a writing brush stroke simulation method and device based on physical interaction and a computer readable storage medium. The writing brush touch simulation device can be integrated in electronic equipment, and the electronic equipment can be terminal equipment or a server. The server may be an independent physical server, a server cluster or a distributed system formed by a plurality of physical servers, or a cloud server providing cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, network acceleration services (Content Delivery Network, CDN), basic cloud computing services such as big data and artificial intelligent platforms, and the like. The terminal equipment can be a mobile phone, a computer, a tablet personal computer, an intelligent screen, an intelligent household appliance, a vehicle-mounted terminal and the like.
The embodiment of the disclosure provides a writing brush stroke simulation method. The method comprises the steps of responding to the detected interaction action generated based on the touch control equipment and obtaining force feedback parameters of the interaction action. And then, generating an initial stroke track according to the force feedback parameters and a preset writing brush nib model. And then, adjusting the ink permeation parameters and/or the pen touch texture characteristics of the initial pen touch track to obtain a rendered brush pen touch graph, and controlling the display screen of the touch control device to display the brush pen touch graph.
The writing brush stroke simulation device is integrated in the server for explanation. Fig. 1 schematically illustrates a system architecture of a writing brush stroke simulation method and apparatus according to an embodiment of the present disclosure. It should be noted that fig. 1 is only an example of a system architecture to which embodiments of the present disclosure may be applied to assist those skilled in the art in understanding the technical content of the present disclosure, but does not mean that embodiments of the present disclosure may not be used in other devices, systems, environments, or scenarios.
The system architecture 100 according to this embodiment may include a touch device 101, a network 102, and a server 103. The network 102 is used as a medium to provide a communication link between the touch device 101 and the server 103. Network 102 may include various connection types such as wired, wireless communication links, or fiber optic cables, among others. The server 103 may be an independent physical server, a server cluster or a distributed system formed by a plurality of physical servers, or a cloud server providing basic cloud computing services such as cloud computing, network service, and middleware service.
The touch device 101 interacts with the server 103 through the network 102 to receive or transmit data or the like. The touch device 101 is configured to, for example, in response to detecting an interaction action triggered by a user, obtain a force feedback parameter of the interaction action, and send the force feedback parameter to the server 103 through the network 102.
A user may interact with a touch device through a physical medium such as a stylus, mouse, keyboard, virtual Reality (VR) device, augmented Reality (AR) device, etc. The user-triggered interaction may be, for example, writing, drawing, image processing, etc. performed in a display screen of the touch device, which is not limited by the embodiments of the present disclosure.
The server 103 may be a server providing various services, for example, may be a server performing brush stroke simulation according to force feedback parameters provided by the touch device 101 (merely by way of example).
For example, the server 103 generates an initial pen touch trajectory according to the force feedback parameters and a preset writing brush tip model in response to the acquired force feedback parameters uploaded by the touch device 101. The server 103 may also be configured to adjust the ink penetration parameters and/or the brush stroke texture characteristics of the initial brush stroke trajectory to obtain a rendered brush stroke pattern. The server 103 may send the rendered brush stroke graphic to the touch device 101 for display of the rendered brush stroke graphic by the touch device 101.
It should be noted that the brush stroke simulation method provided by the embodiments of the present disclosure may be executed by the server 103. Accordingly, the brush stroke simulation apparatus provided by the embodiments of the present disclosure may be disposed in the server 103. The brush stroke simulation method provided by the embodiments of the present disclosure may also be performed by a server or a server cluster that is different from the server 103 and is capable of communicating with the touch device 101 and/or the server 103. Accordingly, the brush stroke simulation apparatus provided by the embodiments of the present disclosure may also be disposed in a server or a server cluster different from the server 103 and capable of communicating with the touch device 101 and/or the server 103.
It should be understood that the number of touch devices, networks, and servers in fig. 1 is merely illustrative. There may be any number of touch devices, networks, and servers, as desired for implementation.
The embodiment of the disclosure provides a brush stroke simulation method, and the brush stroke simulation method according to an exemplary embodiment of the disclosure is described below with reference to fig. 2 to 9 in combination with the system architecture of fig. 1. The brush stroke simulation method of the embodiment of the present disclosure may be performed by the server 103 shown in fig. 1, for example.
Fig. 2 schematically illustrates a flowchart of a brush stroke simulation method according to an embodiment of the present disclosure.
As shown in fig. 2, the brush stroke simulation method 200 according to the embodiment of the disclosure may include, for example, operations S210 to S240.
In operation S210, in response to the detected interaction motion generated based on the touch device, a force feedback parameter of the interaction motion is acquired.
In operation S220, an initial stroke track is generated according to the force feedback parameters and a preset writing brush tip model.
In operation S230, the ink penetration parameters and/or the brush stroke texture characteristics of the initial brush stroke trajectory are adjusted to obtain a rendered brush stroke pattern.
In operation S240, control presents a brush stroke pattern on a display screen of the touch device.
An example flow of each operation of the brush stroke simulation method of the present embodiment is illustrated below.
Illustratively, in response to a detected interaction motion generated based on the touch device, at least one of the following parameters of the interaction motion, namely, a current movement speed, a pressure value parameter, an interaction location parameter and an interaction angle parameter, is obtained as a force feedback parameter. The force feedback parameters of the interaction action can influence the morphological change of the brush strokes.
Next, an initial stroke track is generated according to the force feedback parameters and a pre-constructed writing brush nib model. For example, a parameterized reverse taper model may be used to simulate a writing brush tip, which may be, for example, a combination of multiple reverse tapers. The reverse cones are mutually overlapped and covered to form a writing brush touch track matched with the interaction action.
Fig. 3 schematically illustrates a schematic diagram of a reverse taper model of an embodiment of the present disclosure. As shown in fig. 3, the reverse taper parameters include, for example, a vertex (O) position parameter of the reverse taper, a floor radius parameter R, and a taper angle parameter α.
As an example, the reverse cone direction and cone vertex position may be determined from the interaction location parameters and the interaction angle parameters based on a pre-constructed reverse cone model. And determining the area radius of a pen touch area formed by projecting the inverted cone on the paper surface according to the pressure value parameter. And generating an initial stroke track according to the reverse cone direction, the cone vertex position and the area radius of the stroke area.
In the process of triggering physical interaction with the touch device by a user, the contact position of the physical device and the touch device forms an interaction position parameter of interaction action, for example. The reverse taper direction may be determined based on the interaction location parameter and the interaction angle parameter of the interaction. Assume that the first position parameter of the interaction isThe second position parameter isThe reverse taper direction can be expressed by the following formula (1):
(1)
Wherein, ,P represents the original vector, and,The post-rotation vector is represented by a vector,The indication rotation angle may specifically be a contact angle between the physical device and the display screen of the touch device.
The cone vertex position of the inverted cone can be determined according to the interaction position parameter and the interaction angle parameter of the interaction action. For example, the vertex position of the inverted cone bottom surface circle may be determined according to the interaction position parameter and the interaction angle parameter. For example, the vertex position of the reverse-cone bottom surface circle is represented by formula (2):
(2)
Wherein, vertex (i, t) represents the Vertex position of the inverted cone bottom surface circle, P (t) represents the circle center position of the inverted cone bottom surface circle at the moment of t, R (t) represents the cone bottom surface radius at the position of P (t), h (t) represents the cone height, and N (t) represents the normal direction at the position of P (t). For each center point P (T), the tangential direction T (T), the normal direction N (T), and the sub-normal direction B (T) at P (T) can be calculated.
For example, the interaction position parameter based on the target time t, for example, the center position parameter P (t) constituting the inverted cone bottom surface circle. The tangential direction T (T), the normal direction N (T), and the sub-normal direction B (T) at P (T) may be calculated, for example, from an interaction angle parameter based on the target time T, for example, a cone angle parameter α constituting an inverted cone.
The area radius of the pen touch area formed by the projection of the inverted cone on the paper surface can be determined according to the pressure value parameter. For example, the area radius of the pen-touch area formed by the reverse cone projection can be expressed by the formula (3):
R=f/k (3)
Wherein F represents a pressure value, and k represents an adjustment factor, the value of which can be obtained through experiments. R represents the radius of the reverse cone, and the value range of R is [ R 1,R2],R1 represents the preset minimum radius of the pen touch contacted with the paper surface ], and R 2 is the preset maximum radius of the pen touch contacted with the paper surface.
And the projections of the inverted cones on the touch equipment display screen form a pen touch area, and the pen touch area is filled along the pen diameter direction to form a pen path so as to obtain an initial pen touch track matched with the interaction action of the user.
Fig. 4 schematically illustrates a schematic diagram of an initial pen-touch trajectory in accordance with an embodiment of the present disclosure. In the process that a user triggers interaction action based on a display screen of the touch equipment, the touch track is generated in real time according to force feedback parameters by capturing the position, speed, angle and the like of the interaction action in a three-dimensional space, and the touch track is smoothly described by adopting a parameterized curve. The method is beneficial to enhancing the naturalness and continuity of the virtual writing brush strokes and improving the interactive experience of the virtual writing brush strokes.
After the initial pen touch track is obtained, ink penetration parameters and/or pen touch texture characteristics of the initial pen touch track can be adjusted to obtain a writing brush pen touch graph matched with the interaction action, and the writing brush pen touch graph is controlled to be displayed on a display screen of the touch equipment.
Fig. 5 schematically illustrates a process diagram of rendering an initial pen-touch trajectory according to an embodiment of the present disclosure.
As shown in fig. 5, operation S502 and/or operation S503 may be performed on the initial brush stroke track 501, resulting in a brush stroke pattern 504.
In operation S502, the ink permeation parameter of the initial pen-touch trajectory 501 is adjusted.
In operation S503, the stroke texture feature of the initial stroke trajectory 501 is adjusted.
An example flow of each operation of the present embodiment is illustrated below.
Illustratively, the ink permeation parameter may include ink transparency. The ink penetration parameters of the initial pen touch track are adjusted to obtain a rendered writing brush pen touch graph, wherein the ink transparency matched with the target track points is calculated according to the distance between the target track points and the center of the pen touch area and the pressure value born by the target track points aiming at any target track point in the initial pen touch track. And rendering the initial pen touch track according to the transparency of the ink mark matched with any target track point to obtain a rendered writing brush touch graph.
The color of ink varies with the concentration of ink contained in the ink. During the ink diffusion process, a portion of the ink particles float to the surface of the ink, and a portion of the ink particles flow as the ink flows. The ink color of the ink diffusion part is lighter, and the ink has the ink halation effect.
Illustratively, the initial stroke track may be vignetted in a transparency interpolation manner to obtain a brush stroke pattern. Taking any target track point (i, j) in the initial pen-touch track as an example, assuming that the distance from the target track point to the center of the pen-touch area is D (i, j), the pressure value received at the target track point is F (i, j), the transparency T (i, j) of the ink matched with the target track point can be represented by equation (4):
t (i, j) =k (F (i, j) -D (i, j)) formula (4)
Wherein K represents a transparency constant, and the value range of T (i, j) is [0,1]. The ink transparency T (i, j) is updated dynamically as a function of time and ink spread, which characterizes the process of fading the ink edges.
Illustratively, the ink penetration parameters may further include ink diffusivity, and the ink penetration parameters of the initial pen-touch trajectory are adjusted to obtain a rendered brush pen-touch graph, including calculating a gray value gradient magnitude of each pixel point in the initial pen-touch trajectory; performing binarization operation on the gray value gradient amplitude to obtain a binarization mask matched with the corresponding pixel point; and adjusting the ink diffusivity matched with the corresponding pixel point according to the binarization mask to obtain a rendered brush pen touch graph.
In the process of adjusting the ink diffusivity matched with the corresponding pixel point according to the binarization mask, the ink diffusivity matched with the corresponding pixel point can be adjusted according to the binarization mask and at least one of the following parameters, so that the rendered writing brush stroke graph, namely dynamic noise density, ink diffusion range, ink solubility and paper density constant, is obtained.
The sobel operator is an edge detection algorithm in image processing that can operate based on local gradients of image pixels. By calculating the gradients of the image in the horizontal direction and the vertical direction, the sobel operator can effectively detect the edges of the object in the image.
Gradient values of the image in the x-direction and the y-direction may be calculated by performing a convolution operation on the image. Illustratively, a horizontal convolution kernel may be usedConvolving the image to obtain a horizontal gradient. A vertical convolution kernel may be usedConvolving the image to obtain a vertical gradient。
Horizontal convolution kernel for sobel operatorThe following are provided:
vertical convolution kernel for sobel operator The following are provided:
gradient in horizontal direction Gradient in vertical direction,
Wherein I represents a gray value matrix of the image,Representing a convolution operation.
According to the horizontal gradient of each pixel point in the initial pen touch trackAnd a vertical gradientCalculating the gray value gradient amplitude of the corresponding pixel pointAnd the gray value gradient direction of the corresponding pixel point。
As an example, the gray value gradient magnitude of each pixel point in the initial stroke trajectory may be normalized to the [0,1] range by setting a threshold T, and a mask may be generated by a binarization operation. The binarization process can be represented by formula (5):
(5)
M (i, j) represents a binarization mask at the pixel point (i, j), and the ink diffusivity at the pixel point (i, j) can be adjusted according to the M (i, j) to obtain a rendered brush stroke graph.
Illustratively, the ink diffusivity D (i, j) at the pixel point (i, j) can be expressed by the formula (6):
(6)
Where K represents a sheet density constant, N (i, j) represents a dynamic noise density, R (i, j) represents an ink diffusion range, and S (i, j) represents an ink solubility.
By adjusting the ink permeation parameters N (i, j), R (i, j) and S (i, j), the simulation application of different paper types and ink environments can be supported, and great flexibility and expansibility are provided for digital ink rendering.
As an alternative, a dynamic noise generation algorithm may also be used to control the random boundaries of the initial stroke trajectory, resulting in a rendered brush stroke pattern. The blurring effect and the natural transition effect of the ink mark edge are further enhanced through a dynamic noise generation algorithm in the material coloring device, so that the diffusion form of the ink is closer to the ink absorption characteristic of real paper. For example, a dynamic noise generation function Perlin (N) may be selected to control the random boundary of the initial stroke trajectory.
In the process of adjusting the stroke texture features of the initial stroke track, track profile detection can be performed on the initial stroke track to obtain an internal coloring region of the initial stroke track. And superposing a preset brush stroke texture map on the internal coloring area of the initial brush stroke track to obtain a brush stroke pattern with an erosion effect.
In the process of detecting the track profile of the initial pen-touch track, a vector dot product based on the vertex normal vector of the corresponding track point and the preset visual angle direction vector can be calculated for any track point in the initial pen-touch track. Based on the absolute value of the vector dot product, the interior colored region of the initial stroke track is identified.
Fig. 6 schematically illustrates a schematic diagram of a pen-touch texture map according to an embodiment of the present disclosure. In the process of superposing the pen-touch texture map on the internal coloring area of the initial pen-touch track, the pen-touch texture map can be sampled based on any area point in the internal coloring area, and the target sampling map matched with the corresponding area point is obtained. And superposing the target sampling map on the position of the corresponding region point to obtain an initial erosion effect value based on the corresponding region point. And adjusting the initial erosion effect value by using the power exponent to obtain the erosion effect value after sharpness adjustment. And scaling the erosion effect value after sharpness adjustment to obtain a target erosion effect value based on the corresponding region point. And applying the target erosion effect value to a corresponding region point in the internal colored region to obtain a writing brush stroke pattern with an erosion effect.
In the process of scaling the erosion effect value after sharpness adjustment to obtain a target erosion effect value based on the corresponding region point, the erosion effect value after sharpness adjustment can be scaled to obtain a transitional erosion effect value. And limiting the output value of the transitional erosion effect value in a preset range to obtain a smooth erosion effect value. And performing threshold inversion processing on the smooth erosion effect value based on a preset threshold inversion parameter to obtain a target erosion effect value based on the corresponding region point.
By superimposing the brush texture map in the internal coloring area of the initial brush track, erosion or blanking effects are advantageously presented at the edges of the object, and a reverse edge erosion effect can be achieved, which can be used for the rendering style of a special ink brush.
Illustratively, for any pixel point (i, j) in the initial stroke trajectory, it is assumed that N (i, j) represents a vertex normal vector at the pixel point (i, j), C represents a preset viewing angle direction vector, and T represents a preset threshold. At the position ofIn the case of (a), the corresponding pixel (i, j) is characterized as being located at the contour position of the initial stroke track. At the position ofIn the case of (a), the corresponding pixel (i, j) is characterized as being located in an inner colored region of the initial pen-touch trajectory.
Illustratively, inIn the case of (2), the initial erosion effect value E (i, j) =0 is not superimposed on the stroke texture map at the outline position of the initial stroke trajectory.
At the position ofIn the case of (a), the initial erosion effect value E (i, j) is obtained by superimposing the pen-touch texture map on the inner colored region of the initial pen-touch trajectory.
Optionally, based on any region point (i, j) in the internal colored region, sampling the pen-touch texture map to obtain a target sampling map matching the corresponding region point. Mapping target samplesSuperimposed on the position of the corresponding region point to obtain an initial erosion effect value based on the corresponding region point。
And adjusting the initial erosion effect value by using the power exponent to obtain the erosion effect value after sharpness adjustment. For example, the initial erosion effect value E (i, j) is adjusted using the power exponent n to obtain a sharpness adjusted erosion effect value。
And scaling the erosion effect value after sharpness adjustment to obtain a target erosion effect value based on the corresponding region point. For example, with scaling factor k, sharpness adjusted erosion effectiveness valuesScaling to obtain transitional erosion effect value。
And limiting the output value of the transitional erosion effect value in a preset range to obtain a smooth erosion effect value. For example, using the Clamp (x, 0, 1) function, for example, willThe output value of (2) is limited in the range of [0,1] to obtain the smooth erosion effect value。
Optionally, based on a preset threshold inversion parameter, performing threshold inversion processing on the smooth erosion effect value to obtain a target erosion effect value based on the corresponding region point. For example, based on a preset threshold inversion parameter s, the smooth erosion effect value is calculated using a Step (a, x) functionPerforming threshold inversion processing to obtain a target erosion effect value based on the corresponding region point. Wherein the Step (a, x) function is used to output 1 if x. Gtoreq.a, otherwise output 0.
Next, the target erosion effect value is applied to the corresponding region point in the internal colored region, resulting in a brush stroke pattern with an erosion effect.
Optionally, the pixel coordinates corresponding to the brush stroke texture map may be adjusted to implement displacement, rotation and scaling operations on the brush stroke texture map, so as to obtain a brush stroke pattern.
Fig. 7 schematically illustrates a schematic diagram of a brush stroke pattern according to an embodiment of the present disclosure. The brush pen touch graph generated by the brush pen touch simulation method can truly reduce the ink diffusion effect, is beneficial to solving the problem that static ink marks lack of dynamic change in the traditional rendering method, and is beneficial to realizing a brush pen creation scheme with strong interactivity and rich expressive force while guaranteeing high-resolution rendering.
It is noted that only the ink penetration parameter adjustment may be performed on the initial stroke track, only the stroke texture adjustment may be performed on the initial stroke track, and both the ink penetration parameter adjustment and the stroke texture adjustment may be performed on the initial stroke track. The intermediate stroke pattern obtained through the adjustment of the ink permeation parameter can be used as input data of the stroke texture characteristic adjustment operation. The intermediate stroke pattern obtained by regulating the stroke texture features can also be used as input data of the ink permeation parameter regulating operation. This embodiment is not limited thereto.
And after the writing brush touch pattern is obtained, controlling to display the writing brush touch pattern on a display screen of the touch device.
As an alternative, in response to the detected interaction, the brush stroke pattern matching the interaction may be persisted into the memory of the storage device.
Fig. 8 schematically illustrates a block diagram of a writing brush stroke simulation apparatus according to an embodiment of the present disclosure.
As shown in fig. 8, the brush stroke simulation apparatus 800 of the embodiment of the present disclosure includes, for example, a first processing module 810, a second processing module 820, a third processing module 830, and a fourth processing module 840.
The touch control device comprises a first processing module 810 for responding to the detected interaction action generated based on the touch control device and obtaining force feedback parameters of the interaction action, a second processing module 820 for generating an initial pen touch track according to the force feedback parameters and a preset pen nib model, a third processing module 830 for adjusting ink permeation parameters and/or pen touch texture characteristics of the initial pen touch track to obtain a rendered pen touch graph, and a fourth processing module 840 for controlling the display screen of the touch control device to display the pen touch graph.
The brush pen touch graph generated by the brush pen touch simulation method can truly reduce the ink diffusion effect, is beneficial to solving the problem that static ink marks lack of dynamic change in the traditional rendering method, and is beneficial to realizing a brush pen creation scheme with strong interactivity and rich expressive force while guaranteeing high-resolution rendering.
According to the embodiment of the disclosure, the first processing module comprises a first processing sub-module, which is used for responding to the detected interaction action and acquiring at least one of the following parameters of the interaction action as the force feedback parameters, namely the current moving speed, the pressure value parameter, the interaction position parameter and the interaction angle parameter.
According to the embodiment of the disclosure, the second processing module comprises a second processing sub-module, a third processing sub-module and a fourth processing sub-module, wherein the second processing sub-module is used for determining the reverse cone direction and the cone vertex position according to the interaction position parameter and the interaction angle parameter based on a pre-constructed reverse cone model, the third processing sub-module is used for determining the area radius of a pen touch area formed by the reverse cone projected on a paper surface according to the pressure value parameter, and the fourth processing sub-module is used for generating the initial pen touch track according to the reverse cone direction, the cone vertex position and the area radius of the pen touch area.
According to the embodiment of the disclosure, the ink penetration parameters comprise ink transparency, the third processing module comprises a fifth processing sub-module and a sixth processing sub-module, wherein the fifth processing sub-module is used for aiming at any target track point in the initial pen touch track, calculating the ink transparency matched with the target track point according to the distance between the target track point and the center of a pen touch area and the pressure value born by the target track point, and the sixth processing sub-module is used for rendering the initial pen touch track according to the ink transparency matched with any target track point to obtain the rendered writing brush touch graph.
According to the embodiment of the disclosure, the ink permeation parameter comprises ink diffusion, the third processing module further comprises a seventh processing sub-module used for calculating gray value gradient amplitude of each pixel point in the initial stroke track, an eighth processing sub-module used for performing binarization operation on the gray value gradient amplitude to obtain a binarization mask matched with the corresponding pixel point, and a ninth processing sub-module used for adjusting the ink diffusion matched with the corresponding pixel point according to the binarization mask to obtain the rendered brush stroke graph.
According to the embodiment of the disclosure, the ninth processing submodule comprises a first processing unit, a second processing unit and a third processing unit, wherein the first processing unit is used for adjusting the ink diffusivity matched with the corresponding pixel point according to at least one of the binarization mask and the following parameters to obtain the rendered writing brush stroke graph, dynamic noise density, ink diffusion range, ink solubility and paper density constant.
According to the embodiment of the disclosure, the third processing module further comprises a tenth processing sub-module, which is used for controlling the random boundary of the initial stroke track by utilizing a dynamic noise generation algorithm to obtain the rendered brush stroke graph.
According to the embodiment of the disclosure, the third processing module further comprises an eleventh processing sub-module for detecting the track profile of the initial pen touch track to obtain an internal coloring area of the initial pen touch track, and a twelfth processing sub-module for superposing a preset pen touch texture map on the internal coloring area of the initial pen touch track to obtain the writing brush pen touch graph with erosion effect.
According to the embodiment of the disclosure, the eleventh processing submodule comprises a second processing unit and a third processing unit, wherein the second processing unit is used for calculating a vector dot product of a vertex normal vector and a preset visual angle direction vector based on a corresponding track point aiming at any track point in the initial pen touch track, and the third processing unit is used for identifying the internal coloring area of the initial pen touch track according to the absolute value of the vector dot product.
According to the embodiment of the disclosure, the twelfth processing submodule comprises a fourth processing unit, a fifth processing unit, a sixth processing unit, a seventh processing unit and an eighth processing unit, wherein the fourth processing unit is used for sampling the brush stroke texture mapping based on any region point in the internal coloring region to obtain a target sampling mapping matched with a corresponding region point, the fifth processing unit is used for superposing the target sampling mapping on the position of the corresponding region point to obtain an initial erosion effect value based on the corresponding region point, the sixth processing unit is used for adjusting the initial erosion effect value by using a power exponent to obtain an erosion effect value after sharpness adjustment, the seventh processing unit is used for scaling the erosion effect value after sharpness adjustment to obtain a target erosion effect value based on the corresponding region point, and the eighth processing unit is used for applying the target erosion effect value to the corresponding region point in the internal coloring region to obtain the brush stroke pattern with the erosion effect.
According to the embodiment of the disclosure, the seventh processing unit comprises a first processing subunit, a second processing subunit and a third processing subunit, wherein the first processing subunit is used for scaling the erosion effect value subjected to sharpness adjustment to obtain a transitional erosion effect value, the second processing subunit is used for limiting the output value of the transitional erosion effect value in a preset range to obtain a smooth erosion effect value, and the third processing subunit is used for carrying out threshold inversion processing on the smooth erosion effect value based on a preset threshold inversion parameter to obtain the target erosion effect value based on a corresponding region point.
According to the embodiment of the disclosure, the third processing module further comprises a thirteenth processing sub-module, which is used for adjusting the pixel coordinates corresponding to the pen touch texture map so as to realize the displacement, rotation and scaling operation of the pen touch texture map.
According to the embodiment of the disclosure, the writing brush stroke simulation device further comprises a fifth processing module, wherein the fifth processing module is used for responding to the detected interaction action and persisting the writing brush stroke graph matched with the interaction action into a memory of a storage device.
It is noted that, in the technical solution of the present disclosure, the related processes of information collection, storage, use, processing, transmission, provision, disclosure and the like all conform to the rules of the related laws and regulations, and do not violate the public welcome.
According to embodiments of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium and a computer program product.
Fig. 9 schematically illustrates a block diagram of an electronic device for performing a brush stroke simulation method according to an embodiment of the disclosure.
Fig. 9 illustrates a schematic block diagram of an example electronic device 900 that may be used to implement embodiments of the present disclosure. Electronic device 900 is intended to represent various forms of digital computers, such as laptops, desktops, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The electronic device may also represent various forms of mobile devices, such as personal digital processing, cellular telephones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be exemplary only, and are not meant to limit implementations of the disclosure described and/or claimed herein.
As shown in fig. 9, the apparatus 900 includes a computing unit 901 that can perform various appropriate actions and processes according to a computer program stored in a Read Only Memory (ROM) 902 or a computer program loaded from a storage unit 908 into a Random Access Memory (RAM) 903. In the RAM 903, various programs and data required for the operation of the device 900 can also be stored. The computing unit 901, the ROM 902, and the RAM 903 are connected to each other by a bus 904. An input/output (I/O) interface 905 is also connected to the bus 904.
Various components in the device 900 are connected to the I/O interface 905, including an input unit 906 such as a keyboard, a mouse, etc., an output unit 907 such as various types of displays, speakers, etc., a storage unit 908 such as a magnetic disk, an optical disk, etc., and a communication unit 909 such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 909 allows the device 900 to exchange information/data with other devices through a computer network such as the internet and/or various telecommunications networks.
The computing unit 901 may be a variety of general and/or special purpose processing components having processing and computing capabilities. Some examples of computing unit 901 include, but are not limited to, a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), various specialized Artificial Intelligence (AI) computing chips, various computing units running machine learning model algorithms, a Digital Signal Processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 901 performs the respective methods and processes described above, for example, a brush stroke simulation method. For example, in some embodiments, the brush stroke simulation method may be implemented as a computer software program tangibly embodied on a machine-readable medium, such as the storage unit 908. In some embodiments, part or all of the computer program may be loaded and/or installed onto the device 900 via the ROM 902 and/or the communication unit 909. When the computer program is loaded into the RAM 903 and executed by the computing unit 901, one or more steps of the brush stroke simulation method described above may be performed. Alternatively, in other embodiments, the computing unit 901 may be configured to perform the brush stroke simulation method by any other suitable means (e.g. by means of firmware).
Various implementations of the systems and techniques described above can be implemented in digital electronic circuitry, integrated circuitry, field Programmable Gate Arrays (FPGAs), application Specific Integrated Circuits (ASICs), application Specific Standard Products (ASSPs), systems On Chip (SOCs), complex Programmable Logic Devices (CPLDs), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include being implemented in one or more computer programs that are executable and/or interpretable on a programmable system including at least one programmable processor, which may be a special or general purpose programmable processor, operable to receive data and instructions from, and to transmit data and instructions to, a storage system, at least one input device, and at least one output device.
Program code based on carrying out the methods of the present disclosure may be written in any combination of one or more programming languages. These program code may be provided to a processor or controller of a general purpose computer, special purpose computer, or other programmable brush stroke simulation apparatus, such that the program code, when executed by the processor or controller, causes the functions/operations specified in the flowchart and/or block diagram to be implemented. The program code may execute entirely on the machine, partly on the machine, as a stand-alone software package, partly on the machine and partly on a remote machine or entirely on the remote machine or server.
In the context of this disclosure, a machine-readable medium may be a tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. The machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
To provide for interaction with an object, the systems and techniques described here can be implemented on a computer having a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the object and a keyboard and a pointing device (e.g., a mouse or a trackball) by which the object can provide input to the computer. Other kinds of devices may also be used to provide for interaction with the subject, for example, feedback provided to the subject may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback), and input from the subject may be received in any form (including acoustic input, speech input, or tactile input).
The systems and techniques described here can be implemented in a computing system that includes a background component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front-end component (e.g., an object computer having a graphical object interface or a web browser through which an object can interact with an implementation of the systems and techniques described here), or any combination of such background, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a Local Area Network (LAN), a Wide Area Network (WAN), and the Internet.
The computer system may include a client and a server. The client and server are typically remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. The server may be a cloud server, a server of a distributed system, or a server incorporating a blockchain.
It should be appreciated that various forms of the flows shown above may be used to reorder, add, or delete steps. For example, the steps recited in the present disclosure may be performed in parallel, sequentially, or in a different order, provided that the desired results of the disclosed aspects are achieved, and are not limited herein.
The above detailed description should not be taken as limiting the scope of the present disclosure. It will be apparent to those skilled in the art that various modifications, combinations, sub-combinations and alternatives are possible, depending on design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present disclosure are intended to be included within the scope of the present disclosure.
Claims (15)
1. The writing brush touch simulation method based on physical interaction is characterized by comprising the following steps of:
Responding to the detected interaction action generated based on the touch equipment, and acquiring a force feedback parameter of the interaction action;
generating an initial stroke track according to the force feedback parameters and a preset writing brush nib model;
regulating the brush touch texture characteristics of the initial brush touch track to obtain a rendered brush touch graph, and
Controlling the display screen of the touch control equipment to display the brush stroke graph,
Wherein, the adjusting the brush touch texture feature of the initial brush touch track to obtain a rendered brush touch graph comprises:
Performing track profile detection on the initial pen touch track to obtain an internal coloring area of the initial pen touch track;
sampling the pen touch texture map based on any region point in the internal colored region to obtain a target sampling map matched with the corresponding region point;
superposing the target sampling map on the position of the corresponding region point to obtain an initial erosion effect value based on the corresponding region point;
Adjusting the initial erosion effect value by using a power exponent to obtain an erosion effect value after sharpness adjustment;
scaling the sharpness-adjusted erosion effect value to obtain a target erosion effect value based on the corresponding region point, and
And applying the target erosion effect value to a corresponding region point in the internal colored region to obtain the writing brush stroke pattern with the erosion effect.
2. The method of claim 1, wherein the obtaining, in response to the detected interaction based on the touch device, a force feedback parameter of the interaction comprises:
In response to the detected interaction, at least one of the following parameters of the interaction is obtained as the force feedback parameter:
current movement speed, pressure value parameters, interaction location parameters, and interaction angle parameters.
3. The method of claim 2, wherein generating an initial stroke track based on the force feedback parameters and a preset writing brush tip model comprises:
Determining a reverse cone direction and a cone vertex position according to the interaction position parameter and the interaction angle parameter based on a pre-constructed reverse cone model;
Determining the area radius of the pen touch area formed by the projection of the reverse cone on the paper surface according to the pressure value parameter, and
And generating the initial stroke track according to the reverse cone direction, the cone vertex position and the area radius of the stroke area.
4. The method according to claim 1, wherein the method further comprises:
and adjusting the ink permeation parameter of the initial brush stroke track to obtain a rendered brush stroke graph.
5. The method of claim 4, wherein the ink penetration parameter comprises an ink transparency, and wherein the adjusting the ink penetration parameter of the initial stroke trajectory results in a rendered brush stroke graphic, comprising:
For any target track point in the initial pen touch track, calculating the transparency of the ink mark matched with the target track point according to the distance between the target track point and the center of a pen touch area and the pressure value born by the target track point, and
And rendering the initial pen touch track according to the ink transparency matched with any target track point to obtain the rendered writing brush touch graph.
6. The method of claim 4, wherein the ink penetration parameter comprises an ink diffusivity, and wherein the adjusting the ink penetration parameter of the initial stroke trajectory results in a rendered brush stroke pattern comprising:
calculating the gray value gradient amplitude of each pixel point in the initial pen touch track;
performing binarization operation on the gray value gradient amplitude to obtain a binarization mask matched with the corresponding pixel point, and
And according to the binarization mask, adjusting the ink diffusivity matched with the corresponding pixel point to obtain the rendered brush pen touch graph.
7. The method of claim 6, wherein adjusting the ink diffusivity matching the corresponding pixel according to the binarization mask to obtain the rendered brush stroke pattern comprises:
adjusting the ink diffusivity matched with the corresponding pixel point according to the binarization mask and at least one of the following parameters to obtain the rendered brush stroke graph,
Dynamic noise density, ink spread range, ink solubility, and paper density constants.
8. The method of claim 4, wherein adjusting the ink permeation parameter of the initial stroke trajectory results in a rendered brush stroke pattern, comprising:
And controlling the random boundary of the initial stroke track by using a dynamic noise generation algorithm to obtain the rendered brush stroke graph.
9. The method of claim 1, wherein the performing track profile detection on the initial pen-touch track to obtain an internal colored region of the initial pen-touch track comprises:
For any track point in the initial pen touch track, calculating a vector dot product based on the vertex normal vector of the corresponding track point and a preset visual angle direction vector, and
The inner colored region of the initial stroke track is identified from the absolute value of the vector dot product.
10. The method of claim 1, wherein scaling the sharpness-adjusted erosion effect value to obtain a target erosion effect value based on a corresponding region point comprises:
Scaling the erosion effect value after sharpness adjustment to obtain a transitional erosion effect value;
limiting the output value of the transitional erosion effect value to a preset range to obtain a smooth erosion effect value, and
And carrying out threshold inversion processing on the smooth erosion effect value based on a preset threshold inversion parameter to obtain the target erosion effect value based on the corresponding region point.
11. The method of claim 1, wherein the adjusting the brush stroke texture feature of the initial brush stroke trajectory results in a rendered brush stroke graphic, further comprising:
and adjusting pixel coordinates corresponding to the pen touch texture map to realize displacement, rotation and scaling operations of the pen touch texture map.
12. The method according to claim 1, wherein the method further comprises:
and in response to the detected interaction, persisting the brush stroke graph matched with the interaction into a memory of a storage device.
13. Writing brush touch simulation device based on physical interaction, which is characterized by comprising:
the first processing module is used for responding to the detected interaction action generated based on the touch equipment and acquiring force feedback parameters of the interaction action;
the second processing module is used for generating an initial stroke track according to the force feedback parameters and a preset writing brush nib model;
a third processing module for adjusting the brush touch texture feature of the initial brush touch track to obtain a rendered brush touch graph, and
A fourth processing module for controlling the display screen of the touch control device to display the brush stroke graph,
Wherein, the third processing module is used for:
Performing track profile detection on the initial pen touch track to obtain an internal coloring area of the initial pen touch track;
sampling the pen touch texture map based on any region point in the internal colored region to obtain a target sampling map matched with the corresponding region point;
superposing the target sampling map on the position of the corresponding region point to obtain an initial erosion effect value based on the corresponding region point;
Adjusting the initial erosion effect value by using a power exponent to obtain an erosion effect value after sharpness adjustment;
scaling the sharpness-adjusted erosion effect value to obtain a target erosion effect value based on the corresponding region point, and
And applying the target erosion effect value to a corresponding region point in the internal colored region to obtain the writing brush stroke pattern with the erosion effect.
14. An electronic device, comprising:
At least one processor, and
A memory communicatively coupled to the at least one processor, wherein,
The memory stores instructions executable by the at least one processor to enable the at least one processor to perform the brush stroke simulation method of any one of claims 1-12.
15. A non-transitory computer-readable storage medium storing computer instructions for causing the computer to perform the brush stroke simulation method of any one of claims 1-12.
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202411977308.1A CN119378282B (en) | 2024-12-31 | 2024-12-31 | Brush stroke simulation method and device based on physical interaction |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202411977308.1A CN119378282B (en) | 2024-12-31 | 2024-12-31 | Brush stroke simulation method and device based on physical interaction |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| CN119378282A CN119378282A (en) | 2025-01-28 |
| CN119378282B true CN119378282B (en) | 2025-03-28 |
Family
ID=94335980
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202411977308.1A Active CN119378282B (en) | 2024-12-31 | 2024-12-31 | Brush stroke simulation method and device based on physical interaction |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN119378282B (en) |
Citations (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN117911600A (en) * | 2023-12-25 | 2024-04-19 | 网易(杭州)网络有限公司 | Method and device for generating stylized hand-drawing effect, storage medium and electronic device |
Family Cites Families (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| WO2009070142A1 (en) * | 2007-11-30 | 2009-06-04 | Hewlett-Packard Development Company, L.P. | Method and system for measuring text-rendering quality |
| US20110249007A1 (en) * | 2010-04-13 | 2011-10-13 | Disney Enterprises, Inc. | Computer rendering of drawing-tool strokes |
| US8994698B2 (en) * | 2012-03-02 | 2015-03-31 | Adobe Systems Incorporated | Methods and apparatus for simulation of an erodible tip in a natural media drawing and/or painting simulation |
| WO2015075930A1 (en) * | 2013-11-19 | 2015-05-28 | Wacom Co., Ltd. | Method and system for ink data generation, ink data rendering, ink data manipulation and ink data communication |
| CN112070873B (en) * | 2020-08-26 | 2021-08-20 | 完美世界(北京)软件科技发展有限公司 | Model rendering method and device |
-
2024
- 2024-12-31 CN CN202411977308.1A patent/CN119378282B/en active Active
Patent Citations (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN117911600A (en) * | 2023-12-25 | 2024-04-19 | 网易(杭州)网络有限公司 | Method and device for generating stylized hand-drawing effect, storage medium and electronic device |
Also Published As
| Publication number | Publication date |
|---|---|
| CN119378282A (en) | 2025-01-28 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN110610453B (en) | Image processing method and device and computer readable storage medium | |
| KR101636808B1 (en) | Dynamic graphical interface shadows | |
| US9955065B2 (en) | Dynamic motion path blur user interface | |
| US10338725B2 (en) | Wet ink predictor | |
| US9779484B2 (en) | Dynamic motion path blur techniques | |
| CN109448137B (en) | Interaction method, interaction device, electronic equipment and storage medium | |
| US20130300740A1 (en) | System and Method for Displaying Data Having Spatial Coordinates | |
| US9723204B2 (en) | Dynamic motion path blur kernel | |
| JP2022168167A (en) | Image processing method, device, electronic apparatus, and storage medium | |
| JP2024508566A (en) | Dynamic gesture recognition method, device, readable storage medium and computer equipment | |
| CN114332339B (en) | System for coloring vector objects | |
| US11551391B2 (en) | Digital image dynamic shadow generation | |
| CN106971370B (en) | System and method for taking picture as background picture plane vector diagram | |
| CN119378282B (en) | Brush stroke simulation method and device based on physical interaction | |
| US10573033B2 (en) | Selective editing of brushstrokes in a digital graphical image based on direction | |
| CN113688737B (en) | Face image processing method, device, electronic device, storage medium and program | |
| CN120198616A (en) | Image rendering method, device, electronic device and storage medium | |
| CN111047666B (en) | Unified digital content selection system for vector and raster graphics | |
| CN119091018A (en) | Rendering method, device, equipment and storage medium for water body effect | |
| US20140225886A1 (en) | Mapping a vision system output to a digital graphics system input | |
| CN119832138B (en) | Ink-and-wash style image rendering method and device | |
| US11875445B2 (en) | Seamless image processing of a tiled image region | |
| CN116700525A (en) | Method and system for realizing virtual touch of LED display screen based on digitization | |
| KR101824178B1 (en) | Method and apparatus for controlling transparency based on view on 3 dimension rendering device | |
| Jung et al. | An intuitive user interaction method using multi-sensors for pencil drawing filter of NPR rendering in mobile devices |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| PB01 | Publication | ||
| PB01 | Publication | ||
| SE01 | Entry into force of request for substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| GR01 | Patent grant | ||
| GR01 | Patent grant |