CN107291360A - Build the husky method for drawing simulation system - Google Patents
Build the husky method for drawing simulation system Download PDFInfo
- Publication number
- CN107291360A CN107291360A CN201710536378.7A CN201710536378A CN107291360A CN 107291360 A CN107291360 A CN 107291360A CN 201710536378 A CN201710536378 A CN 201710536378A CN 107291360 A CN107291360 A CN 107291360A
- Authority
- CN
- China
- Prior art keywords
- sand
- grains
- pixel
- husky
- height
- 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.)
- Pending
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR 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/048—Interaction techniques based on graphical user interfaces [GUI]
- G06F3/0487—Interaction techniques based on graphical user interfaces [GUI] using specific features provided by the input device, e.g. functions controlled by the rotation of a mouse with dual sensing arrangements, or of the nature of the input device, e.g. tap gestures based on pressure sensed by a digitiser
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T11/00—2D [Two Dimensional] image generation
- G06T11/80—Creating or modifying a manually drawn or painted image using a manual input device, e.g. mouse, light pen, direction keys on keyboard
Abstract
Sand picture is the art form of the aesthetic conceptions with reference to modern, the deep cultural deposits of support and cultural connotation.Understand the husky chance drawn to give people to provide husky draw of contact, the system proposes that a kind of adaptive algorithm carrys out real-time Simulation sand picture.Concept of the system based on height field simulates sand incipience, real-time and quick.Sand incipience is main to be collapsed two parts and is constituted by grains of sand accumulation and the grains of sand.The introducing of the field of direction approx illustrates the normal distribution of the grains of sand under actual conditions, optimizes grains of sand heap integration method.The utilization of adaptive approach presents more details in the grains of sand collapse algorithm.In addition, the present invention considers the simulation of colored sand by two ways, a kind of is the background color of husky platform, and another is the color of the grains of sand.Consumer's Experience feed back with test result indicates that:This sand draws simulation system and algorithm can truly, effectively, alternatively progress sand draws artistic creation.
Description
Technical field
The present invention relates to the technical field of virtual reality, more particularly to the skill that the Particles Moving developed based on C# language is simulated
Art.
Background technology
It is a kind of performance form being combined with theatrical art just risen 21 century that sand, which draws art, and it breaches tradition
Art, intention is magical, picture is beautiful absolutely, coordinates graceful background music, and flawless performance is startling.But it is due to husky picture
The mechanical discipline of making is strong, the presence for the problems such as instrument is not portable so that sand be drawn in daily propagation and rise by
Certain limitation.
The today constantly risen in numerical medium art, one kind is had become come design simulation painting software using computer
Upsurge.And because husky draw compared to for other drawing species, its painting mode is more special, so being drawn in husky draw of simulation
Aspect also has considerable room for improvement.
The content of the invention
The husky chance drawn is understood to give people to provide the husky picture of contact, the present invention is intended to provide a kind of structure is husky to draw simulation system
Method, with real-time Simulation sand draw.
In order to which by computer technology and traditional art perfect adaptation, husky picture can be more truly created using computer,
The true husky drafting drawn of primary study of the present invention, i.e., the drafting drawn based on details sense of reality sand.The difficult point of solution is that one is husky
Draw drafting gimmick rich and varied, it is true to approach how appliance computer is programmed for different drafting gimmicks algorithm reasonable in design
Effect, two be that the real-life grains of sand are motions, how to consider that factor as much as possible goes to simulate real sand incipience
And improve the real effectiveness of system.Three be how using computer husky picture system to be increased on the operation on basis for user
Plus new enjoyment.
Therefore, the present invention uses following technical scheme:
It is a kind of to build the husky method for drawing simulation system, comprise the following steps:
1) all kinds of husky attributes for drawing gimmick are defined;
2) height of the grains of sand is described
The height of the grains of sand is described using D prism map;
3) motion of the grains of sand is described
The motion of the grains of sand is described using the field of direction, the direction is defined as the diverging mould on semicircular area edge
Formula, is reduced to four direction, the uneven distribution to describe the grains of sand by semicircular area peripheral direction;
4) grains of sand accumulation is calculated using adaptive algorithm;
5) grains of sand are calculated using adaptive algorithm to collapse.
The step 2) described in grains of sand height comprise the following steps that:
2.1) painting canvas of M*N resolution ratio is regarded as a two-dimensional grid, one of pixel coordinate is (i, j), herein 0
≤ i≤M-1,0≤j≤N-1;
2.2) grains of sand are represented with each pixel;
2.3) after sand incipience, a dust devil is formed on each pixel, the height value of dust devil is by hijRepresent;
2.4) during husky draw is made, the height value of dust devil is bigger in certain pixel, just assigns the brightness value of the pixel
Smaller, vice versa, i.e., the grains of sand height accumulated at the pixel is represented with the size of the brightness value of pixel.
The step 3) described in sand incipience comprise the following steps that:
3.1) semicircular area of style of writing end is divided into four parts, it is outside that four direction is each perpendicular to semi arch;
3.2) weight for accounting for whole end grains of sand is drawn according to actual measured results to each part, that is, takes each of which direction
The arithmetic average of the numerical value of upper small arc-shaped is used as ratio value in this direction.
The step 4) in the calculating grains of sand accumulation comprise the following steps that:
4.1) grains of sand being cleared when being drawn to user in the contact area of each carry out total amount statistics, are accumulating again
Increased grains of sand quantity, the grains of sand quantity that as contact area is cleared are diffused in region;
4.2) in being near contour curve because of the comprehensive function of gravity and frictional force due to the grains of sand accumulated again
Between the low substantially symmetric distribution in high two ends, and reach in center section the peak value of accumulation, this distributed effect with probability theory
Normal distribution curve is similar, so calculating the increased height of the grains of sand accumulated at section and being represented using normal distribution;
4.3) piling height of the grains of sand correspondence position grains of sand is determined from numerical value normal distyribution function.
The step 5) in comprising the following steps that of collapsing of the calculating grains of sand:
Adjacent height difference is reduced using the method for smoothing processing and simulates the collapse phenomenon of the grains of sand, i.e., it is after accumulation pair and all
Enclose the grains of sand post that grains of sand pillar height degree differs greatly and carry out smoothing techniques on height, i.e., phase is reduced using the method for smoothing processing
Adjacent difference in height simulates the collapse phenomenon of the grains of sand.
Further:
Colored sand is simulated using RGBA models, its step is as follows:
Statistical operation is carried out to the brightness value of each pixel in image;
The pixel in image is ranked up according to measurement brightness size, the pixel for having similar brightness value is classified simultaneously
Count number, by brightness value it is close be considered as same class color, and count the pixel of similar color in the picture in total pixel
Shared ratio;
The RGBA values that the color value at certain grains of sand pixel (i, j) place is set by control panel are changed, wherein, R is represented
The red component of color, G represents the green component of color, and B represents the blue component of color, and A represents the α components of opacity;
The grains of sand highly use hijRepresent, work as hijWhen=0, no grains of sand are indicated, color is set to the daylighting platform color of itself;Work as hij
When gradually increasing, the lightness reduction of color so that color changes, so as to embody the accumulation effect of the grains of sand.
The contribution of the present invention mainly has two broad aspects:
In terms of 1 skill and technique:, with effect is presented, one is defined by observing each husky use for drawing drafting gimmick on true husky platform
Husky based on details of set, which is drawn, to be drawn skill and technique and includes the husky seven kinds of skill and technique drawn and drawn, sand, hooks it is husky, sand, smear that husky, point is husky, drawing sand,
Pinch sand so that sand, which is drawn, draws truer.In addition, introduce height field and the concept of the field of direction realizes high-speed simulation, utilize
RGBA models simulate colored sand.
The 2 husky simulation algorithms drawn:Adaptive algorithm mainly includes grains of sand heap integration method and the grains of sand collapse two keys of algorithm
Method, they simulate the details of sand incipience effectively in real time.
Brief description of the drawings
Fig. 1 is height field method schematic diagram;
Fig. 2 is the husky legitimate reading schematic diagram of hook;
Fig. 3 is the husky schematic diagram of leakage;
Fig. 4 is the husky schematic diagram of hook;
Fig. 5 is to pinch husky schematic diagram;
Fig. 6 is three examples of grains of sand pixel color parameter setting;
Fig. 7 draws simulation system interface to be husky, wherein:(a) color parameter setting, (b) user interface, the one of (c) toolbar
Part;
Fig. 8 is field of direction schematic diagram, wherein:(a) hook sand, (b) smear husky, (c) and pinch sand;
In Fig. 9, (a), to hook husky schematic diagram, (b) is normal distribution;
Figure 10 is that 7 planting sands draw drafting skill and technique simulation, wherein:(a) (b) leakage husky (c) point husky (d) hook husky (e) is sanded to smear
Husky (f) draws husky (g) and pinches sand;
Figure 11 is that the sub-pixel for being divided into k*k resolution ratio is handled sand incipience schematic diagram by each pixel.
Embodiment
The present invention is a kind of method for building husky picture simulation system, is comprised the following steps:
1) all kinds of husky attributes for drawing gimmick are defined;
2) height of the grains of sand is described
The height of the grains of sand is described using D prism map;
3) motion of the grains of sand is described
The motion of the grains of sand is described using the field of direction, the direction is defined as the diverging mould on semicircular area edge
Formula, is reduced to four direction, the uneven distribution to describe the grains of sand by semicircular area peripheral direction;
4) grains of sand accumulation is calculated using adaptive algorithm;
5) grains of sand are calculated using adaptive algorithm to collapse.
The step 2) described in grains of sand height comprise the following steps that:
2.1) painting canvas of M*N resolution ratio is regarded as a two-dimensional grid, one of pixel coordinate is (i, j), herein 0
≤ i≤M-1,0≤j≤N-1;
2.2) grains of sand are represented with each pixel;
2.3) after sand incipience, a dust devil is formed on each pixel, the height value of dust devil is by hijRepresent;
2.4) during husky draw is made, the height value of dust devil is bigger in certain pixel, just assigns the brightness value of the pixel
Smaller, vice versa, i.e., the grains of sand height accumulated at the pixel is represented with the size of the brightness value of pixel.
The step 3) described in sand incipience comprise the following steps that:
3.1) semicircular area of style of writing end is divided into four parts, it is outside that four direction is each perpendicular to semi arch;
3.2) weight for accounting for whole end grains of sand is drawn according to actual measured results to each part, that is, takes each of which direction
The arithmetic average of the numerical value of upper small arc-shaped is used as ratio value in this direction.
The step 4) in the calculating grains of sand accumulation comprise the following steps that:
4.1) grains of sand being cleared when being drawn to user in the contact area of each carry out total amount statistics, are accumulating again
Increased grains of sand quantity, the grains of sand quantity that as contact area is cleared are diffused in region;
4.2) in being near contour curve because of the comprehensive function of gravity and frictional force due to the grains of sand accumulated again
Between the low substantially symmetric distribution in high two ends, and reach in center section the peak value of accumulation, this distributed effect with probability theory
Normal distribution curve is similar, so calculating the increased height of the grains of sand accumulated at section and being represented using normal distribution;
4.3) piling height of the grains of sand correspondence position grains of sand is determined from numerical value normal distyribution function.
The step 5) in comprising the following steps that of collapsing of the calculating grains of sand:
Adjacent height difference is reduced using the method for smoothing processing and simulates the collapse phenomenon of the grains of sand, i.e., it is after accumulation pair and all
Enclose the grains of sand post that grains of sand pillar height degree differs greatly and carry out smoothing techniques on height, i.e., phase is reduced using the method for smoothing processing
Adjacent difference in height simulates the collapse phenomenon of the grains of sand.
Further:
Colored sand is simulated using RGBA models, its step is as follows:
Statistical operation is carried out to the brightness value of each pixel in image;
The pixel in image is ranked up according to measurement brightness size, the pixel for having similar brightness value is classified simultaneously
Count number, by brightness value it is close be considered as same class color, and count the pixel of similar color in the picture in total pixel
Shared ratio;
The RGBA values that the color value at certain grains of sand pixel (i, j) place is set by control panel are changed, wherein, R is represented
The red component of color, G represents the green component of color, and B represents the blue component of color, and A represents the α components of opacity;
The grains of sand highly use hijRepresent, work as hijWhen=0, no grains of sand are indicated, color is set to the daylighting platform color of itself;Work as hij
When gradually increasing, the lightness reduction of color so that color changes, so as to embody the accumulation effect of the grains of sand.
The present invention is described specifically below.
It is of the invention by sand by the truly husky investigation of picture gimmick and the observation of the practical operation effect in reality on husky platform
Draw gimmick and be divided into 7 classes, respectively " sanding ", " leakage is husky ", " point is husky ", " hooking husky ", " smearing sand ", " drawing sand ", " pinching sand ".
In table 1, this 7 kinds of respective attributes of gimmick being respectively defined, including pattern, painting/sand, contact position connects
Diagram, style of writing size etc. should be put by touching.
Table 1
In whole husky picture simulation system, it is most important that definition and sports immunology to the grains of sand.How the grains of sand to be described
Model and rendering technique pattern all have a significant impact to the emulator of final result and the efficiency of algorithm of analogue system.Based on this
Consideration to emulator and efficiency of algorithm a bit, height field and the field of direction are introduced in the system of the present invention.In addition, in the grains of sand
In the simulation that accumulation and the grains of sand are collapsed, have to the accurate distribution of the grains of sand and adaptive algorithm.
Height field method describes the height of the grains of sand using the height of D prism map, when the grains of sand are collided or squeezed by object
During pressure, grains of sand height can change therewith in contact area, and the motion of the grains of sand is described with this.As shown in figure 1, by M*N resolution ratio
Painting canvas regard a two-dimensional grid as, the coordinate of one of pixel is represented with (i, j), herein 0≤i≤M-1,0≤j≤N-1;
A dust devil is formed after representing the grains of sand, sand incipience with each pixel in each pixel, the height of dust devil is by hijRepresent, root
Factually border sand draws drawing result, show that the dust devil height value of certain pixel on painting canvas is bigger, the brightness value is smaller;Vice versa,
The grains of sand height accumulated at this is represented with the size of the brightness value of pixel.
According to our careful observations, in actual sand incipience, the grains of sand of end are always compared with top in the direction of motion
The grains of sand seem many, with finger the operation of the grains of sand can be clearly seen that the grains of sand being cleared be distributed in two ends quantity become
Change.Clearly referring to Fig. 2, from the grains of sand state in three circles, the grains of sand of circle accumulation of centre can be become apparent from most
It is many, and the grains of sand in the circle on both sides are relatively fewer.The frictional force produced in the had inertia of motion and motion process causes
The grains of sand can change on the premise of other extraneous factors are not considered because of direction reason.Therefore, in order to which more preferable simulation is husky
Uneven distribution during grain motion, invention defines the concept of the field of direction.As shown in figure 8, uneven distribution is mainly concentrated
In the semicircular area of the finger covering of each path ends.Therefore, the field of direction is defined as on semicircular area edge
Divergent mode.
Substantially all it is that the grains of sand are produced by moving although different husky skill and technique difference in drafting effect of drawing is very big
The result accumulated and collapsed.Can be obtained by the height field introduced, during the changes of the grains of sand be all reflected in the change of dust devil height field.
The following is the design principle of seven kinds of skill and technique.
It is the husky conventional skill and technique drawn in drawing to sand, and its purpose is equably laid in sand on husky picture platform, Chang Wei
Sand, which is drawn, draws the step of most starting.
It is to add the new grains of sand on the basis of husky platform is original to leak sand so that the grains of sand are accumulated, and the sand drift of center section is when height
Degree reach certain threshold value when the grains of sand according to the direction of arrow to around sliding, as shown in Figure 3.During leakage is husky, a change is set
Measure NeTo record the total amount of the accumulation grains of sand, when unicursal is complete, result, leaks the accumulation result and normal distribution curve of sand according to the observation
It is closely similar, as shown in Figure 3.
Hook sand and refer to that the grains of sand of contact portion are emptied, be assigned to empty region both sides according to a certain percentage, the both sides grains of sand are obtained
Normal distribution, such as Fig. 4 is presented to accumulation.Hook it is husky in itself with a sand, smear sand, draw sand and be not different, but it is to the grains of sand to hook sand
It is continuous empty, point sand can regard that the hook of " breakpoint formula " is husky as, and smearing sand can regard as husky as the hook of " overstriking version ", and drawing sand is
Several fingers used skill and technique when drawing a picture together, multi-purpose river of drawing a picture, cloud can regard the hook of " multiple to replicate " as
It is husky.
It is effect of two fingers to the grains of sand to pinch sand, is the picture that the brightness value of the pixel of both sides sand drift is added to middle sand drift
On plain brightness value so that center section is towering, both sides are emptied (as shown in Figure 5).
In fact, although the different husky drafting effect difference for drawing skill and technique generation is very big, but algorithmically, their essence is all
It is by realizing that accumulation and the grains of sand again of the grains of sand collapse two processes and realized.
In real husky picture, the color that sand is drawn is to build the various beautiful key factors with artistic effects.The reality of colored sand
Now it is generally divided into two classes:One be husky platform background color;Another is the color of the grains of sand in itself.In the present invention, for mould
Intend colored sand effect, improve authenticity, color factors are taken into account in algorithm.
It is the example of three kinds of colored sand colors shown in Fig. 6, by adjusting R, G, B, A value change grains of sand color, herein,
" R " represents the red component of color, and " G " represents green component, and " B " represents blue component, and " A " represents the α components of opacity
(α components are typically used as opacity parameter, can with percentage, integer or as RGB parameters with 0 to 1 real number table
Show).User can be judged whether according to the Button Color of acknowledgement key be oneself need colored sand face bag, convenience and high-efficiency.
Colored sand step is as follows:
1. according to HSB model table diagram pictures, statistical operation is carried out for the brightness value of each pixel in image.
2. the pixel in image is ranked up according to measurement brightness size, by with there is the progress of the pixel of similar brightness value
Classify and count number, be considered as same class color by what brightness value was closer to, and count the pixel number of similar color and exist
Ratio in image shared by total pixel number, is represented, wherein i=0,1 ..., n-1 with ti%, and n is color block classification number
Mesh, i is color block classification index value.Ti interval is [0,100].During simulation algorithm practical implementation, n=16 is taken.
3. the color value at certain grains of sand pixel (i, j) place sets RGBA values to be changed by control panel, grains of sand height
Use hijRepresent.Work as hijWhen=0, no grains of sand are indicated, color is the daylighting platform color of itself;Work as hijWhen gradually increasing, color it is bright
Degree reduction so that color changes, and embodies the accumulation effect of the grains of sand.
The main thought of the present invention is that building a real-time effective sand draws simulation system, the design from interface, to sand
Draw the simulation of skill and technique, then into drawing process sand incipience simulation, and colored sand function etc. makes every effort to bring to user as far as possible
Real husky draw draws experience.
To make the object, technical solutions and advantages of the present invention clearer, below in conjunction with drawings and the specific embodiments, to this
Invention, which is done, further to be described in detail.
Husky simulation system interface of drawing of the invention is divided into three parts (shown in such as Fig. 7 (b)):Black portions are toolbar above,
Summarize the button of various functions;Here is drawing area;The upper left hand corner section of drawing area be set grains of sand color by
Button.Toolbar includes different husky draw such as " sanding ", " leakage is husky ", " hooking husky ", " smearing sand ", " drawing sand ", " point is husky ", " pinching sand " and draws hand
The select button of method, in addition toolbar also add the functions such as " beginning ", " protect row ", " revocation ", " exiting " (such as Fig. 7 (c) institutes
Show).In color setting unit, grains of sand color can be changed by adjusting RGBA value (shown in such as Fig. 7 (a)).
In terms of height field:
Regard the painting canvas of M*N resolution ratio as a two-dimensional grid, one of pixel point coordinates is represented with (i, j), wherein 0
≤ i≤M-1,0≤j≤N-1;The grains of sand on each pixel are referred to as dust devil, coordinate is dust devil on the pixel of (i, j)
Height hijTo represent.According to actual husky picture drawing result, show that certain point dust devil height value is bigger on painting canvas, the brightness value
It is smaller;Vice versa.Rule accordingly, definition is husky draw in coordinate be dust devil height h on the pixel of (i, j)ijWith the brightness value
IijBetween relation such as formula (1) shown in:
Shown in relation such as formula (1):
Wherein, k is user-defined normal constant, the size for adjusting height value;And Imin≤Iij≤Imax, IminWith
ImaxThe minimum value and maximum of respectively initial painting canvas brightness.
Under normal circumstances, when not having the grains of sand on sand drawing cloth, the brightness value of each pixel will be maximum, and equal to picture
The brightness value of cloth.It is demonstrated experimentally that brightness maxima ImaxWith brightness value I of the husky drawing cloth in the case of without the grains of sandoInstead of Imax,
Then formula (1) is changed into:
It can be seen from formula (2) when the brightness value of certain pixel takes the default initialization brightness value of painting canvas itself, the point
Height be that this is also identical with truth.
In terms of the field of direction:
As shown in figure 8, uneven distribution is concentrated mainly on the semicircular area of the finger covering of each path ends.
Therefore, the field of direction is defined as the divergent mode on semicircular area edge.Limited by painting canvas resolution ratio, the two of particle
Difference between individual adjacent direction should not be too small.Therefore, in actual applications, the field of direction around semicircular area can letter
Four Main ways are turned to, to describe the uneven distribution of the grains of sand, as shown in Figure 8.By collecting and analyzing on true sand table
Data, obtain the grains of sand distribution of different directions, as shown in Figure 2.Measure herein hook it is husky at the end of each direction of sand pixel
Value, and calculate the proportionality coefficient of each direction grains of sand distribution.A~c represents to hook husky, stroke sand respectively in Fig. 8, pinches end during sand
The grains of sand are distributed, and are substantially the same states.In order to simplify concept, the half-circle area of style of writing end is divided into four parts,
Four direction is each perpendicular to semi arch outwards, and each part draws the weight for accounting for whole end grains of sand according to actual measured results,
Respectively P1, P2, P3, P4.
The direction field vector at pixel (i, j) place be d (i, j), its corresponding weight can according to each small arc-shaped relative to
The grains of sand empty the occupation rate of the whole arc around region to calculate.Assuming that direction d (i, j) weight is Pm, wherein m is direction
Index, n is the direction number in algorithm.PmFormula 3 can be expressed as:
As described above, in actually calculating, direction number n is set as 4.Weight PmIt is expressed as formula 4:
Influenceed by the field of direction, different grains of sand distributions cause dust devil height field at each pixel to change therewith.If dust devil is close
Spend for ρ, dust devil gross mass is M, the increased dust devil high variable quantity in pixel (i, j) place is Δ h(i, j), floor space is Δ S, is not examined
Dust devil high variable quantity when considering the field of direction is Δ hL (i, j).Dust devil mass M calculates as shown in Equation 5:
Difference in height Δ h(i, j)Formula 6 can be expressed as:
Formula 5 is updated to formula 6, formula 7 is obtained:
If the dust devil that some pixel is represented on edge is highly h(i, j), the dust devil after the grains of sand are moved by drawing path
New high degree is h '(i, j), represent as shown in Equation 8:
h′(i, j)=h(i, j)+Δh(i, j) (8)
In summary, the field of direction is reduced to the small arc-shaped on four direction, and feelings are distributed according to the grains of sand in True Data
The repeated measurement of condition difference for several times, and takes the arithmetic average of the numerical value of small arc-shaped on each of which direction as ratio in this direction
Value, i.e. p1, p2, p3, p4.
In terms of adaptive algorithm incorporates skill and technique algorithm:
Adaptive algorithm be fusion in each husky algorithm design for drawing skill and technique because each gimmick be required for it is adaptive
Should, adaptively include grains of sand accumulation and the grains of sand are collapsed.
The reason for adaptive algorithm can show husky picture more details is what is influenceed along drawing path by sand incipience
The sub-pixel for being divided into k*k resolution ratio is handled sand incipience by each pixel in region.In practical operation, we
Simulation system in k values are set to 2, as shown in figure 11, " 1 " is used to mark the subpixel area that is influenceed by fluidized particle, is worth " 0 "
Represent impregnable pixel region.This is conducive to obtaining more details when simulating grains of sand flowing, particularly grains of sand accumulation and
The simulation collapsed.
Grains of sand heap integration method is as follows:
1. each time domain when being drawn according to userThe grains of sand being cleared carry out total amount statistics, in build-up areas again
Increased grains of sand quantity i.e. contact area is diffused in ΦThe grains of sand quantity being cleared.
2. by according to priori, the grains of sand accumulated again can be because the comprehensive function of gravity and frictional force be in contour curve
In the low substantially symmetric distribution in middle high two ends near L, and reach in center section the peak value of accumulation, this distributed effect with it is general
Normal distribution curve in rate opinion is similar, so calculating the increased height of the grains of sand accumulated at section and being represented with normal distribution.
When drawing, the user's finger contacts grains of sand can give one active force of the grains of sand of contact area so that the grains of sand are to surrounding
Diffusion, so that the grains of sand of contact area are cleared, such as shown in Fig. 9 (a) (It is that the grains of sand empty region, Φ is that the grains of sand are accumulated again
Region, red dotted box portion is by the region for drawing influence), i.e. Fig. 2 cross section.It is applied to the sand around contact area
On power so that around the sand in the region and adjacent area is diffused into, and sand in contact area will be eliminated, such as
Shown in Fig. 9 (a).
Because actually the grains of sand are incompressible, so each dust devil has identical density p, as shown in formula 5.
In regionIn the grains of sand total amount HtDrawn by formula 9:
hijRefer to the dust devil height at pixel (i, j) place.
Grains of sand H needed for each normal distributione, i.e., at section accumulate the increased height of the grains of sand and, with grains of sand total amount HtCan
To be expressed as formula (10):
Wherein, N is the region that is clearedMiddle pixel number, σ is that normal distribution standard is poor.
In real world, carrying out only having leakage sand to increase the grains of sand total volume production of the grains of sand to husky picture platform when husky picture is drawn
It is raw to change outer, it is other it is husky draw gestures will not all change grains of sand total quantity, i.e. grains of sand total quantity be it is constant, thus,
Again increased grains of sand quantity as contact area is diffused in build-up areas ΦThe grains of sand quantity being cleared.According to priori
Knowledge, the grains of sand accumulated again can be because the comprehensive function of gravity and frictional force be low in middle high two ends near contour curve L
Substantially symmetric distribution, and reach in center section the peak value of accumulation, this distributed effect and normal distribution in probability theory are bent
Line is similar, such as shown in Fig. 9 (a), thus, we determine grains of sand correspondence position from the more accurate normal distyribution function of numerical value
The piling height of the grains of sand wherein, the height field changes delta h of corresponding each pixel value of the grains of sand of accumulationijFormula can be expressed as
(11):
Wherein, D is most short Euler's distance that pixel (i, j) arrives curve L, and σ is that normal distribution standard is poor.
The grains of sand collapse algorithm
, can be due to the Action of Gravity Field for the grains of sand accumulated again so that the part surface after accumulation after the grains of sand are accumulated
There is an avalanche phenomenon in the grains of sand, and the basic reason for occurring avalanche phenomenon is because adjacent dust devil difference in height differs larger, institute
With we adaptive collapse i.e. after accumulation pair and around the grains of sand post that differs greatly of grains of sand pillar height degree carry out the flat of height
Cunningization processing, i.e., the method for sliding processing using first reduces adjacent height difference to simulate the collapse phenomenon of the grains of sand.This collapse process is only
The height of pixel dust devil that need to be big to difference in height in two region Ω+Φ carries out smoothing techniques, and the smoothening procedure is such as
Formula (12) and (13), (14) are shown:
Δhij=hij-aHij (13)
Wherein, aHijFor the arithmetic average of all pixels point dust devil height value in the eight neighborhood of pixel (i, j), Δ hij
For pixel (i, j) place dust devil height hijWith aHijDifference, ε is a difference in height threshold value, only when difference be more than threshold value after
The grains of sand can just be collapsed to surrounding.
As a result it is as shown in Figure 10.
Colored sand function
Most starting, be, according to HSB model table diagram pictures, statistics behaviour to be carried out to the brightness value of wherein each pixel herein
Make.The pixel in image is ranked up according to brightness size, will be classified and counted with the pixel for having similar brightness value
Number, same class color is considered as by what brightness value was closer to, and it is total in the picture to count the pixel number of similar color
Ratio shared by pixel number, is represented with ti%, wherein i=0,1 ..., n-1, and n is color block class number, and i is color block
Classification index value.It is worth noting that ratio ti interval is [0,100] herein.During simulation algorithm practical implementation,
Take n=16.
The color value at certain grains of sand pixel (i, j) place sets RGBA values to be changed by control panel, and the grains of sand highly make
Use hijRepresent.Work as hijWhen=0, no grains of sand are indicated, color is the daylighting platform color of itself;Work as hijWhen gradually increasing, color it is bright
Degree reduction so that color changes, and embodies the accumulation effect of the grains of sand.
Claims (6)
1. a kind of build the husky method for drawing simulation system, it is characterised in that comprises the following steps:
1) all kinds of husky attributes for drawing gimmick are defined;
2) height of the grains of sand is described
The height of the grains of sand is described using D prism map;
3) motion of the grains of sand is described
The motion of the grains of sand is described using the field of direction, the direction is defined as the divergent mode on semicircular area edge, will
Semicircular area peripheral direction is reduced to four direction, the uneven distribution to describe the grains of sand;
4) grains of sand accumulation is calculated using adaptive algorithm;
5) grains of sand are calculated using adaptive algorithm to collapse.
2. as claimed in claim 1 build the husky method for drawing simulation system, it is characterised in that:
The step 2) described in grains of sand height comprise the following steps that:
2.1) painting canvas of M*N resolution ratio is regarded as a two-dimensional grid, one of pixel coordinate is (i, j), herein 0≤i
≤ M-1,0≤j≤N-1;
2.2) grains of sand are represented with each pixel;
2.3) after sand incipience, a dust devil is formed on each pixel, the height value of dust devil is by hijRepresent;
2.4) during husky draw is made, the height value of dust devil is bigger in certain pixel, and the brightness value for just assigning the pixel is smaller,
Vice versa, i.e., the grains of sand height accumulated at the pixel is represented with the size of the brightness value of pixel.
3. as claimed in claim 1 build the husky method for drawing simulation system, it is characterised in that:
The step 3) described in sand incipience comprise the following steps that:
3.1) semicircular area of style of writing end is divided into four parts, it is outside that four direction is each perpendicular to semi arch;
3.2) weight for accounting for whole end grains of sand is drawn according to actual measured results to each part, that is, is taken small on each of which direction
The arithmetic average of the numerical value of circular arc is used as ratio value in this direction.
4. as claimed in claim 1 build the husky method for drawing simulation system, it is characterised in that:
The step 4) in the calculating grains of sand accumulation comprise the following steps that:
4.1) grains of sand being cleared when being drawn to user in the contact area of each carry out total amount statistics, in build-up areas again
Inside it is diffused increased grains of sand quantity, the grains of sand quantity that as contact area is cleared;
4.2) because the grains of sand accumulated again can be because the comprehensive function of gravity and frictional force be in middle high near contour curve
The low substantially symmetric distribution in two ends, and reach in center section the peak value of accumulation, this distributed effect and the normal state in probability theory
Distribution curve is similar, so calculating the increased height of the grains of sand accumulated at section and being represented using normal distribution;
4.3) piling height of the grains of sand correspondence position grains of sand is determined from numerical value normal distyribution function.
5. as claimed in claim 1 build the husky method for drawing simulation system, it is characterised in that:
The step 5) in comprising the following steps that of collapsing of the calculating grains of sand:
Adjacent height difference is reduced using the method for smoothing processing and simulates the collapse phenomenon of the grains of sand, i.e., after accumulation pair and around sand
The grains of sand post that grain pillar height degree differs greatly carries out the smoothing techniques on height, i.e., reduce adjacent height using the method for smoothing processing
The poor collapse phenomenon to simulate the grains of sand of degree.
6. the husky method for drawing simulation system of structure as described in one of claim 1 to 5, it is characterised in that:
Colored sand is simulated using RGBA models, its step is as follows:
Statistical operation is carried out to the brightness value of each pixel in image;
The pixel in image is ranked up according to measurement brightness size, the pixel for having similar brightness value is classified and counted
Number, by brightness value it is close be considered as same class color, and it is shared in total pixel in the picture to count the pixel of similar color
Ratio;
The RGBA values that the color value at certain grains of sand pixel (i, j) place is set by control panel are changed, wherein, R represents color
Red component, G represents the green component of color, and B represents the blue component of color, and A represents the α components of opacity;
The grains of sand highly use hijRepresent, work as hijWhen=0, no grains of sand are indicated, color is set to the daylighting platform color of itself;Work as hijGradually
During increase, the lightness reduction of color so that color changes, so as to embody the accumulation effect of the grains of sand.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710536378.7A CN107291360A (en) | 2017-07-03 | 2017-07-03 | Build the husky method for drawing simulation system |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710536378.7A CN107291360A (en) | 2017-07-03 | 2017-07-03 | Build the husky method for drawing simulation system |
Publications (1)
Publication Number | Publication Date |
---|---|
CN107291360A true CN107291360A (en) | 2017-10-24 |
Family
ID=60098705
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201710536378.7A Pending CN107291360A (en) | 2017-07-03 | 2017-07-03 | Build the husky method for drawing simulation system |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN107291360A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108628455A (en) * | 2018-05-14 | 2018-10-09 | 中北大学 | A kind of virtual husky picture method for drafting based on touch-screen gesture identification |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US8896579B2 (en) * | 2012-03-02 | 2014-11-25 | Adobe Systems Incorporated | Methods and apparatus for deformation of virtual brush marks via texture projection |
CN104679411A (en) * | 2015-01-21 | 2015-06-03 | 河北工程大学 | Sand painting system based on gesture interaction |
CN104732570A (en) * | 2015-02-04 | 2015-06-24 | 腾讯科技(深圳)有限公司 | Image generation method and device |
-
2017
- 2017-07-03 CN CN201710536378.7A patent/CN107291360A/en active Pending
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US8896579B2 (en) * | 2012-03-02 | 2014-11-25 | Adobe Systems Incorporated | Methods and apparatus for deformation of virtual brush marks via texture projection |
CN104679411A (en) * | 2015-01-21 | 2015-06-03 | 河北工程大学 | Sand painting system based on gesture interaction |
CN104732570A (en) * | 2015-02-04 | 2015-06-24 | 腾讯科技(深圳)有限公司 | Image generation method and device |
Non-Patent Citations (2)
Title |
---|
宁亚楠等: ""基于Leap Motion和Unity3D的虚拟沙画手势识别及交互"", 《计算机工程与应用》 * |
杨猛等: ""交互式沙画模拟算法"", 《计算机辅助设计与图形学学报》 * |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108628455A (en) * | 2018-05-14 | 2018-10-09 | 中北大学 | A kind of virtual husky picture method for drafting based on touch-screen gesture identification |
CN108628455B (en) * | 2018-05-14 | 2021-10-15 | 中北大学 | Virtual sand painting drawing method based on touch screen gesture recognition |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
Chen et al. | Wetbrush: GPU-based 3D painting simulation at the bristle level | |
US7586489B2 (en) | Method of generating surface defined by boundary of three-dimensional point cloud | |
US8854342B2 (en) | Systems and methods for particle-based digital airbrushing | |
CN110163827A (en) | Training method, image de-noising method, device and the medium of image denoising model | |
CN103218846B (en) | The ink and wash analogy method of Three-dimension Tree model | |
CN106056660A (en) | Mobile terminal simulation particle system method | |
CN102147928A (en) | Improved flame-simulation acceleration algorithm based on particle system | |
CN111127596B (en) | Incremental Voronoi sequence-based layered oil painting brush drawing method | |
CN107291360A (en) | Build the husky method for drawing simulation system | |
CN102572305A (en) | Method and system for processing video image | |
CN106683160A (en) | Transfer function design method based on two-dimensional histogram and transfer function design device thereof | |
Yang et al. | Self‐adaptive Algorithm for Simulating Sand Painting in Real‐Time | |
CN106157313A (en) | A kind of lines drawing with coloured chalk artistic style analogy method | |
CN103679794B (en) | The method for drafting of the three-dimensional sketch pencil drawing of simulation | |
CN110136238A (en) | A kind of AR drawing method of combination physical light according to model | |
WO2021218448A1 (en) | Handwriting forming method and apparatus, and electronic device | |
CN102243767B (en) | Creation method of mobile phone cartoon figure based on local image distortion | |
CN108171766A (en) | A kind of image generating method that there are outline strokes and correct | |
CN114912303A (en) | Three-dimensional fluid display method and device, electronic equipment and storage medium | |
Yin et al. | HUA: an interactive calligraphy and ink-wash painting system | |
Barile et al. | Animated drawings rendered by genetic programming | |
CN103460252B (en) | A method for reconstructing a 3d surface from a 2d sketch | |
Liu et al. | A computational approach to digital hand-painted printing patterns on cloth | |
Shin et al. | Simulating oriental brush character considered with aerial action of pen tablet | |
Yang et al. | Colored sand painting simulation based on detail preservation |
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 | ||
WD01 | Invention patent application deemed withdrawn after publication | ||
WD01 | Invention patent application deemed withdrawn after publication |
Application publication date: 20171024 |