CN106582021B - A kind of method and system of the drawing lawn in map - Google Patents
A kind of method and system of the drawing lawn in map Download PDFInfo
- Publication number
- CN106582021B CN106582021B CN201611162268.0A CN201611162268A CN106582021B CN 106582021 B CN106582021 B CN 106582021B CN 201611162268 A CN201611162268 A CN 201611162268A CN 106582021 B CN106582021 B CN 106582021B
- Authority
- CN
- China
- Prior art keywords
- grass
- particle
- preset
- meadow
- fritter
- 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
-
- A—HUMAN NECESSITIES
- A63—SPORTS; GAMES; AMUSEMENTS
- A63F—CARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
- A63F13/00—Video games, i.e. games using an electronically generated display having two or more dimensions
- A63F13/55—Controlling game characters or game objects based on the game progress
-
- A—HUMAN NECESSITIES
- A63—SPORTS; GAMES; AMUSEMENTS
- A63F—CARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
- A63F13/00—Video games, i.e. games using an electronically generated display having two or more dimensions
- A63F13/60—Generating or modifying game content before or while executing the game program, e.g. authoring tools specially adapted for game development or game-integrated level editor
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T13/00—Animation
- G06T13/20—3D [Three Dimensional] animation
- G06T13/60—3D [Three Dimensional] animation of natural phenomena, e.g. rain, snow, water or plants
Landscapes
- Engineering & Computer Science (AREA)
- Multimedia (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Human Computer Interaction (AREA)
- Processing Or Creating Images (AREA)
Abstract
The method of the invention discloses a kind of in map drawing lawn, comprising: according to the distribution density for the preset grass of meadow fritter divided in advance, every careless drafting position is chosen from the meadow fritter;According to the surrounding objects of the meadow fritter, out of for the preset each attribute-value ranges of grass, an attribute value is chosen respectively for a grass on the drafting position;According to the drafting position and the attribute value, particle grass is generated in preset particIe system, and calculates the outline data of the particle grass;A grass is drawn in the drafting position according to the outline data of the particle grass.The system of the present invention also provides a kind of in map drawing lawn.
Description
Technical field
The present invention relates to drawing technique field more particularly to a kind of method and system of the drawing lawn in map.
Background technique
In the outdoor scene of 3D (3-D graphic) game, the scene on lawn may require that often to enrich the ring in game
Border increases the visual attraction to user.Currently, thick grass used in 3D game outdoor scene is mostly carried out in a manner of model
It manages and draws, art designing designs every careless model by drawing tools, also, art designing also wants when designing map
Be pre-designed the position etc. that each model grass is placed on map, when needing to draw a grass, is during game
System is drawn for each vertex data for obtaining model grass by the good model grass of Art design in advance according to the data one by one
System.
In the above method, since system is when drawing grass, be only capable of according to the pre-designed model grass of art designing with
And preassign every careless position specifically placed and draw each grass, when to draw large stretch of lawn, it is necessary to one by one
Every careless model is drawn, this needs to spend the pre-rendered model of a large amount of manpower and material resources, can not only draw because manpower intervention reduces
The efficiency on lawn processed, the vast resources that can also occupy system carry out model storage.
Summary of the invention
In view of this, the main purpose of the embodiment of the present invention is to provide a kind of method of drawing lawn in map
And system, it can be while improving the drafting efficiency on lawn, moreover it is possible to reduce the resource occupation of system.
To achieve the above object, the method for the embodiment of the invention provides a kind of in map drawing lawn, comprising:
According to the distribution density for the preset grass of meadow fritter divided in advance, every grass is chosen from the meadow fritter
Drafting position;It is the drafting out of for the preset each attribute-value ranges of grass according to the surrounding objects of the meadow fritter
A grass on position chooses an attribute value respectively;
According to the drafting position and the attribute value, particle grass is generated in preset particIe system, and calculates institute
State the outline data of particle grass;
A grass is drawn in the drafting position according to the outline data of the particle grass.
Optionally, the attribute value includes height value and fat or thin value, the surrounding objects according to the meadow fritter, from
To choose an attribute value respectively for the grass on the drafting position in the preset each attribute-value ranges of grass, comprising:
If being had any different in the surrounding objects of the meadow fritter in the plant of careless class, out of for the preset altitude range of grass
The height value for being less than the plant height is chosen, if being not different in the surrounding objects of the meadow fritter in the plant of careless class
Object then randomly selects a height value out of for the preset altitude range of grass;
The fat or thin value for adapting to the height value is chosen out of for the preset fat or thin range of grass.
Optionally, the particle grass is corresponding with a unique identification, has between the meadow fritter and particle grass pair
It should be related to;The method also includes:
Judge whether the meadow fritter needs to be shown in again in the visible area of map;
If so, according to the mark of the particle grass with the meadow fritter with corresponding relationship, from the particle systems
The particle grass is extracted in system, and calculates the outline data of the particle grass;
A grass is drawn in the drafting position according to the outline data of the particle grass.
Optionally, it is described generated in preset particIe system a particle grass after, further includes:
Whether judgement will currently draw the grass under swing state;
If so, a parameter value is chosen out of each disturbance parameter corresponding preset parameter range at random, it is described
Each disturbance parameter includes disturbance radius, disturbance initial angle and disturbance increment, according to particle described in selected parameter value calculation
The outline data of grass, and a grass under swing state is drawn in the drafting position according to the outline data.
Optionally, it is described in preset particIe system generate particle grass after, further includes:
Whether judgement will currently draw by the grass under external force;
If so, determine the first total displacement that the stress point of the particle grass moves under the external force, described the
One total displacement is corresponding with one for completing the first default total step number of first total displacement, the first default total step number packet
At least one movement substep is included, determines stress point first distance mobile to Impact direction in current mobile substep, meter
Outline data of the particle grass after the movement first distance is calculated, and is drawn according to the outline data in the drafting position
One grass;
If it is not, then whether judgement will currently draw the grass after stress is restored;If so, according to preset second total displacement with
And the second default total step number for completing second total displacement, the second default total step number include at least one movement point
Step determines that the stress point, to the second distance mobile by force opposite direction, calculates the particle grass in current mobile substep
Outline data after the movement second distance, and a grass is drawn in the drafting position according to the outline data.
The first total displacement that the stress point of the optional determination particle grass moves under the external force, packet
It includes:
Determine resultant force of the stress point of the particle grass under default stress size;
First total displacement of the stress point under the force action is calculated using elastic force formula;
Correspondingly, the first distance that the determination stress point is mobile to Impact direction in current mobile substep, packet
It includes:
Stress point first distance mobile to Impact direction in current mobile substep is calculated using linear interpolation method.
The system of the embodiment of the invention also provides a kind of in map drawing lawn, comprising:
Position selection unit, the distribution density of the preset grass of meadow fritter divided in advance for basis, from the grass
Every careless drafting position is chosen in ground fritter;
Attribute selection unit, for the surrounding objects according to the meadow fritter, from for the preset each attribute value model of grass
In enclosing, the grass on drafting position chosen for the position selection unit chooses an attribute value respectively;
Particle grass generation unit, drafting position and the attribute for being chosen according to the position selection unit are chosen single
The attribute value that member is chosen generates particle grass in preset particIe system, and calculates the outline data of the particle grass;
Static grass drawing unit, the outline data for being calculated according to the particle grass generation unit is in the drafting
Draw a grass in position.
Optionally, the attribute value includes height value and fat or thin value, the attribute selection unit, comprising:
Height value chooses module, if having any different in surrounding objects for the meadow fritter in the plant of careless class, from
To choose the height value for being less than the plant height in the preset altitude range of grass, if in the surrounding objects of the meadow fritter
It is not different in the plant of careless class, then randomly selects a height value out of for the preset altitude range of grass;
Fat or thin value chooses module, chooses mould for choosing the adaptation height value out of for the preset fat or thin range of grass
The fat or thin value for the height value that block is chosen.
Optionally, the system also includes:
Judging unit is swung, for generating a particle grass in preset particIe system in the particle grass generation unit
Afterwards, whether judgement will currently draw the grass under swing state;
Swing careless drawing unit, if for the judging result for swinging judging unit be it is yes, at random from each disturbance
A parameter value is chosen in the corresponding preset parameter range of parameter, each disturbance parameter includes disturbance radius, disturbance
Initial angle and disturbance increment, according to the outline data of the grass of particle described in selected parameter value calculation, and according to the outline data
A grass under swing state is drawn in the drafting position.
Optionally, the system also includes:
External force judging unit, for generating particle grass in preset particIe system in the particle grass generation unit
Afterwards, whether judgement will currently draw by the grass under external force;
Stress grass drawing unit, if the judging result for the external force judging unit is yes, it is determined that the particle grass
The first total displacement for being moved under the external force of stress point, first total displacement be corresponding with one it is described for completing
The default total step number of the first of first total displacement, the first default total step number include at least one movement substep, determine it is described by
Force first distance mobile to Impact direction in current mobile substep, calculates the particle grass in the movement first distance
Outline data afterwards, and a grass is drawn in the drafting position according to the outline data;
Restore careless drawing unit, if the judging result for the external force judging unit be it is no, judge currently whether want
Draw the grass after stress is restored;If so, according to preset second total displacement and for completing second total displacement
Two default total step numbers, the second default total step number include at least one movement substep, determine that the stress point is moved currently
To the second distance mobile by force opposite direction in substep, number of contours of the particle grass after the movement second distance is calculated
According to, and a grass is drawn in the drafting position according to the outline data.
The method and system of the drawing lawn provided in an embodiment of the present invention in map, by generating particle grass, root
A grass is drawn out according to the profile information of particle grass, particle grass can be drawn automatically, is set in advance with art designing is passed through in the prior art
The model grass of meter is compared to draw a grass, reduces artificial intervention, not only increases the efficiency of drawing lawn, while also subtracting
The resource occupation of system is lacked.
Detailed description of the invention
In order to more clearly explain the embodiment of the invention or the technical proposal in the existing technology, to embodiment or will show below
There is attached drawing needed in technical description to be briefly described, it should be apparent that, the accompanying drawings in the following description is the present invention
Some embodiments for those of ordinary skill in the art without creative efforts, can also basis
These attached drawings obtain other attached drawings.
Fig. 1 is the flow diagram of the method for drawing lawn in map that the embodiment of the present invention one provides;
Fig. 2 is the flow diagram of the method for the drawing lawn provided by Embodiment 2 of the present invention in map;
Fig. 3 is the flow diagram of the method for drawing lawn in map that the embodiment of the present invention three provides;
Fig. 4 is the flow diagram of the method for drawing lawn in map that the embodiment of the present invention four provides;
Fig. 5 is the composition schematic diagram of the system of the drawing lawn provided in an embodiment of the present invention in map.
Specific embodiment
In order to make the object, technical scheme and advantages of the embodiment of the invention clearer, below in conjunction with the embodiment of the present invention
In attached drawing, technical scheme in the embodiment of the invention is clearly and completely described, it is clear that described embodiment is
A part of the embodiment of the present invention, instead of all the embodiments.Based on the embodiments of the present invention, those of ordinary skill in the art
Every other embodiment obtained without making creative work, shall fall within the protection scope of the present invention.
The method and device of the drawing lawn provided by the invention in map is generated in preset particIe system
When each particle, from the range of representative every preset careless attribute value, as selected respectively in the fat or thin attribute-value ranges of height
An attribute value is taken, and according to the distribution density of preset grass, positional value generation is chosen in the meadow fritter divided in advance
Particle calculates the data information on each vertex of particle grass generated, is drawn out according to the data information as particle grass
One grass.When system initialization, as unit of the type of grass, gathers the grass with same alike result as one, create multiple
The particIe system of different types of grass.
Embodiment one
It is the flow diagram of the method for drawing lawn in map that the embodiment of the present invention one provides referring to Fig. 1,
This method comprises:
Step 101: according to the distribution density for the preset grass of meadow fritter divided in advance, being selected from the meadow fritter
Take every careless drafting position.
In embodiments of the present invention, the distribution density of the grass is pre-set, in design games map, by game
Need to show the region on lawn in map as a distributed areas, each region is divided into multiple grids again, and each grid is made
For a meadow fritter, system is that a distribution density is arranged in such meadow fritter, records the length and width size on the meadow.
Multiple drafting positions are chosen from the fritter of meadow, for drawing a grass in each drafting position, and these are drawn
The density of grass on position is the distribution density of preset grass.
Step 102: according to the surrounding objects of the meadow fritter, out of for the preset each attribute-value ranges of grass, for institute
It states the grass drawn on position and chooses an attribute value respectively.
It in embodiments of the present invention, can be the attribute of grass, as can the attribute value that the height for embodying grass is fat or thin, is respectively set
One range can randomly select an attribute value, from these attribute-value ranges before generating a grass to embody every
Grass is different from the feature of other grass, so as to show lawn true to nature.
In some embodiments, when the attribute value includes height value and fat or thin value, step 102 may include step
A1 and step A2:
Step A1: if having any different in the surrounding objects of the meadow fritter in the plant of careless class, from for the preset height of grass
It spends in range and chooses the height value for being less than the plant height, if being not different in the surrounding objects of the meadow fritter in grass
The plant of class then randomly selects a height value out of for the preset altitude range of grass.
In this embodiment, position of the meadow fritter in map is obtained first, then determines the grass
Which the surrounding objects of ground fritter have.For example, can be chosen centered on the meadow fritter one bigger than the meadow fritter
Regional scope, judge on the position except the meadow fritter in the regional scope, if having any different in grass other plants, than
Such as trees, in this case because the grass on trees periphery be it is shorter and smaller, distinctness can be formed with tall trees wood in this way
Visual difference, achieve the purpose that in map while highlighting trees and lawn, so that the picture sense in map is more
Clearly.Therefore, can be out of, altitude range for grass setting, the grass drawn on position for one chooses a height value, the height
Value is less than the height value of the trees on its periphery, so as to have apparent difference in height between the height of grass and the height of trees.
If being not different in the surrounding objects in the regional scope chosen when the plant of grass, such as the surrounding objects packet
It, in this case, can be from being careless alternatively, do not need then to limit the height of grass when surrounding objects are empty when including road
In the altitude range of setting, a height value is randomly selected for the grass on the drafting position.
Step A2: the fat or thin value for adapting to the height value is chosen out of for the preset fat or thin range of grass.
It then, then out of fat or thin range for grass setting is grass one fat or thin value of selection on above-mentioned drafting position, so that
The fat or thin value will be adapted with the height value chosen in step A1, i.e., so that the height and width of grass meet actual grass as far as possible
Ratio.For example, under normal circumstances, its higher careless volume of growth is also bigger, therefore the height of grass and volume can be at just
The relationship of ratio, that is, careless height value is higher, and corresponding fat or thin value is bigger.
It should be noted that not limiting sequencing between the two about step 101 and step 102.
Step 103: according to the drafting position and the attribute value, particle grass is generated in preset particIe system,
And calculate the outline data of the particle grass.
In the embodiment of the present invention, in design games map, it will need to show the region on lawn as one in map
A distributed areas, and be the particIe system of one type grass of this distributed areas distribution, the particIe system is initial in system
When change, as unit of the type of grass, there are multiple and different types using the grass with same alike result as what a set was created
Grass particIe system, system initialization when, also provide common property parameters for particles all in particIe system.Wherein,
The particle grass is each particle in particIe system.
All particles possess an identical attribute set in one particIe system, but each particle require it is some special
Attribute differentiates it from other particles, therefore, in order to the lawn that display effect is true to nature, in preset particIe system
When generating particle grass, by the common parameters of all particles provided by particIe system, with selected each particle grass
The fat or thin equal characterisitic parameters of height combine, and according to the drafting position of selected grass, calculate the number of contours of a particle grass
It is believed that breath, that is, calculate the data information on an each vertex of particle grass.
Further, system can distribute one piece of memory headroom for being used to store particIe system when creating particIe system,
When creating particle grass, when the memory headroom distributed is not enough to create the particle grass, just according to unused principle at most
Delete not used particle grass at most.
Step 104: a grass is drawn in the drafting position according to the outline data of the particle grass.
The outline data of the particle grass is each vertex data information of particle grass, if what is drawn is three-dimensional grass,
Then the outline data is three-dimensional vertex data information.
In the method for the drawing lawn that the embodiments of the present invention provide, by generating particle grass, according to particle grass
Profile information draws out a grass, can draw particle grass automatically, with the model grass being pre-designed in the prior art by art designing
It is compared to draw a grass, reduces artificial intervention, it is time saving and energy saving, the efficiency of drawing lawn is improved, system is reduced
Resource occupation.
Embodiment two
It in example 2, is each particle grass setting in particIe system after generating particle grass in particIe system
One mark, while the corresponding relationship of each particle grass and meadow fritter is recorded, after user leaves meadow fritter, return again
When returning the meadow fritter, the particle of meadow fritter can be taken out directly from affiliated particIe system according to the mark of particle grass
Grass, without regenerating particle grass.It should be noted that the present embodiment is second is that the implementation provided on the basis of example 1
Example, related place refer to the related introduction of embodiment one.
It referring to fig. 2, is the flow diagram of the method for the drawing lawn provided by Embodiment 2 of the present invention in map,
This method comprises:
Step 201: according to the distribution density for the preset grass of meadow fritter divided in advance, being selected from the meadow fritter
Take every careless drafting position.
Step 202: according to the surrounding objects of the meadow fritter, out of for the preset each attribute-value ranges of grass, for institute
It states the grass drawn on position and chooses an attribute value respectively.
Step 203: according to the drafting position and the attribute value, particle grass is generated in preset particIe system,
And calculate the outline data of the particle grass.
In embodiments of the present invention, it is also unique for particle grass setting after particle grass is generated in current particIe system
Mark, and record the corresponding relationship of the particle grass with the meadow fritter divided in advance, that is, so that the particle grass is corresponding with one only
One mark, so that there is corresponding relationship between the meadow fritter and particle grass.
Step 204: a grass is drawn in the drafting position according to the outline data of the particle grass.
Step 205: judge whether the meadow fritter needs to be shown in again in the visible area of map, if
It is, then according to the mark of the particle grass with the meadow fritter with corresponding relationship, institute to be extracted from the particIe system
Particle grass is stated, and calculates the outline data of the particle grass.
Under normal conditions, game player is in game process, the game picture shown before often returning to, for example,
When entering again after the meadow fritter leaves visible area, system needs to repaint the grass in the meadow fritter,
Due to the particle grass being stored in the meadow fritter in particIe system, grain can be directly extracted from particIe system
Sub- grass, specifically, according to corresponding relationship between the meadow fritter and each particle grass for belonging to the meadow fritter, specifically
The mark of mark and each particle grass to the meadow fritter establishes corresponding relationship, according to the corresponding relationship, can obtain institute
The mark of each particle grass in the fritter of meadow is stated, and then can be known according to particle grass stick and be taken out and the mark pair from particIe system
The particle grass answered.
Step 206: a grass is drawn in the drafting position according to the outline data of the particle grass.
In the present embodiment, since particle grass can be taken out directly from affiliated particIe system, without regenerating
Particle grass, as soon as therefore compared with embodiment, further improve the efficiency of drawing lawn, and reduce the resource of system
It occupies.
Embodiment three
In the third embodiment, in order to keep the display effect of grass more life-like, each grass can be made in unobvious external force
Under the influence of have oneself a swing, therefore, the present embodiment three is also realized on the basis of embodiment one or embodiment two
Every careless natural swing.It should be noted that the present embodiment on the basis of embodiment one or embodiment two third is that provide
Embodiment, related place refers to the related introduction of embodiment one or embodiment two.
It is the flow diagram of the method for drawing lawn in map that the embodiment of the present invention three provides referring to Fig. 3,
This method comprises:
Step 301: according to the distribution density for the preset grass of meadow fritter divided in advance, being selected from the meadow fritter
Take every careless drafting position.
Step 302: according to the surrounding objects of the meadow fritter, out of for the preset each attribute-value ranges of grass, for institute
It states the grass drawn on position and chooses an attribute value respectively.
Step 303: according to the drafting position and the attribute value, particle grass is generated in preset particIe system.
Step 304: whether judgement will currently draw the grass under swing state, if so, 305 are thened follow the steps, if it is not, then holding
Row step 306.
The swing characteristic parameter of a corresponding meadow fritter can be preset, which indicates meadow fritter
On grass whether nature is needed to swing, for example, parameter be 1 expression the meadow fritter in grass need nature to swing, parameter be 0 table
Show that the grass in the meadow fritter does not need nature swing, to need nature to swing which meadow small with this to distinguish which meadow fritter
Block does not need nature swing, further, then is each grass setting swing characteristic parameter, for example, parameter indicates that grass needs for 1
Naturally it swings, parameter is that 0 expression grass does not need nature swing, needs which grass in the meadow fritter that swings to need certainly for distinguishing
So swing which grass does not need nature swing, if swinging characteristic parameter indicates that certain grass in the meadow fritter currently drawn needs
It wants to swing naturally, thens follow the steps 305, if not, thening follow the steps 306.
Step 305: a parameter value is chosen out of each disturbance parameter corresponding preset parameter range at random, it is described
Each disturbance parameter includes disturbance radius, disturbance initial angle and disturbance increment, according to particle described in selected parameter value calculation
The outline data of grass, and a grass under swing state is drawn in the drafting position according to the outline data.
In the present embodiment, radius, disturbance initial angle and disturbance increment are disturbed and respectively corresponds a preset parameter model
It encloses, a parameter can be randomly selected respectively out of these three parameter areas, the wheel of particle grass is calculated using selected parameter
Wide data information, it is specific to calculate each vertex data information (x, y) of particle grass;
Specifically, the vertex data information of particle grass is calculated by the following formula acquisition:
X=x1+R × sin (P+A), y=y1+R × cos (P+A);
Wherein, x1, y1 are location information of the vertex of particle grass in the case where no swing naturally, and R is disturbance
Radius, P are disturbance initial angle, and A is disturbance increment.
Step 306: the outline data of the particle grass is calculated, according to the outline data of the particle grass in the drafting position
It sets and draws a grass.
Example IV
The present embodiment fourth is that on the basis of any embodiment provided by embodiment one to embodiment three, drawn by realization
Swing of the grass of system under the influence of by external force, so that the display effect of grass under external force is more life-like.It should be noted that
The present embodiment is fourth is that the embodiment provided on the basis of embodiment one or embodiment two or embodiment three, related place refer to
The related introduction of embodiment one or embodiment two or embodiment three.
Referring to fig. 4, the flow diagram of the method for drawing lawn in map provided for the embodiment of the present invention four,
This method comprises:
Step 401: according to the distribution density for the preset grass of meadow fritter divided in advance, being selected from the meadow fritter
Take every careless drafting position.
Step 402: according to the surrounding objects of the meadow fritter, out of for the preset each attribute-value ranges of grass, for institute
It states the grass drawn on position and chooses an attribute value respectively.
Step 403: according to the drafting position and the attribute value, particle grass is generated in preset particIe system.
Step 404: whether judgement will currently draw by the grass under external force, if so, 405 are thened follow the steps, if it is not,
Then follow the steps 406.
The external force characteristic parameter of a corresponding meadow fritter can be preset, which indicates meadow fritter
On grass whether is swung under by external force, for example, parameter be 1 expression the meadow fritter in grass need under by external force and
It swings, parameter indicates that the grass in the meadow fritter does not need to swing under by external force for 0, small to distinguish which meadow with this
Block needs to be swung by external force, which meadow fritter does not need to be swung by external force, further, then is each
Grass setting external force characteristic parameter, for example, parameter is that 1 expression grass needs to swing under by external force, parameter is that 0 expression grass is not required to
To be swung under by external force, for distinguish need in the meadow fritter swung by external force which grass need by external force and
Swing, which grass do not need to be swung by external force, if external force characteristic parameter indicates the meadow fritter for currently needing to draw
In certain grass need to swing under by external force, 405 are thened follow the steps, if not, thening follow the steps 406.
Step 405: determine the first total displacement that the stress point of the particle grass moves under the external force, described
One total displacement is corresponding with one for completing the first default total step number of first total displacement, the first default total step number packet
At least one movement substep is included, determines stress point first distance mobile to Impact direction in current mobile substep, meter
Outline data of the particle grass after the movement first distance is calculated, and is drawn according to the outline data in the drafting position
One grass.
In embodiments of the present invention, the described first default total step number refers to that the how many steps of preset particle grass stress point point are completed
First total displacement, the first default total step number may include one or more mobile substeps, the particle grass stress point
The first total displacement under external force is divided into this multiple substep and completes movement, when the state of particle grass, which is, to be influenced by external force,
According to the first total displacement and the preset first default total step number, the corresponding displacement in each substep of particle grass stress point is determined,
And the outline data i.e. new data information in each vertex of particle grass after the mobile each substep displacement of particle grass stress point is calculated,
It is spaced according to preset display, the grass after each substep movement is successively drawn in map.
In some embodiments, determine that the stress point of the particle grass moves under the external force in step 405
The first total displacement, may include: resultant force of the stress point of the determining particle grass under default stress size, utilize elastic force public
Formula calculates first total displacement of the stress point under the force action.In this embodiment, pass through preset power
Size obtains the resultant force of particle grass stress point, and the first total displacement that the stress point need to move is calculated, wherein described first
Total displacement is calculated according to elastic force formula.
In some embodiments, determine that the stress point moves in current mobile substep to Impact direction in step 405
Dynamic first distance may include: to calculate the stress point in current mobile substep to Impact direction using linear interpolation method
Mobile first distance.It in this embodiment, is that the displacement of every step is provided according to linear interpolation according to preset substep number.
Step 406: whether judgement will currently draw the grass after stress is restored, if so, 407 are thened follow the steps, if not,
Then follow the steps 408.
In the grass under drawing not by external force, by the grass of external force, there are two types of states, and one is carry out after by external force
Grass in state recovery process, one is the grass under not remained static by external force, if the grass currently drawn is previous
State thens follow the steps 407, if the grass currently drawn is latter state, thens follow the steps 408.
Step 407: according to the default total step of preset second total displacement and second for completing second total displacement
Number, the second default total step number include at least one movement substep, determine the stress point it is current move substep in by
The mobile second distance of force opposite direction, calculates outline data of the particle grass after the movement second distance, and according to
The outline data draws a grass in the drafting position.
In embodiments of the present invention, the described second default total step number can be identical as the described first default total step number, described
Second default total step number packet one or more movement substep, can be taking human as the displacement ratio for providing each mobile substep movement.
The calculating particle grass in 405 is being executed the step after the outline data after the movement first distance, is being
State after the current stress point stress of particle grass after moving displacement configures the mobile substep of a stress and indicates.When the state of particle grass is
When not influenced by external force, obtain whether each substep state is stress recovery point according to the mobile substep mark judgement of each stress
Step, if it is, determining what particle grass stress point restored in each substep according to the second total displacement and the second default total step number
Displacement, and calculate particle grass stress point and restore the outline data after each substep displacement i.e. new data in each vertex of particle grass
Information is spaced according to preset display, the grass after each substep movement is successively drawn in map.
Step 408: the outline data of the particle grass is calculated, according to the outline data of the particle grass in the drafting position
It sets and draws a grass.
It is the composition schematic diagram of the system of the drawing lawn provided in an embodiment of the present invention in map referring to Fig. 5, it should
System includes:
Position selection unit 501, for according to the distribution density of the preset grass of meadow fritter to divide in advance, from described
Every careless drafting position is chosen in the fritter of meadow;
Attribute selection unit 502, for the surrounding objects according to the meadow fritter, from for the preset each attribute value of grass
In range, an attribute value is chosen respectively for the grass drawn on position that the position selection unit 501 is chosen;
Particle grass generation unit 503, drafting position and the attribute for being chosen according to the position selection unit 501
The attribute value that selection unit 502 is chosen generates particle grass in preset particIe system, and calculates the profile of the particle grass
Data;
Static grass drawing unit 504, the outline data for being calculated according to the particle grass generation unit 503 is in institute
It states and draws one grass of position drafting.
In some embodiments, the attribute selection unit 502, comprising:
Height value chooses module, if having any different in surrounding objects for the meadow fritter in the plant of careless class, from
To choose the height value for being less than the plant height in the preset altitude range of grass, if in the surrounding objects of the meadow fritter
It is not different in the plant of careless class, then randomly selects a height value out of for the preset altitude range of grass;
Fat or thin value chooses module, chooses mould for choosing the adaptation height value out of for the preset fat or thin range of grass
The fat or thin value for the height value that block is chosen.
In some embodiments, the particle grass is corresponding with a unique identification, the meadow fritter and particle grass
Between have corresponding relationship;The system also includes:
Judging unit is redrawn, for judging whether the meadow fritter needs to be shown in the visible area of map again
It is interior;
Particle grass extraction unit, for needing to be shown in again in the visible area of map when the meadow fritter
When, according to the mark of the particle grass with the meadow fritter with corresponding relationship, from the particIe system described in extraction
Particle grass, and calculate the outline data of the particle grass;
Static grass redraws unit, and the outline data for being calculated according to the particle grass extraction unit is in the drafting
Draw a grass in position.
In some embodiments, the system also includes:
Judging unit is swung, for generating a particle in preset particIe system in the particle grass generation unit 503
After grass, whether judgement will currently draw the grass under swing state;
Swing careless drawing unit, if for the judging result for swinging judging unit be it is yes, at random from each disturbance
A parameter value is chosen in the corresponding preset parameter range of parameter, each disturbance parameter includes disturbance radius, disturbance
Initial angle and disturbance increment, according to the outline data of the grass of particle described in selected parameter value calculation, and according to the outline data
A grass under swing state is drawn in the drafting position;If it is described swing judging unit judging result be it is no, utilize
The particle grass generation unit 503 realizes the function of the outline data for calculating the particle grass.
In some embodiments, the system also includes:
External force judging unit, for generating particle grass in preset particIe system in the particle grass generation unit 503
Later, whether judgement will currently draw by the grass under external force;
Stress grass drawing unit, if the judging result for the external force judging unit is yes, it is determined that the particle grass
The first total displacement for being moved under the external force of stress point, first total displacement be corresponding with one it is described for completing
The default total step number of the first of first total displacement, the first default total step number include at least one movement substep, determine it is described by
Force first distance mobile to Impact direction in current mobile substep, calculates the particle grass in the movement first distance
Outline data afterwards, and a grass is drawn in the drafting position according to the outline data;
Restore careless drawing unit, if the judging result for the external force judging unit be it is no, judge currently whether want
Draw the grass after stress is restored;If so, according to preset second total displacement and for completing second total displacement
Two default total step numbers, the second default total step number include at least one movement substep, determine that the stress point is moved currently
To the second distance mobile by force opposite direction in substep, number of contours of the particle grass after the movement second distance is calculated
According to, and a grass is drawn in the drafting position according to the outline data;If it is not, then utilizing the particle grass generation unit
503 realize the function of the outline data for calculating the particle grass.
In some embodiments, the stress grass drawing unit includes:
Total displacement computing module is utilized for determining resultant force of the stress point of the particle grass under default stress size
Elastic force formula calculates first total displacement of the stress point under the force action;
Substep displacement computing module, for using linear interpolation method calculate the stress point in current movement substep to by
The mobile first distance in power direction.
As seen through the above description of the embodiments, those skilled in the art can be understood that above-mentioned implementation
All or part of the steps in example method can be realized by means of software and necessary general hardware platform.Based on such
Understand, substantially the part that contributes to existing technology can be in the form of software products in other words for technical solution of the present invention
It embodies, which can store in storage medium, such as ROM/RAM, magnetic disk, CD, including several
Instruction is used so that a computer equipment (can be the network communications such as personal computer, server, or Media Gateway
Equipment, etc.) execute method described in certain parts of each embodiment of the present invention or embodiment.
It should be noted that each embodiment in this specification is described in a progressive manner, each embodiment emphasis is said
Bright is the difference from other embodiments, and the same or similar parts in each embodiment may refer to each other.For reality
For applying system disclosed in example, since it is corresponded to the methods disclosed in the examples, so being described relatively simple, related place
Referring to method part illustration.
It should also be noted that, herein, relational terms such as first and second and the like are used merely to one
Entity or operation are distinguished with another entity or operation, without necessarily requiring or implying between these entities or operation
There are any actual relationship or orders.Moreover, the terms "include", "comprise" or its any other variant are intended to contain
Lid non-exclusive inclusion, so that the process, method, article or equipment including a series of elements is not only wanted including those
Element, but also including other elements that are not explicitly listed, or further include for this process, method, article or equipment
Intrinsic element.In the absence of more restrictions, the element limited by sentence "including a ...", it is not excluded that
There is also other identical elements in process, method, article or equipment including the element.
The foregoing description of the disclosed embodiments enables those skilled in the art to implement or use the present invention.
Various modifications to these embodiments will be readily apparent to those skilled in the art, as defined herein
General Principle can be realized in other embodiments without departing from the spirit or scope of the present invention.Therefore, of the invention
It is not intended to be limited to the embodiments shown herein, and is to fit to and the principles and novel features disclosed herein phase one
The widest scope of cause.
Claims (8)
1. a kind of method of the drawing lawn in map characterized by comprising
According to the distribution density for the preset grass of meadow fritter divided in advance, every is chosen from the meadow fritter and careless is drawn
Position processed;It whether is plant according to the surrounding objects of the meadow fritter, out of for the preset each attribute-value ranges of grass, for institute
It states the grass drawn on position and chooses an attribute value respectively, the attribute value is used to embody one on the drafting position
Grass is different from the feature of other grass;
According to the drafting position and the attribute value, particle grass is generated in preset particIe system, and calculates the grain
The outline data of sub- grass;
A grass is drawn in the drafting position according to the outline data of the particle grass;
Wherein, the attribute value includes height value and fat or thin value, and whether the surrounding objects according to the meadow fritter are plant
Object chooses an attribute value out of for the preset each attribute-value ranges of grass for the grass on the drafting position respectively, comprising:
If being had any different in the surrounding objects of the meadow fritter in the plant of careless class, chosen out of for the preset altitude range of grass
One is less than the height value of the plant height, if being not different in the surrounding objects of the meadow fritter in the plant of careless class,
A height value is randomly selected out of for the preset altitude range of grass;
The fat or thin value for adapting to the height value is chosen out of for the preset fat or thin range of grass.
2. the method according to claim 1, wherein the particle grass is corresponding with a unique identification, the meadow
There is corresponding relationship between fritter and particle grass;The method also includes:
Judge whether the meadow fritter needs to be shown in again in the visible area of map;
If so, according to the mark of the particle grass with the meadow fritter with corresponding relationship, from the particIe system
The particle grass is extracted, and calculates the outline data of the particle grass;
A grass is drawn in the drafting position according to the outline data of the particle grass.
3. according to claim 1 to 2 described in any item methods, which is characterized in that described to be generated in preset particIe system
After one particle grass, further includes:
Whether judgement will currently draw the grass under swing state;
If so, a parameter value is chosen out of each disturbance parameter corresponding preset parameter range at random, it is described each
Disturbance parameter includes disturbance radius, disturbance initial angle and disturbance increment, according to the grass of particle described in selected parameter value calculation
Outline data, and a grass under swing state is drawn in the drafting position according to the outline data.
4. according to claim 1 to 2 described in any item methods, which is characterized in that described to be generated in preset particIe system
After particle grass, further includes:
Whether judgement will currently draw by the grass under external force;
If so, determining the first total displacement that the stress point of the particle grass moves under the external force, described first is total
Displacement is corresponding with one for completing the first default total step number of first total displacement, and the first default total step number includes extremely
A few mobile substep determines stress point first distance mobile to Impact direction in current mobile substep, calculates institute
Outline data of the particle grass after the movement first distance is stated, and draws one in the drafting position according to the outline data
Grass;
If it is not, then whether judgement will currently draw the grass after stress is restored;If so, according to preset second total displacement and use
In the second default total step number for completing second total displacement, the second default total step number includes at least one movement substep,
Determine that the stress point, to the second distance mobile by force opposite direction, calculates the particle grass and moving in current mobile substep
Outline data after moving the second distance, and a grass is drawn in the drafting position according to the outline data.
5. according to the method described in claim 4, it is characterized in that, the stress point of the determination particle grass is in the external force
Lower the first mobile total displacement of effect, comprising:
Determine resultant force of the stress point of the particle grass under default stress size;
First total displacement of the stress point under the force action is calculated using elastic force formula;
Correspondingly, the first distance that the determination stress point is mobile to Impact direction in current mobile substep, comprising:
Stress point first distance mobile to Impact direction in current mobile substep is calculated using linear interpolation method.
6. a kind of system of the drawing lawn in map characterized by comprising
Position selection unit, the distribution density of the preset grass of meadow fritter divided in advance for basis are small from the meadow
Every careless drafting position is chosen in block;
Attribute selection unit, for whether being plant according to the surrounding objects of the meadow fritter, from for the preset each category of grass
Property value within the scope of, for the position selection unit choose drafting position on a grass choose an attribute value respectively, it is described
The grass that attribute value is used to embody on the drafting position is different from the feature of other grass;
Particle grass generation unit, drafting position and the attribute selection unit for being chosen according to the position selection unit are selected
The attribute value taken generates particle grass in preset particIe system, and calculates the outline data of the particle grass;
Static grass drawing unit, the outline data for being calculated according to the particle grass generation unit is in the drafting position
Draw a grass;
Wherein, the attribute value includes height value and fat or thin value, the attribute selection unit, comprising:
Height value chooses module, if having any different in surrounding objects for the meadow fritter in the plant of careless class, from being careless
The height value for being less than the plant height is chosen in preset altitude range, if not having in the surrounding objects of the meadow fritter
It is different from the plant of careless class, then randomly selects a height value out of for the preset altitude range of grass;
Fat or thin value chooses module, chooses module choosing for choosing the adaptation height value out of for the preset fat or thin range of grass
The fat or thin value of the height value taken.
7. system according to claim 6, which is characterized in that the system also includes:
Swing judging unit, for the particle grass generation unit generated in preset particIe system a particle grass after,
Whether judgement will currently draw the grass under swing state;
Swing careless drawing unit, if for the judging result for swinging judging unit be it is yes, at random from each disturbance parameter
A parameter value is chosen in corresponding preset parameter range, each disturbance parameter is initial including disturbance radius, disturbance
Angle and disturbance increment, according to the outline data of the grass of particle described in selected parameter value calculation, and according to the outline data in institute
State the grass drawn under position drafting swing state.
8. system according to claim 6, which is characterized in that the system also includes:
External force judging unit, for sentencing after the particle grass generation unit generates particle grass in preset particIe system
It is disconnected currently whether to draw by the grass under external force;
Stress grass drawing unit, if the judging result for the external force judging unit is yes, it is determined that particle grass by
The first total displacement that force is moved under the external force, first total displacement are corresponding with one for completing described first
The default total step number of the first of total displacement, the first default total step number include at least one movement substep, determine the stress point
The first distance mobile to Impact direction, calculates the particle grass after the movement first distance in current mobile substep
Outline data, and a grass is drawn in the drafting position according to the outline data;
Restore careless drawing unit, if the judging result for the external force judging unit be it is no, judge currently whether to draw
Grass after stress recovery;If so, pre- according to preset second total displacement and second for completing second total displacement
If total step number, the second default total step number includes at least one movement substep, determines the stress point in current mobile substep
It is middle to calculate outline data of the particle grass after the movement second distance to the second distance mobile by force opposite direction,
And a grass is drawn in the drafting position according to the outline data.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201611162268.0A CN106582021B (en) | 2016-12-15 | 2016-12-15 | A kind of method and system of the drawing lawn in map |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201611162268.0A CN106582021B (en) | 2016-12-15 | 2016-12-15 | A kind of method and system of the drawing lawn in map |
Publications (2)
Publication Number | Publication Date |
---|---|
CN106582021A CN106582021A (en) | 2017-04-26 |
CN106582021B true CN106582021B (en) | 2019-02-12 |
Family
ID=58801644
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201611162268.0A Active CN106582021B (en) | 2016-12-15 | 2016-12-15 | A kind of method and system of the drawing lawn in map |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN106582021B (en) |
Families Citing this family (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108543311A (en) * | 2018-04-20 | 2018-09-18 | 苏州蜗牛数字科技股份有限公司 | A method of automatically generating scene vegetation system |
CN111882636A (en) * | 2020-07-24 | 2020-11-03 | 上海米哈游天命科技有限公司 | Picture rendering method, device, equipment and medium |
CN111888763B (en) * | 2020-08-26 | 2024-02-02 | 网易(杭州)网络有限公司 | Method and device for generating obstacle in game scene |
CN112206534A (en) * | 2020-11-04 | 2021-01-12 | 网易(杭州)网络有限公司 | Vegetation object processing method, device, equipment and storage medium |
CN113426106B (en) * | 2021-06-24 | 2024-03-12 | 网易(杭州)网络有限公司 | Display control method and device in game, electronic equipment and storage medium |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1949273A (en) * | 2006-11-27 | 2007-04-18 | 北京金山软件有限公司 | Method and system of drawing lawn in 3D game |
CN102855661A (en) * | 2012-08-22 | 2013-01-02 | 浙江工业大学 | Large-scale forest scene quick generation method based on space similarity |
Family Cites Families (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20090174703A1 (en) * | 2008-01-07 | 2009-07-09 | Disney Enterprises, Inc. | Particle-based method of generating and animating three-dimensional vegetation |
WO2013066339A1 (en) * | 2011-11-04 | 2013-05-10 | Intel Corporation | Plant simulation for graphics engines |
-
2016
- 2016-12-15 CN CN201611162268.0A patent/CN106582021B/en active Active
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1949273A (en) * | 2006-11-27 | 2007-04-18 | 北京金山软件有限公司 | Method and system of drawing lawn in 3D game |
CN102855661A (en) * | 2012-08-22 | 2013-01-02 | 浙江工业大学 | Large-scale forest scene quick generation method based on space similarity |
Also Published As
Publication number | Publication date |
---|---|
CN106582021A (en) | 2017-04-26 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN106582021B (en) | A kind of method and system of the drawing lawn in map | |
CN101930627B (en) | Three-dimensional dwelling size modeling method based on two-dimensional dwelling size diagram | |
Muhar | Three-dimensional modelling and visualisation of vegetation for landscape simulation | |
CN104778744B (en) | Extensive three-dimensional forest Visual Scene method for building up based on Lidar data | |
CN110019568A (en) | Site selecting method, device, computer equipment and storage medium based on space clustering | |
CN103971416A (en) | Partition of a 3D scene into a plurality of zones processed by a computing resource | |
CN108057245B (en) | Map generation method and device, storage medium and terminal | |
CN114359500B (en) | Three-dimensional modeling and visualization method for landslide hazard range prediction | |
CN102855661A (en) | Large-scale forest scene quick generation method based on space similarity | |
Shaker et al. | Fractals, noise and agents with applications to landscapes | |
US20150051891A1 (en) | Interactive visualization of reservoir simulation data sets | |
CN104616356B (en) | Sub-compartment boundary three-dimensional visual editing method | |
CN100444203C (en) | Method and system of drawing lawn in 3D game | |
CN104299262B (en) | A kind of three-dimensional cloud analogy method based on velocity field streamline | |
CN106488401A (en) | Generate the method and device of seamless adjacent geography fence | |
US7098917B2 (en) | Generating visual art | |
CN108744520A (en) | Determine the method, apparatus and electronic equipment of game model placement position | |
Guérin et al. | Efficient modeling of entangled details for natural scenes | |
CN101937576B (en) | Dynamic texture waterfall modeling method combined with multiple physical attributes | |
Wong et al. | Continuous self‐collision detection for deformable surfaces interacting with solid models | |
CN106293565B (en) | A kind of simulative display method and device based on particle motioning models | |
CN115423917B (en) | Real-time drawing method and system for global three-dimensional wind field | |
CN104036547A (en) | Method and device for three-dimensional brush to generate network module in real time based on Leap Motion control | |
CN106780695A (en) | It is a kind of based on material properties pre-binding automatically generating the system and method for ground reflection effect | |
Stiver et al. | Sketch based volumetric clouds |
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 |