CN108022283A - Rainwater analogy method, device and readable storage medium storing program for executing - Google Patents
Rainwater analogy method, device and readable storage medium storing program for executing Download PDFInfo
- Publication number
- CN108022283A CN108022283A CN201711276389.2A CN201711276389A CN108022283A CN 108022283 A CN108022283 A CN 108022283A CN 201711276389 A CN201711276389 A CN 201711276389A CN 108022283 A CN108022283 A CN 108022283A
- Authority
- CN
- China
- Prior art keywords
- rainwater
- value
- texture coordinate
- rain
- depth
- 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
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T15/00—3D [Three Dimensional] image rendering
- G06T15/005—General purpose rendering architectures
-
- 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/50—Controlling the output signals based on the game progress
- A63F13/52—Controlling the output signals based on the game progress involving aspects of the displayed game scene
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T15/00—3D [Three Dimensional] image rendering
- G06T15/04—Texture mapping
-
- 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
- A63F2300/00—Features of games using an electronically generated display having two or more dimensions, e.g. on a television screen, showing representations related to the game
- A63F2300/60—Methods for processing data by generating or executing the game program
- A63F2300/66—Methods for processing data by generating or executing the game program for rendering three dimensional images
- A63F2300/663—Methods for processing data by generating or executing the game program for rendering three dimensional images for simulating liquid objects, e.g. water, gas, fog, snow, clouds
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2210/00—Indexing scheme for image generation or computer graphics
- G06T2210/62—Semi-transparency
Landscapes
- Engineering & Computer Science (AREA)
- Computer Graphics (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Multimedia (AREA)
- Image Generation (AREA)
- Processing Or Creating Images (AREA)
Abstract
The present invention provides a kind of rainwater analogy method, device and readable storage medium storing program for executing.The described method includes:Rainwater initial depth value corresponding with the texture coordinate and rainwater initial transparent value are obtained from virtual rainwater figure according to the texture coordinate of preset model;The rainwater initial transparent value is handled according to the rainwater initial depth value to obtain the final transparent value of rainwater;The model is rendered according to default rainwater color form and aspect and the rainwater final transparent value, to complete rainwater simulation.Simulated rainwater through the above way, can cause frame rate of game to be affected to avoid due to consuming substantial amounts of cpu performance.
Description
Technical field
The present invention relates to scene of game processing technology field, in particular to a kind of rainwater analogy method, device and can
Read storage medium.
Background technology
With the continuous development of modern times game, all kinds of weather simulation demands of nature are continuously improved in game, such as
The simulation of rain, mist, cigarette and other effects.The rainwater that makes discovery from observation is existing in the form of water droplet when rainy.It is a large amount of when raining
Water droplet earthward fall according to a certain direction from high-altitude under the influence of the factor such as gravity and wind.When rainwater is along certain
Direction is blocked when falling by some tall and big buildings or landform, can form a piece of rainless region domain thereunder.It is all having rendered
Rainwater is rendered after object scene, and the illumination of rainwater performance can copy the illumination methods of normal transparent particle piece to be counted
Calculate.
A large amount of particle simulation rainwater are usually used at present.It is big in virtual camera front construction when needing to rain in scene
The particle of amount.The direction of motion of particle is calculated according to the wind direction of setting and gravity direction, a large amount of particles are continual in virtualphase
Moved in front of machine according to the Particles Moving direction calculated.The drop water drop of simulation one is gone with each particle piece, by substantial amounts of
Water droplet falls to forming rainy effect.
But need substantial amounts of particle to reach desired effect reluctantly to simulate the effect of rain using particle, largely
Particles Moving just needs to consume the movement locus that substantial amounts of cpu performance removes simulation calculating particle, thus causes the load of CPU to be added
Greatly, the frame per second of game is influenced.
The content of the invention
In order to overcome above-mentioned deficiency of the prior art, the technical problems to be solved by the invention are to provide a kind of rainwater mould
Intend method, apparatus and readable storage medium storing program for executing.
The embodiment of the present invention provides a kind of rainwater analogy method, the described method includes:
It is initial that rainwater corresponding with the texture coordinate is obtained from virtual rainwater figure according to the texture coordinate of preset model
Depth value and rainwater initial transparent value;
The rainwater initial transparent value is handled according to the rainwater initial depth value to obtain the final transparent value of rainwater;
The model is rendered according to default rainwater color form and aspect and the rainwater final transparent value, to complete rainwater
Simulation.
The embodiment of the present invention also provides a kind of rainwater simulator, and described device includes:
Acquisition module, obtains and the texture coordinate pair for the texture coordinate according to preset model from virtual rainwater figure
The rainwater initial depth value and rainwater initial transparent value answered;
Processing module, for being handled to obtain rain to the rainwater initial transparent value according to the rainwater initial depth value
The final transparent value of water;
Rendering module, for carrying out wash with watercolours to the model according to default rainwater color form and aspect and the final transparent value of the rainwater
Dye, to complete rainwater simulation.
The embodiment of the present invention also provides a kind of readable storage medium storing program for executing, and the readable storage medium storing program for executing includes computer program, institute
Equipment where controlling the readable storage medium storing program for executing when stating computer program operation performs the rainwater analogy method.
In terms of existing technologies, the invention has the advantages that:
The embodiment of the present invention provides a kind of rainwater analogy method, device and readable storage medium storing program for executing.First according to preset model
Texture coordinate rainwater initial depth value corresponding with the texture coordinate and rainwater initial transparent are obtained from virtual rainwater figure
Value, and then the rainwater initial transparent value is handled according to the rainwater initial depth value, the final transparent value of rainwater is obtained,
It is last that the model is rendered according to default rainwater color form and aspect and the rainwater final transparent value, to complete rainwater mould
Intend.Simulated rainwater through the above way, it is not necessary to consume substantial amounts of cpu performance, can avoid causing after being enlarged due to cpu load
The affected situation of frame rate of game occurs, so as to lift user experience.
To enable the above-mentioned purpose of invention, feature and advantage to become apparent, present pre-ferred embodiments cited below particularly, and
Attached drawing appended by cooperation, is described in detail below.
Brief description of the drawings
In order to illustrate the technical solution of the embodiments of the present invention more clearly, below will be to needed in the embodiment attached
Figure is briefly described, it will be appreciated that the following drawings illustrate only certain embodiments of the present invention, therefore be not construed as pair
The restriction of scope, for those of ordinary skill in the art, without creative efforts, can also be according to this
A little attached drawings obtain other relevant attached drawings.
Fig. 1 is the block diagram of computing device provided in an embodiment of the present invention.
Fig. 2 is one of flow diagram of rainwater analogy method provided in an embodiment of the present invention.
Fig. 3 is the flow diagram of the sub-step that step S300 includes in Fig. 2.
Fig. 4 is the flow diagram of the sub-step that sub-step S330 includes in Fig. 3.
Fig. 5 is the flow diagram of the sub-step that sub-step S331 includes in Fig. 4.
Fig. 6 is the flow diagram of the sub-step that sub-step S332 includes in Fig. 4.
Fig. 7 is the flow diagram of the sub-step that sub-step S340 includes in Fig. 3.
Fig. 8 is the two of the flow diagram of rainwater analogy method provided in an embodiment of the present invention.
Fig. 9 is the schematic diagram of model provided in an embodiment of the present invention.
Figure 10 is the block diagram of rainwater simulator provided in an embodiment of the present invention.
Icon:100- computing devices;110- memories;120- storage controls;130- processors;200- rainwater simulation dress
Put;210- model construction modules;220- acquisition modules;230- processing modules;240- rendering modules.
Embodiment
Below in conjunction with attached drawing in the embodiment of the present invention, the technical solution in the embodiment of the present invention is carried out clear, complete
Ground describes, it is clear that described embodiment is only part of the embodiment of the present invention, instead of all the embodiments.Usually exist
The component of the embodiment of the present invention described and illustrated in attached drawing can be arranged and designed with a variety of configurations herein.Cause
This, the detailed description of the embodiment of the present invention to providing in the accompanying drawings is not intended to limit claimed invention below
Scope, but it is merely representative of the selected embodiment of the present invention.Based on the embodiment of the present invention, those skilled in the art are not doing
Go out all other embodiments obtained on the premise of creative work, belong to the scope of protection of the invention.
It should be noted that:Similar label and letter represents similar terms in following attached drawing, therefore, once a certain Xiang Yi
It is defined, then it further need not be defined and explained in subsequent attached drawing in a attached drawing.Meanwhile the present invention's
In description, term " first ", " second " etc. are only used for distinguishing description, and it is not intended that instruction or hint relative importance.
Study and find through inventor, it is all that nearby rainwater is more intensive that rainwater, which falls, and distant place rainwater is more sparse.It is although logical
Rainwater can be simulated by crossing a large amount of particles, but can increase the load of CPU, influence the frame per second of game;At the same time in this way
The closeness that the rainwater distance come is just as is simulated, is not inconsistent with actual conditions, is not reaching to estimated effect.
To solve the above-mentioned problems, the present invention provides a kind of rainwater analogy method, device and readable storage medium storing program for executing.Lead to below
Following embodiments are crossed rainwater analogy method, device and readable storage medium storing program for executing provided by the invention is specifically described.
Fig. 1 is refer to, Fig. 1 is the block diagram of computing device 100 provided in an embodiment of the present invention.The embodiment of the present invention
Described in computing device 100 may be, but not limited to, smart mobile phone, tablet computer, server etc..The computing device 100 can
With including:Memory 110, storage control 120, processor 130 and rainwater simulator 200.
Directly or indirectly it is electrically connected between 130 each element of the memory 110, storage control 120 and processor,
To realize the transmission of data or interaction.For example, these elements can pass through one or more communication bus or signal wire between each other
Realize and be electrically connected.Rain simulator 200 is stored in memory 110, the rainwater simulator 200 includes at least one
The software function module that can be stored in the form of software or firmware (firmware) in the memory 110.The processor
130 are stored in software program and module in memory 110 by operation, such as the rainwater simulator in the embodiment of the present invention
200, so as to perform various functions application and data processing, that is, realize the rainwater analogy method in the embodiment of the present invention.
Wherein, the memory 110 may be, but not limited to, random access memory (Random Access
Memory, RAM), read-only storage (Read Only Memory, ROM), programmable read only memory (Programmable
Read-Only Memory, PROM), erasable read-only memory (Erasable Programmable Read-Only
Memory, EPROM), electricallyerasable ROM (EEROM) (Electric Erasable Programmable Read-Only
Memory, EEPROM) etc..Wherein, memory 110 is used for storage program, the processor 130 after execute instruction is received,
Perform described program.The processor 130 and other access of possible component to memory 110 can be in the storage controls
Carried out under the control of device 120.
The processor 130 is probably a kind of IC chip, has the disposal ability of signal.Above-mentioned processor
130 can be general processor, including central processing unit (Central Processing Unit, CPU), network processing unit
(Network Processor, NP) etc..It can also be digital signal processor (DSP), application-specific integrated circuit (ASIC), scene
Programmable gate array (FPGA) either other programmable logic device, discrete gate or transistor logic, discrete hardware group
Part.It can realize or perform disclosed each method, step and the logic diagram in the embodiment of the present invention.General processor can be with
It is microprocessor or the processor can also be any conventional processor etc..
It is appreciated that structure shown in Fig. 1 is only to illustrate, computing device 100 may also include it is more more than shown in Fig. 1 or
Less component, or there is the configuration different from shown in Fig. 1.Each component shown in Fig. 1 can use hardware, software or its
Combination is realized.
Fig. 2 is refer to, Fig. 2 is one of flow diagram of rainwater analogy method provided in an embodiment of the present invention.The side
Method is applied to the computing device 100.The idiographic flow of rainwater analogy method is described in detail below.The method can be with
Including step S200, step S300 and step S400.
Step S200, obtains from virtual rainwater figure corresponding with the texture coordinate according to the texture coordinate of preset model
Rainwater initial depth value and rainwater initial transparent value.
In the present embodiment, a virtual camera is provided with game, which roams in scene of game, this is virtual
The picture of cameras capture is the picture for showing screen display.This programme rains without using particle simulation, but think rain when
Full frame is all water droplet, and only the depth of raindrop is different, is uniformly distributed in space.By the way that preset model is arranged on the void
Intend outside camera so that the virtual camera is wrapped in the model.In the embodiment of the present embodiment, with preset model
Geometric center is model origin, and the model is placed on default camera position.Thus, after scene of game has been rendered,
After the pattern die draws up rain, the picture that the virtual camera in the model is caught when roaming in gaming is necessarily what is rained
Picture.Therefore it may only be necessary to the model is rendered to simulate rain, without simulating rain in the scene using substantial amounts of particle, from
And avoid consuming substantial amounts of cpu performance.
In the present embodiment, the virtual rainwater figure can be one virtual but include the picture of true rainwater information.
The piece member tinting stage of rain is drawn, the line for obtaining the model can be sampled by piece member tinter (Pixel Shader, PS)
Coordinate is managed, and rainwater corresponding with the texture coordinate is obtained initially deeply from the virtual rainwater figure according to the texture coordinate
Angle value and rainwater initial transparent value.
Wherein, the level for the rain layer that rainwater initial transparent value, rainwater initial depth value include with the virtual rainwater figure
It is related.For example if the virtual rainwater figure includes two layers of rain layer, it is initially deep that two rainwater can be obtained according to the texture coordinate
Angle value, two rainwater initial transparent values.Wherein, rain layer just refers to one layer of rain.
In the present embodiment, texture coordinate is rolled, so that the position of rainwater changes, so as to simulate rainwater landing
Effect.
Step S300, is handled to obtain rainwater most according to the rainwater initial depth value to the rainwater initial transparent value
Whole transparent value.
Fig. 3 is refer to, Fig. 3 is the flow diagram of the sub-step that step S300 includes in Fig. 2.Step S130 can include
Sub-step S310, sub-step S320, sub-step S330 and sub-step S340.
Sub-step S310, institute is worth to according to the depth value scope of every layer of rain set in advance and the rainwater initial depth
Texture coordinate is stated in every layer of ultimate depth value in the rain.
In the present embodiment, it can be configured, obtained described according to the depth value of every layer of rain of the virtual rainwater figure
The depth value scope of every layer of rain set in advance.Alternatively it is also possible to it is configured by other means.And then according to setting in advance
The depth value scope of every layer of fixed rain and the rainwater initial depth are worth to the texture coordinate in every layer of final depth in the rain
Angle value.For example have two layers of rain before the virtual camera is set, first layer rain is 0.1 apart from maximum with the virtual camera,
Second layer rain is 0.5 apart from maximum with the first layer rain.The rainwater initial depth value obtained according to the texture coordinate
Respectively 0.5,0.7, wherein, 0.5 corresponds to first layer rain, and 0.7 corresponds to second layer rain.By the final of first layer rain is calculated
Depth value is 0.5*0.1=0.05, and the ultimate depth value of second layer rain is 0.1+0.7*0.5=0.45.
Sub-step S320, world space location is converted to by the ultimate depth value.
In the present embodiment, ultimate depth value progress matrixing is obtained into the world space under world coordinate system
Position.
Sub-step S330, judges that pixel corresponding with the texture coordinate is in rain layer according to the world space location
It is no to be blocked, obtain judging result.
In the present embodiment, pixel corresponding with the texture coordinate in rain layer can be judged using depth pinup picture
Whether it is blocked.
Fig. 4 is refer to, Fig. 4 is the flow diagram of the sub-step that sub-step S330 includes in Fig. 3.Sub-step S330 can be with
Including sub-step S331, sub-step S332 and sub-step S333.
S331, obtains the direction of visual lines depth map of game current scene, and according to the world space location and sight side
Judge in rain layer whether pixel corresponding with the texture coordinate is blocked because shelter blocks sight to depth map.
Fig. 5 is refer to, Fig. 5 is the flow diagram of the sub-step that sub-step S331 includes in Fig. 4.Sub-step S331 can be with
Including sub-step S3311, sub-step S3312 and sub-step S3313.
Sub-step S3311, obtains the first depth value of shelter in the direction of visual lines depth map.
Sub-step S3312, carries out matrix conversion by the world space location, obtains one with the direction of visual lines depth map
On the basis of the second depth value.
Sub-step S3313, according to first depth value and the second depth value judge in rain layer with the texture coordinate pair
Whether the pixel answered is blocked because shelter blocks sight.
In the present embodiment, the direction of visual lines depth map of game current scene, institute can be obtained by the virtual camera
The view scope for stating point of view direction depth map is determined by the virtual camera.If wrapped in the direction of visual lines depth map
Shelter is included, then needs to obtain first depth value of the shelter in the direction of visual lines depth map.Will be with the texture coordinate
In the corresponding world space location of every layer of ultimate depth value in the rain by matrix conversion, the world space location is obtained
The second depth value on the basis of the direction of visual lines depth.And then judged according to first depth value and the second depth value every
Whether pixel corresponding with the texture coordinate is blocked because shelter blocks sight in layer rain layer.
Wherein, because shelter blocks sight, to be blocked be to represent to pixel:Sight be blocked thing masking, cause the pixel
Point is blocked.
Such as from point of observation by closely to it is remote have between three layers of rain, 1,2,3,2,3 layers of rain have a wall, then 1,2 layer is in the rain
Pixel corresponding with the texture coordinate thing wall that will not then be blocked blocks, but 3 layers of rain cause 3 after shelter wall
Layer in the rain pixel corresponding with the texture coordinate not in visual line of sight, that is to say, that shelter wall, which has blocked sight, to be made
3 layers in the rain pixel corresponding with the texture coordinate be blocked.
Wherein, the first depth value of shelter wall and point of observation is calculated, and be calculated 1 layer in the rain with the texture
Second depth value of the world space location of the corresponding pixel of coordinate to point of observation.First depth value is more than the second depth value,
The pixel is represented in visual line of sight, is not blocked because shelter wall blocks sight.It is deep that first depth value is less than second
Angle value, represents the pixel not in visual line of sight, is blocked because shelter wall blocks sight.
If the direction of visual lines depth map does not include shelter, can directly judge to sit with the texture in every layer of rain layer
Corresponding pixel is marked not to be blocked because shelter blocks sight.
Sub-step S332, obtains the high-altitude depth map of game current scene, and according to the world space location and high-altitude
Depth map judges whether pixel corresponding with the texture coordinate is blocked by obstructions in rain layer.
Fig. 6 is refer to, Fig. 6 is the flow diagram of the sub-step that sub-step S332 includes in Fig. 4.Sub-step S332 can be with
Including sub-step S3321, sub-step S3322 and sub-step S3323.
Sub-step S3321, obtains the 3rd depth value of shelter in the high-altitude depth map.
Sub-step S3322, carries out matrix conversion by the world space location, obtains one using the high-altitude depth map as base
The 4th accurate depth value;
Sub-step S3323, according to the 3rd depth value and the 4th depth value judge in rain layer with the texture coordinate pair
Whether the pixel answered is blocked by obstructions.
In the present embodiment, the high-altitude depth map of game current scene can be obtained by the virtual camera.It is if described
High-altitude depth map includes shelter, then needs to obtain threeth depth value of the shelter in the high-altitude depth map.Will with institute
Texture coordinate is stated in the corresponding world space location of every layer of ultimate depth value in the rain by matrix conversion, obtains the generation
Fourth depth value of the boundary locus on the basis of the high-altitude depth map.And then according to the 3rd depth value and the 4th depth
Value judges whether pixel corresponding with the texture coordinate is blocked by obstructions in every layer of rain layer.
For example pixel corresponding with the texture coordinate is then if rainy layer is under a shelter eaves, in the rain layer
It is blocked.
If not including shelter in the high-altitude depth map, can directly judge in every layer of rain layer with the texture coordinate
Corresponding pixel is not blocked by obstructions.
On sub-step S332 specifically describe can sub-paragraphs S331 above description
Sub-step S333, in rain layer pixel corresponding with the texture coordinate not because shelter blocks sight and by
When blocking, and not being blocked by obstructions, judge that pixel corresponding with the texture coordinate is not blocked in rain layer.
Sub-step S340, is handled to obtain each rain and be laminated to add according to the judging result to the rainwater initial transparent value
The final transparent value of the rainwater of pixel corresponding with the texture coordinate afterwards.
Fig. 7 is refer to, Fig. 7 is the flow diagram of the sub-step that sub-step S340 includes in Fig. 3.Sub-step S340 can be with
Including sub-step S341, sub-step S342 and sub-step S343.
Sub-step S341, when pixel corresponding with the texture coordinate is blocked in judging rain layer, by the rainwater
Initial transparent value is updated to 0 using the interim transparent value of rainwater as pixel corresponding with the texture coordinate in the rain layer.
Sub-step S342, when pixel corresponding with the texture coordinate is not blocked in judging rain layer, by described in
Rainwater interim transparent value of the rainwater initial transparent value as pixel corresponding with the texture coordinate in the rain layer.
Sub-step S343 is temporarily transparent by the rainwater of pixel corresponding with the texture coordinate in each rain layer
Value is added, and obtains the final transparent value of the rainwater of rain stacking plus rear pixel corresponding with the texture coordinate.
In the present embodiment, the rainwater initial transparent value is handled to obtain the rainwater according to the judging result
Interim transparent value, and then the interim transparent value of the rainwater of pixel corresponding with the texture coordinate in each rain layer is added,
Obtain the final transparent value of rainwater of pixel corresponding with the texture coordinate in the image after the stacking of each rain is added.
In the embodiment of the present embodiment, pixel corresponding with the texture coordinate is blocked in a rain layer, represents
The rainwater of pixel corresponding with the texture coordinate can't see in the rain layer, therefore can be by the rainwater initial transparent value more
It is new for 0 using the interim transparent value of rainwater as pixel corresponding with the texture coordinate in the rain layer.
In the embodiment of the present embodiment, pixel corresponding with the texture coordinate is not blocked in a rain layer,
Then directly using the rainwater initial transparent value as the interim transparent value of the rainwater.
For example two layers of rain is set with, obtained and the texture coordinate pair from the virtual rainwater figure according to texture coordinate
The rainwater initial transparent value answered is respectively:A, B, wherein, A corresponds to first layer rain, and B corresponds to second layer rain.Assuming that first layer is in the rain
Pixel corresponding with the texture coordinate is not blocked, and the interim transparent value of rainwater is still A.The second layer in the rain with
When the corresponding pixel of the texture coordinate is not blocked, the interim transparent value of rainwater is still B, after two layers of rain superposition with
The final transparent value of rainwater of the corresponding pixel of the texture coordinate is A+B.It is corresponding with the texture coordinate in the rain in the second layer
Pixel when being blocked, the interim transparent value of rainwater is 0, pixel corresponding with the texture coordinate after two layers of rain superposition
The final transparent value of rainwater be A+0.
Step S400, renders the model according to default rainwater color form and aspect and the final transparent value of the rainwater,
To complete rainwater simulation.
In the present embodiment, sat according to final transparent be worth to of default rainwater color form and aspect and the rainwater with the texture
The final color of corresponding rainwater is marked, wash with watercolours is carried out to the model according to the final color of the texture coordinate and corresponding rainwater
Dye, so as to complete rainwater simulation.
For example it is worth to and the texture coordinate according to default rainwater color form and aspect R, G, B and the rainwater are finally transparent
The final color of corresponding rainwater.
Fig. 8 is refer to, Fig. 8 is the two of the flow diagram of rainwater analogy method provided in an embodiment of the present invention.In step
Before S200, the method can also include step S100.
Step S100, builds the model and preserves by the way that the bottom surface of two identical circular cones is closed up.
Fig. 9 is refer to, Fig. 9 is the schematic diagram of model provided in an embodiment of the present invention.In the present embodiment, the model is adopted
Close up to obtain by bottom surface with two identical circular cones.The model is bi-conical, and the middle axial plane of the model is diamond shape.By
In the style characteristic of the model, the nearly close far thin effect of rainwater, so as to more tally with the actual situation, carries when can simulate rainy
Rise user experience.
By double cone model, depth pinup picture and texture coordinate rolling simulation rainwater, substantial amounts of CPU will not be not only consumed
Can, while the rainwater simulated has the nearly close far thin effect more to tally with the actual situation, improves user experience.
Figure 10 is refer to, Figure 10 is the block diagram of rainwater simulator 200 provided in an embodiment of the present invention.The rain
Fluid Dynamics device 200 can include acquisition module 220, processing module 230 and rendering module 240.
Acquisition module 220, obtains from virtual rainwater figure for the texture coordinate according to preset model and is sat with the texture
Mark corresponding rainwater initial depth value and rainwater initial transparent value.
In the present embodiment, the acquisition module 220 is used to perform the step S200 in Fig. 2, on the acquisition module
220 specific descriptions are referred to the description of step S200 in Fig. 2.
Processing module 230, for the rainwater initial transparent value handle according to the rainwater initial depth value
To the final transparent value of rainwater.
In the present embodiment, the processing module 230 is used to perform the step S300 in Fig. 2, on the processing module
230 specific descriptions are referred to the description of step S300 in Fig. 2.
Rendering module 240, for according to default rainwater color form and aspect and the final transparent value of the rainwater to the model into
Row renders, to complete rainwater simulation.
In the present embodiment, the rendering module 240 is used to perform the step S400 in Fig. 2, on the rendering module
240 specific descriptions are referred to the description of step S400 in Fig. 2.
Referring once again to Figure 10, the rainwater simulator 200 can also include model construction module 210.Model construction
Module 210, for building the model by the way that the bottom surface of two identical circular cones is closed up and preserving.Wherein, the model
For bi-conical, the middle axial plane of the model is diamond shape.
In the present embodiment, the model construction module 210 is used to perform the step S100 in Fig. 8, on the model
The specific descriptions of structure module 210 are referred to the description of step S100 in Fig. 8.
The embodiment of the present invention also provides a kind of readable storage medium storing program for executing, and the readable storage medium storing program for executing includes computer program.Institute
Equipment where controlling the readable storage medium storing program for executing when stating computer program operation performs the rainwater analogy method.
Through the above description of the embodiments, those skilled in the art can be understood that the present invention can lead to
Hardware realization is crossed, the mode of necessary general hardware platform can also be added by software to realize.Based on such understanding, this hair
Bright technical solution can be embodied in the form of software product, which can be stored in a non-volatile memories
In medium (can be CD-ROM, USB flash disk, mobile hard disk etc.), including some instructions are used so that a computer equipment (can be
Personal computer, server, or network equipment etc.) perform method described in each implement scene of the present invention.
In conclusion the present invention provides a kind of rainwater analogy method, device and readable storage medium storing program for executing.First according to default mould
The texture coordinate of type obtains rainwater initial depth value corresponding with the texture coordinate from virtual rainwater figure and rainwater is initially saturating
Bright value, and then the rainwater initial transparent value is handled according to the rainwater initial depth value, it is finally transparent to obtain rainwater
Value, it is last that the model is rendered according to default rainwater color form and aspect and the rainwater final transparent value, to complete rainwater
Simulation.Simulated rainwater through the above way, it is not necessary to consume substantial amounts of cpu performance, can avoid leading after being enlarged due to cpu load
The affected situation of frame rate of game is caused to occur, so as to lift user experience.Simultaneously as the model is bi-conical, by
This rainwater simulated has nearly close far thin effect.
The foregoing is only a preferred embodiment of the present invention, is not intended to limit the invention, for the skill of this area
For art personnel, the invention may be variously modified and varied.Within the spirit and principles of the invention, that is made any repaiies
Change, equivalent substitution, improvement etc., should all be included in the protection scope of the present invention.
Claims (10)
- A kind of 1. rainwater analogy method, it is characterised in that the described method includes:Rainwater initial depth corresponding with the texture coordinate is obtained from virtual rainwater figure according to the texture coordinate of preset model Value and rainwater initial transparent value;The rainwater initial transparent value is handled according to the rainwater initial depth value to obtain the final transparent value of rainwater;The model is rendered according to default rainwater color form and aspect and the rainwater final transparent value, to complete rainwater mould Intend.
- 2. according to the method described in claim 1, it is characterized in that, it is described according to the rainwater initial depth value to the rainwater Initial transparent value, which is handled to obtain the step of rainwater final transparent value, to be included:The texture coordinate is worth to every according to the depth value scope of every layer of rain set in advance and the rainwater initial depth The ultimate depth value of layer in the rain;The ultimate depth value is converted into world space location;Judge that whether pixel corresponding with the texture coordinate is blocked in rain layer, is sentenced according to the world space location Disconnected result;The rainwater initial transparent value is handled to obtain each rain stacking according to the judging result plus the rear and texture is sat Mark the final transparent value of the rainwater of corresponding pixel.
- 3. according to the method described in claim 2, it is characterized in that, it is described according to the world space location judge in rain layer with The step of whether corresponding pixel of the texture coordinate is blocked includes:The direction of visual lines depth map of game current scene is obtained, and is sentenced according to the world space location and direction of visual lines depth map Whether pixel corresponding with the texture coordinate is blocked because shelter blocks sight in disconnected rain layer;The high-altitude depth map of game current scene is obtained, and is judged according to the world space location and high-altitude depth map in rain layer Whether pixel corresponding with the texture coordinate is blocked by obstructions;Pixel corresponding with the texture coordinate is not blocked because shelter blocks sight in rain layer, and is not hidden When block material blocks, judge that pixel corresponding with the texture coordinate is not blocked in rain layer.
- It is 4. according to the method described in claim 3, it is characterized in that, described deep according to the world space location and direction of visual lines Degree figure judge in rain layer pixel corresponding with the texture coordinate whether because shelter blocks sight be blocked the step of wrap Include:Obtain the first depth value of shelter in the direction of visual lines depth map;The world space location is subjected to matrix conversion, obtains second depth on the basis of the direction of visual lines depth map Value;According to first depth value and the second depth value judge in rain layer pixel corresponding with the texture coordinate whether because Shelter blocks sight and is blocked.
- It is 5. according to the method described in claim 3, it is characterized in that, described according to the world space location and high-altitude depth map Judge that the step of whether pixel corresponding with the texture coordinate is blocked by obstructions in rain layer includes:Obtain the 3rd depth value of shelter in the high-altitude depth map;The world space location is subjected to matrix conversion, obtains the 4th depth value on the basis of the high-altitude depth map;According to the 3rd depth value and the 4th depth value judge in rain layer pixel corresponding with the texture coordinate whether by Shelter blocks.
- It is 6. according to the method described in claim 2, it is characterized in that, described initially saturating to the rainwater according to the judging result Bright value is handled to obtain the final transparent value of the rainwater of each rain stacking plus rear pixel corresponding with the texture coordinate Step includes:When pixel corresponding with the texture coordinate is blocked in judging rain layer, the rainwater initial transparent value is updated to 0 using the interim transparent value of rainwater as pixel corresponding with the texture coordinate in the rain layer;When pixel corresponding with the texture coordinate is not blocked in judging rain layer, the rainwater initial transparent value is made For the interim transparent value of rainwater of pixel corresponding with the texture coordinate in the rain layer;The interim transparent value of the rainwater of pixel corresponding with the texture coordinate in each rain layer is added, obtains rain layer The final transparent value of the rainwater of pixel corresponding with the texture coordinate after superposition.
- 7. according to the method described in claim 1, it is characterized in that, the method further includes:Build the model by the way that the bottom surface of two identical circular cones is closed up and preserve, wherein, the model is double cone Shape, the middle axial plane of the model is diamond shape.
- 8. a kind of rainwater simulator, it is characterised in that described device includes:Acquisition module, obtains from virtual rainwater figure corresponding with the texture coordinate for the texture coordinate according to preset model Rainwater initial depth value and rainwater initial transparent value;Processing module, for being handled to obtain rainwater most to the rainwater initial transparent value according to the rainwater initial depth value Whole transparent value;Rendering module, for being rendered according to default rainwater color form and aspect and the final transparent value of the rainwater to the model, To complete rainwater simulation.
- 9. device according to claim 8, it is characterised in that described device further includes:Model construction module, for building the model by the way that the bottom surface of two identical circular cones is closed up and preserving, wherein, The model is bi-conical, and the middle axial plane of the model is diamond shape.
- 10. a kind of readable storage medium storing program for executing, the readable storage medium storing program for executing includes computer program, it is characterised in thatEquipment perform claim where controlling the readable storage medium storing program for executing during computer program operation requires any one in 1-7 The rainwater analogy method.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201711276389.2A CN108022283A (en) | 2017-12-06 | 2017-12-06 | Rainwater analogy method, device and readable storage medium storing program for executing |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201711276389.2A CN108022283A (en) | 2017-12-06 | 2017-12-06 | Rainwater analogy method, device and readable storage medium storing program for executing |
Publications (1)
Publication Number | Publication Date |
---|---|
CN108022283A true CN108022283A (en) | 2018-05-11 |
Family
ID=62078698
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201711276389.2A Pending CN108022283A (en) | 2017-12-06 | 2017-12-06 | Rainwater analogy method, device and readable storage medium storing program for executing |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN108022283A (en) |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110689606A (en) * | 2019-08-26 | 2020-01-14 | 福建数博讯信息科技有限公司 | Method and terminal for calculating raindrop falling position in virtual scene |
CN111050081A (en) * | 2019-12-27 | 2020-04-21 | 维沃移动通信有限公司 | Shooting method and electronic equipment |
CN111667393A (en) * | 2019-08-26 | 2020-09-15 | 福建数博讯信息科技有限公司 | Method and terminal for simulating raining in virtual scene |
CN113413602A (en) * | 2021-07-20 | 2021-09-21 | 网易(杭州)网络有限公司 | Method and device for processing underwater indoor environment in game |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20050256721A1 (en) * | 2001-12-13 | 2005-11-17 | Microsoft Corporation | Interactive water effects using texture coordinate shifting |
CN102831631A (en) * | 2012-08-23 | 2012-12-19 | 上海创图网络科技发展有限公司 | Rendering method and rendering device for large-scale three-dimensional animations |
CN103473802A (en) * | 2013-08-30 | 2013-12-25 | 福建天晴数码有限公司 | Global weather simulation method based on particle system |
CN106846474A (en) * | 2016-12-29 | 2017-06-13 | 中国科学院电子学研究所苏州研究院 | WebGIS spatio temporal process simulation methods based on temporal aspect and particIe system |
CN106952328A (en) * | 2016-12-28 | 2017-07-14 | 北京大学 | The method for drafting and system of a kind of Large-scale Macro virtual scene |
CN107349603A (en) * | 2017-06-27 | 2017-11-17 | 苏州蜗牛数字科技股份有限公司 | A kind of method that Changes in weather is simulated in VR scenes |
-
2017
- 2017-12-06 CN CN201711276389.2A patent/CN108022283A/en active Pending
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20050256721A1 (en) * | 2001-12-13 | 2005-11-17 | Microsoft Corporation | Interactive water effects using texture coordinate shifting |
CN102831631A (en) * | 2012-08-23 | 2012-12-19 | 上海创图网络科技发展有限公司 | Rendering method and rendering device for large-scale three-dimensional animations |
CN103473802A (en) * | 2013-08-30 | 2013-12-25 | 福建天晴数码有限公司 | Global weather simulation method based on particle system |
CN106952328A (en) * | 2016-12-28 | 2017-07-14 | 北京大学 | The method for drafting and system of a kind of Large-scale Macro virtual scene |
CN106846474A (en) * | 2016-12-29 | 2017-06-13 | 中国科学院电子学研究所苏州研究院 | WebGIS spatio temporal process simulation methods based on temporal aspect and particIe system |
CN107349603A (en) * | 2017-06-27 | 2017-11-17 | 苏州蜗牛数字科技股份有限公司 | A kind of method that Changes in weather is simulated in VR scenes |
Non-Patent Citations (3)
Title |
---|
周大伟: "实时雪场景模拟技术的研究与实现", 《中国优秀硕士学位论文全文数据库 信息科技辑》 * |
易成 等: "基于纹理滚动技术的多通道雨雪实时模拟", 《计算机工程与应用》 * |
陈俊: "车辆驾驶模拟器视景仿真技术研究", 《中国优秀硕士学位论文全文数据库 信息科技辑》 * |
Cited By (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110689606A (en) * | 2019-08-26 | 2020-01-14 | 福建数博讯信息科技有限公司 | Method and terminal for calculating raindrop falling position in virtual scene |
CN111667393A (en) * | 2019-08-26 | 2020-09-15 | 福建数博讯信息科技有限公司 | Method and terminal for simulating raining in virtual scene |
CN111667393B (en) * | 2019-08-26 | 2023-07-07 | 福建数博讯信息科技有限公司 | Method and terminal for simulating raining in virtual scene |
CN111050081A (en) * | 2019-12-27 | 2020-04-21 | 维沃移动通信有限公司 | Shooting method and electronic equipment |
CN111050081B (en) * | 2019-12-27 | 2021-06-11 | 维沃移动通信有限公司 | Shooting method and electronic equipment |
CN113413602A (en) * | 2021-07-20 | 2021-09-21 | 网易(杭州)网络有限公司 | Method and device for processing underwater indoor environment in game |
CN113413602B (en) * | 2021-07-20 | 2024-05-10 | 网易(杭州)网络有限公司 | Processing method and device for underwater indoor environment in game |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN108022283A (en) | Rainwater analogy method, device and readable storage medium storing program for executing | |
CN109241465B (en) | Interface display method, device, terminal and storage medium | |
CN106296779A (en) | A kind of threedimensional model rendering indication method and system | |
CN106548516B (en) | Three-dimensional roaming method and device | |
CN109377546A (en) | Virtual reality model rendering method and device | |
JP2021523445A (en) | Image display method and its device, storage medium, electronic device, and computer program | |
CN108499103A (en) | The display methods and device of situation elements | |
CN106504311A (en) | A kind of rendering intent of dynamic fluid effect and device | |
CN112169324A (en) | Rendering method, device and equipment of game scene | |
KR101591427B1 (en) | Method for Adaptive LOD Rendering in 3-D Terrain Visualization System | |
CN111899323B (en) | Three-dimensional earth drawing method and device | |
CN113230651B (en) | Game scene display method and device, electronic equipment and storage medium | |
CN108830923A (en) | Image rendering method, device and storage medium | |
US20170287201A1 (en) | Texture generation system | |
CN107875630A (en) | Render area determination method and device | |
CN112102492B (en) | Game resource manufacturing method and device, storage medium and terminal | |
CN107610233A (en) | A kind of simulating scenes construction method based on outdoor scene | |
CN106991714A (en) | Outdoor scene threedimensional model and three-dimensional simulation model mix-loaded method | |
CN112231020B (en) | Model switching method and device, electronic equipment and storage medium | |
CN109671097A (en) | Motion blur implementation method and device | |
CN112734900B (en) | Baking method, device and equipment for shadow map and computer readable storage medium | |
CN108280887B (en) | Shadow map determination method and device | |
CN110458922A (en) | Method for rendering graph and Related product | |
CN115908673A (en) | Three-dimensional model display method and device, electronic equipment and storage medium | |
CN112037292B (en) | Weather system generation method, device and equipment |
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 | ||
RJ01 | Rejection of invention patent application after publication | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20180511 |