CN102426691A - Real-time fire effect simulation method based on GPU - Google Patents

Real-time fire effect simulation method based on GPU Download PDF

Info

Publication number
CN102426691A
CN102426691A CN201110325121XA CN201110325121A CN102426691A CN 102426691 A CN102426691 A CN 102426691A CN 201110325121X A CN201110325121X A CN 201110325121XA CN 201110325121 A CN201110325121 A CN 201110325121A CN 102426691 A CN102426691 A CN 102426691A
Authority
CN
China
Prior art keywords
particles
pixel
gpu
vertex
data
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
Application number
CN201110325121XA
Other languages
Chinese (zh)
Inventor
郭华
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
KARAMAY HONGYOU SOFTWARE CO Ltd
Original Assignee
KARAMAY HONGYOU SOFTWARE CO Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by KARAMAY HONGYOU SOFTWARE CO Ltd filed Critical KARAMAY HONGYOU SOFTWARE CO Ltd
Priority to CN201110325121XA priority Critical patent/CN102426691A/en
Publication of CN102426691A publication Critical patent/CN102426691A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Image Generation (AREA)

Abstract

The invention provides a real-time fire effect simulation method based on a GPU (Graphics Processing Unit). The method comprises the following steps of: generating and updating a particle system through a CPU (Central Processing Unit), and obtaining the updated particle system; rendering corresponding point sprites of all the particles in the updated particle system, and obtaining the rendering result of the corresponding point sprites of all the particles. The method implements the simulation and rendering process of the real-time rendering fire effect, thereby obtaining the vivid fire effect in the real-time environment.

Description

A kind of analogy method of the real-time flame effect based on GPU
Technical field
The present invention relates to field of Computer Graphics, particularly relate to a kind of analogy method of the real-time flame effect based on GPU.
Background technology
Flame has irregular geometric configuration, trickle change color, and have uncertain dynamic perfromance.This dynamic change is very complicated and chaotic, and receives the influence of surrounding environment, can accurately not describe, and the dynamic of flame and randomness make it be difficult to simulate through three-dimensional modeling method commonly used.To the above characteristic of flame, Reeves proposes the particIe system method in nineteen eighty-three, and in order to carry out the simulation of irregularly shaped objects such as flame, particIe system has the advantage of real time modelling irregularly shaped object, and it is developed aspect simulating flame widely.Perry and Picard have set up the particIe system of an enhancing, promptly utilize the solid of dynamic change to replace the element figure of static state and the real-time rendering that pixel is realized particIe system, and in system, add the simulation of propagation of flame effect.Philippe has simulated the communication process of flame in triangular surface, and through adopting a flame set expression fire, each flame is the summit chain that can be out of shape, and goes out the profile of flame through this cage construction.At present, simulation is the method for Nguyen the most accurately, adopts full NS equation to find the solution, and has considered combustion process.Lamolette is more prone to adopt the strict method based on physics for the animation teacher provides control more flexibly, based on particIe system, adds that process noise and klmogorov turbulence noise form final flame profile.But these two methods all have the too slow problem of speed, so that can not satisfy real-time needs.
Accurately simulating flame is very difficult, and flame itself is the fluid power system of a three-dimensional, and accurately simulation needs great amount of calculation, can not show in real time.
In sum, the defective of the analogy method of flame effect is at present:
1) analog rate is too slow, thereby can not satisfy real-time needs;
2) need a large amount of calculating and computation process complicated in the simulation process, can not realize real-time demonstration.
Thereby, need the urgent technical matters that solves of those skilled in the art to be exactly at present: how to find a kind of novel accurately and the analogy method of the simulated flame effect that can realize showing in real time.
Summary of the invention
A technical matters to be solved by this invention provides a kind of analogy method of the real-time flame effect based on GPU, and this method has realized the simulation and the render process of real-time rendering flame effect, thereby in real time environment, obtains flame effect true to nature.
In order to address the above problem, the invention discloses a kind of analogy method of the real-time flame effect based on GPU, comprising:
Generate and the renewal particIe system particIe system after obtaining to upgrade through CPU;
It is smart to play up the corresponding point of all particles in the particIe system after the renewal through GPU, obtains the smart rendering result of the corresponding point of all particles.
Preferably, said through CPU generation and renewal particIe system, the step of the particIe system after obtaining to upgrade comprises:
Adopt the multiparticle crowd's of different parameters method to create particIe system, generate particIe system;
Upgrade particIe system, the particIe system after obtaining to upgrade.
Preferably, said renewal particIe system, the step of the particIe system after obtaining to upgrade comprises:
Initial phase according to the different demands of flame rendering effect, is created different vertex caches; The size in different top point cache district wherein, need be set in different vertex caches;
Initial phase is confirmed the primitive type of figure through the mode of selected element tabulation, obtains the primitive type of the figure of the particIe system after the renewal;
Initial phase, through flexible vertex format is set, the flexible vertex format of the particIe system after obtaining to upgrade; Wherein, said flexible vertex format is position data, color data and normal data;
Playing up in the function, the instruction of calling dx is provided with vertex cache, flexible vertex format and rendered formats, obtains the data of vertex cache, flexible vertex format and rendered formats;
The data of vertex cache, flexible vertex format and rendered formats are sent to the processing of carrying out data among the GPU, and activate the render process that the shader code carries out a spirit simultaneously.
Preferably, said to play up the corresponding point of all particles in the particIe system after the renewal through GPU smart, obtains the step of the smart rendering result of the corresponding point of all particles, comprising:
Employing GPU method is played up the corresponding some spirit of all particles of the particIe system after the renewal, obtains the data of all survival particles;
After each frame update is accomplished, send to the data of all survival particles among the GPU and to play up, obtain the smart rendering result of the corresponding point of all particles.
Preferably, said after each frame update is accomplished, send to the data of all survival particles among the GPU and to play up, obtain the step of the smart rendering result of the corresponding point of all particles, comprising:
Adopt the smart rendering intent of point to play up all particles, obtain the rendering result of all particles after the smart rendering intent of process point is played up;
Adopt the rendering intent of body texture to play up all particles, obtain the rendering result of all particles after process body texture rendering intent is played up;
That adopts the normal pinup picture comes simulated flame effect, the flame effect after the simulation of acquisition by the pixel illumination method.
Preferably, the smart rendering intent of said employing point is played up all particles, obtains the step of the rendering result of all particles after the smart rendering intent of process point is played up, and comprising:
A smart rendering state and transparency hybrid rending state are set;
GPU receives the Data Receiving instruction, begins to receive the data of vertex cache, flexible vertex format and rendered formats;
The data that GPU will receive the particle size of all particles are imported in the vertex shader;
Vertex shader adopts the data of the particle size of all particles that receive to come the semantic variable assignments to PSIZE, obtains the functional value of PSIZE semantic variant;
Vertex shader adopts the data of the particle size of all particles that receive to come the semantic variable assignments to TEXCOORD, obtains the functional value of TEXCOORD semantic variant;
GPU receives the instruction of the functional value of input semantic variant, in the functional value output vertex tinter with the functional value of PSIZE semantic variant and TEXCOORD semantic variant.
Preferably, the rendering intent of said employing body texture is played up all particles, obtains the step of the rendering result of all particles after process body texture rendering intent is played up, and comprising:
Download the Software tool of the body texture that can process and generate the body texture from the internet; Wherein, the Software tool of said body texture can merge several 2 d texture pictures and generate a body texture picture, and perhaps the some two field pictures of intercepting merge and generate a body texture picture from a video file;
8 kinds of two-dimentional flame body texture pictures from the Software tool of body texture, selecting appointment for use are as the primarily two-dimensional body texture picture that merges;
In the program initialization stage, load a certain two-dimentional body texture picture in the primarily two-dimensional body texture picture;
The two-dimentional body texture picture that loads is passed to the setting that the shader program is carried out parameter as global parameter;
In pixel coloring device, calculate the 2 d texture coordinate of each pixel;
With the 2 d texture coordinate of each pixel,, obtain the three-D grain coordinate of each pixel in conjunction with the life span of each particle that imports into and the ratio of life time;
Call the text3D function, will take out the corresponding color value of body texture from the three-D grain coordinate of each pixel of obtaining;
Through calculating, convert the color value of body texture into final pixel color value;
GPU receives the output command of pixel color value, demonstrates the rendering result of all particles after process body texture rendering intent is played up with the final pixel color value output that obtains and through display.
Preferably, the pixel illumination method that pursues of said employing normal pinup picture comes simulated flame effect, and the step of the flame effect after the simulation of acquisition comprises:
Texture coordinate value according to each pixel is taken out normal from the normal pinup picture, obtain the normal of each pixel;
To the different normal of each pixel, adopt by the method for pixel light photograph and calculate, obtain the result of calculation of the different normals of each pixel;
With the result of calculation of the different normals of each pixel through GPU output and will export the result through display demonstrate adopt the normal pinup picture pursue pixel illumination method simulated flame effect, the flame effect after the simulation of acquisition.
Compared with prior art, the present invention has the following advantages:
1) the present invention is based on the simulation of visual effect, and the realization of simulation process is simple and efficient, can satisfy the demand that shows in real time better.
2) the present invention adopts the powerful program capability of GPU, combination texture method and use the visual effect of coming simulating flame by the pixel illumination method of normal pinup picture.Compare the texture that former particIe system adopts and the gradual change of color and come analog color, the change in color that the present invention simulated out is more abundant, and the flame effect that simulates simultaneously has the stronger stereoscopic sensation and the sense of reality.
In a word, the invention provides a kind of analogy method of the real-time flame effect based on GPU, this method has realized the simulation and the render process of real-time rendering flame effect, thereby in real time environment, obtains flame effect true to nature.
Description of drawings
Fig. 1 is the steps flow chart synoptic diagram of the analogy method embodiment of a kind of real-time flame effect based on GPU of the present invention;
Fig. 2 creates the smart structural representation of point among the present invention.
Embodiment
For make above-mentioned purpose of the present invention, feature and advantage can be more obviously understandable, below in conjunction with accompanying drawing and embodiment the present invention done further detailed explanation.
One of core concept of the present invention has provided that a kind of (Graphic Processing Unit translator of Chinese is a graphic process unit based on GPU; GPU is a notion with respect to central processing unit (CPU); Because in the computing machine in modern times, domestic system particularly, the fan of recreation; The processing of figure becomes more and more important; Need a special graph core processor) the analogy method of real-time flame effect, comprising: through central processing unit (CPU) (Central Processing Unit, translator of Chinese is a central processing unit; Be the arithmetic core and control core of a computing machine; Its function mainly is the data in interpretive machine instruction and the process computer software, central processing unit (CPU) by arithmetical unit, controller and register and the bus of data, control and the state realizing getting in touch between them constitute) generate and upgrade particIe system, the particIe system after obtaining to upgrade; It is smart to play up the corresponding point of all particles in the particIe system after the renewal through GPU, obtains the smart rendering result of the corresponding point of all particles; This method has realized the simulation and the render process of real-time rendering flame effect, thereby in real time environment, obtains flame effect true to nature.
With reference to Fig. 1, show the flow chart of steps of the analogy method embodiment of a kind of real-time flame effect based on GPU of the present invention, specifically can comprise:
Step 101, generate and upgrade particIe system, the particIe system after obtaining to upgrade through CPU.
In order to make those skilled in the art understand the present invention better, in a preferred embodiment of the invention, said step 101 specifically can comprise:
The multiparticle crowd's of substep 1011, employing different parameters method is created particIe system, generates particIe system.
In order to make those skilled in the art better understand the present invention, introduce traditional particIe system below in detail, specific as follows said:
ParticIe system is the technology that is used for simulating some bloomings in the computer graphics, and these phenomenons are difficult to realize with traditional rendering technique,, explodes cigarette, fallen leaves, cloud, mist, the simulation of effects such as snow like fire.Use particIe system can simulate galaxy and fountain effect truly.
ParticIe system is that transmitter (Emittor) is controlled in three-dimensional position and motion.Transmitter is a particle source, its determining positions the position that generates of particle.Transmitter is cube or plane normally.Transmitter can be set the behavior parameter of particle, and these parameters generally include emissivity, particle initial velocity vector, particle life cycle, particle color.These parameters are normally blured, rather than an exact value.Normally be set to the random value in the scope, perhaps central value and scope at random.
Come flame effect simulated through traditional particIe system and often can be divided into two stages, that is: update stage with play up the stage.
(1) In the update phase, with the emitter creates a number of new particles, the number of particles according to the transmitter and the update rate of the time difference between two Xu to calculate the particle parameters (position, speed, color, etc.) the parameters according to the transmitter setting.Check the particle of all survivals then,, for example whether surpass life cycle, judge whether particle is dead according to certain condition.If particle is dead, remove it.And then come the more attribute of new particle according to the certain physical rule.Can be very simple, also can be very complicated, such as considering gravity, wind rubs to wait and does accurate particle trajectory calculating.Also can in particle and scene, carry out collision detection between some three-dimensional bodies.Can simulate the mutual of barrier in they and the environment like this.And the collision between the particle is seldom used, because calculated amount is very big, and neither be of great use to most of emulation.
The present invention adopted is that multiparticle crowd through different parameters simulates the natural fire flame effect, and the natural fire flame effect that simulates that adopts a population to be difficult at random with traditional particIe system is two different processes.Relatively with traditional particIe system, the flame effect that the present invention simulated more at random with true.
(2) after update stage finishes, play up all particles.Usually use the bulletin board of band texture to play up particle.
The renewal of traditional particIe system flame simulating effect and play up all through central processing unit (CPU) and realize complicated, and simulate effect is not good.The present invention still uses particIe system technology and since adopt a population be difficult at random simulate the natural fire flame effect, so the present invention adopts the multiparticle crowd of different parameters.Simultaneously, the present invention upgrades particIe system through central processing unit (CPU).
At present, adopt the application of particIe system simulated flame effect very extensive.The generation of particle, renewal, motion and extinction use conventional methods realization among the present invention, and use the particle pool technology to optimize performance.
Substep 1012, renewal particIe system, the particIe system after obtaining to upgrade.
The renewal of traditional particIe system flame simulating effect and play up all through central processing unit (CPU) and realize complicated, and simulate effect is not good.The present invention still uses particIe system technology and since adopt a population be difficult at random simulate the natural fire flame effect, so the present invention adopts the multiparticle crowd of different parameters.Simultaneously, the present invention upgrades particIe system through central processing unit (CPU).
At present, adopt the application of particIe system simulated flame effect very extensive.The generation of particle, renewal, motion and extinction use conventional methods realization among the present invention, and use the particle pool technology to optimize performance.
In order to make those skilled in the art understand the present invention better, in another preferred embodiment of the present invention, said step 1012 specifically can comprise:
Substep A1, initial phase according to the different demands of flame rendering effect, are created different vertex caches; The size in different top point cache district wherein, need be set in different vertex caches.
Substep A2, initial phase are confirmed the primitive type of figure through the mode of selected element tabulation, obtain the primitive type of the figure of the particIe system after the renewal.
Substep A3, initial phase, through flexible vertex format is set, the flexible vertex format of the particIe system after obtaining to upgrade; Wherein, said flexible vertex format is position data, color data and normal data.
Substep A4, playing up in the function, the instruction of calling dx is provided with vertex cache, vertex format and rendered formats flexibly, obtains vertex cache, the data of vertex format and rendered formats flexibly.
Substep A5, with vertex cache, flexibly the data of vertex format and rendered formats send to the processing of carrying out data among the GPU, and activate the render process that the shader code carries out a spirit simultaneously.
Step 102, to play up the corresponding point of all particles in the particIe system after the renewal through GPU smart, obtains the smart rendering result of the corresponding point of all particles.
In order to make those skilled in the art understand the present invention better, introduce the GPU programmed method below in detail and carry out graphics process, specific as follows said:
At present, 3-D technology has developed into the computer graphics techniques of a comparative maturity, and is topmost calculating to playing up of object vertex and pixel in the 3-D technology, and it has determined the sense of reality of three-dimensional picture.Microsoft proposes the notion of tinter in dx8.The characteristic of tinter is based on the programmable pattern design, and original fixed pipelines is isolated programmable part.Tinter comprises geometric coloration (Geometry Shader), vertex shader (Vertex Shader), pixel coloring device (Pixel Shader) from the programming angle now.The most frequently used still vertex shader and pixel coloring device.Vertex shader is exactly the program that conversion and photostage carry out on the summit, and it is the computing programmable device to vertex information.Pixel coloring device is exactly the program of during each pixel is carried out rasterisation, on the GPU of graphics card, carrying out, and gives the ability that we directly grasp each pixel and visit pixel texture, can realize a lot of special-effects like this.
In order to make those skilled in the art understand the present invention better, below introduce the smart method of point in detail, specific as follows said:
The smart parallel element of screen that can be regarded as a some definition of point.When being used for particIe system, on internal memory use and performance, have many good qualities.A because smart summit rather than tetragonal four summits of texture of only needing of point.
With reference to Fig. 2, show and create the smart structural representation of point among the present invention.
From Fig. 2, can find out:
For each given input point, it uses the smart size of point to create 4 summits around; Also created simultaneously texture coordinate.
The smart size of point depends on following factor,
The smart size of point can be used and the irrelevant fixed measure of current viewing distance, for example screen space unit;
The smart size of point also can use according to user-defined original dimension and the relevant function calculation of distance obtain variable-sized;
The smart size of point also can use rendering state to define;
The smart size of point also can be used the definition by the summit.
The computing formula of the current size that calculation level is smart is described below:
Ss=Vh*Si*sqrt(1/(A+B*D e+C*(D e 2)))(1)
Wherein, input value is initial point size (Si), viewport height (Vh), and to the distance (De) of eyes, three user-defined constants (A, B, C).Static state is set, linearity and quadratic function respectively.
Especially to note necessary some rendering state that are provided with, specific as follows said:
First is D3DRS_POINTSPRITEENABLE, and this handles texture coordinate.This value is set to true, and d3d will create one group of complete texture coordinate for 4 smart summits of each point.Be set to false, will there be same texture coordinate on each summit.D3DRS_POINTSCALEENABLE confirms how to create the final size of a spirit, if be set to false, D3D will not carry out any size and calculate, and spot size is interpreted as screen space unit.Otherwise the formula driven dimension of introducing above D3D will use for a correct spirit of playing up, also needs the correct meter alpha admixture and the factor.Be traditionally arranged to be and launch the alpha mixing, the source factor is set to alpha, and the target factor is set to one.
In order to make those skilled in the art understand the present invention better, in another preferred embodiment of the present invention, said step 102 specifically can comprise:
Substep 1021, employing GPU method are played up the corresponding some spirit of all particles of the particIe system after the renewal, obtain the data of all survival particles.
Substep 1022, after each frame update is accomplished, send to the data of all survival particles among the GPU and to play up, obtain the smart rendering result of the corresponding point of all particles.
In order to make those skilled in the art understand the present invention better, in another preferred embodiment of the present invention, said substep 1022 specifically can comprise:
Substep B1, the smart rendering intent of employing point are played up all particles, obtain the rendering result of all particles after a process smart rendering intent is played up.
Wherein, said substep B1 specifically can comprise:
Substep C1, a smart rendering state and alpha hybrid rending state are set.
Substep C2, GPU receive the Data Receiving instruction, begin to receive the data of vertex cache, flexible vertex format and rendered formats.
The data that substep C3, GPU will receive the particle size of all particles are imported in the vertex shader;
Substep C4, vertex shader adopt the data of the particle size of all particles that receive to come the semantic variable assignments to PSIZE, obtain the functional value of PSIZE semantic variant;
Substep C5, vertex shader adopt the data of the particle size of all particles that receive to come the semantic variable assignments to TEXCOORD, obtain the functional value of TEXCOORD semantic variant;
Substep C6, GPU receive the instruction of the functional value of input semantic variant, in the functional value output vertex tinter with the functional value of PSIZE semantic variant and TEXCOORD semantic variant.
Different with classic method, it is smart that the present invention adopts the GPU technology to play up the corresponding point of all particles of particIe system, after each frame update is accomplished, all sends to the data of existing all particles of surviving among the GPU and to play up.
According to the needs of flame rendering effect, use vertex cache.In the time of initialized, create vertex cache, the parameter that need be provided with comprises the size in vertex cache district, and this can be confirmed according to the size in particle pond; Also need the graphic primitive type, because be a spirit, selected element tabulation of the present invention; Also need flexible vertex format, the flexible vertex format of setting of the present invention comprises the position, and color and normal data are introduced below the concrete reason.
In the time of each frame update; After having upgraded all particles; The locking vertex cache, with the data of the pel in the data filling vertex cache of all particles, the data that need to fill comprise particle position (Position), color (Color), size (Size) etc.Because in shader, play up in the spirit; The automatic position of meeting according to position and four summits of size calculating; And distribute the texture coordinate of two dimension, but playing up of body texture needs three-dimensional texture coordinate, and the scope of the 3rd texture coordinate value is between 0 and 1; So calculate the life span (age) of particle and the ratio of particle age (lifetime), write vertex cache to this ratio data.This invention is used is that dx is when submitting to GPU to the vertex cache data; Position and color use location register and color register; And time and size do not have relevant register; So used the skill commonly used of a shader programming, used the normal register to import the data of particle size and the 3rd texture coordinate into.The flexible vertex format of Here it is front comprises the position, the reason of color and normal data.
Playing up in the function then, calling the order of dx, vertex cache is being set with flexible vertex format and play up.Submit to GPU to all data like this.Activated the shader code simultaneously.What need below is to realize smart the playing up of point in shader code the inside, and combination texture and normal pinup picture are realized the final rendering effect of expectation by the pixel lighting.
This invention uses GPU to play up all particles, and each particle is a some spirit.At first the before correct rendering state that is provided with need played up.According to the several rendering state of being provided with of preceding text introduction, comprise a spirit and the relevant several rendering state of alpha mixing.In GPU, play up then according to the data of importing into.Output variable the inside in vertex shader needs the variable that PSIZE is semantic and TEXCOORD is semantic.Because the present invention need realize the particle that size can change, thus, calculates on particle its size when upgrading, and import data into vertex shader, vertex shader is come the semantic variable assignments to PSIZE with these data.And vertex shader can be the semantic variable assignments of TEXCOORD automatically.Other work are all accomplished by rendering pipeline.
The rendering intent of substep B2, employing body texture is played up all particles, obtains the rendering result of all particles after process body texture rendering intent is played up.
In order to make those skilled in the art understand the present invention better, introduce the body texture method below in detail, specific as follows said:
The body texture also is three-D grain, is the extension of traditional two-dimensional texture.2 d texture is the surface color that piece image is used to provide three-dimensional model.Three-D grain can be regarded several 2 d textures as.Three-D grain is represented with three coordinates.Usually, three-D grain is a rectangular parallelepiped protrusion part, and each dimension all is 2 power.Three-D grain occupies an individual rather than rectangular area, uses three texture coordinates to visit usually.The texture coordinate scope of each dimension of three-D grain normally 0 to 1, filtering also uses parametric texture and texture environment to control.For three-D grain, simple linear interpolation is to carry out linear filtering along three axles of texture, therefore is called trilinear filtering.In the past, three-D grain was not widely used, because cost is than higher.Three-D grain accounts for a lot of video memorys, but can in using in real time, use three-D grain now.
At present, the body texture method has been widely used and cube has been played up playing up in the processing of processing and medical imaging, and is better true to nature through the picture that the body texture method is obtained, and approaches the real three-dimensional structure of real object.
Wherein, said substep B2 specifically can comprise:
Substep D1, download the Software tool of the body texture can process and generate the body texture from the internet; Wherein, the Software tool of said body texture can merge several 2 d texture pictures and generate a body texture picture, and perhaps the some two field pictures of intercepting merge and generate a body texture picture from a video file.
Substep D2, from the Software tool of body texture, select appointment for use 8 kinds of two-dimentional flame body texture pictures as the primarily two-dimensional body texture picture that merges.
Substep D3, in the program initialization stage, load a certain two-dimentional body texture picture in the primarily two-dimensional body texture picture.
Substep D4, the two-dimentional body texture picture that will load are passed to the setting that the shader program is carried out parameter as global parameter.
Substep D5, in pixel coloring device, calculate the 2 d texture coordinate of each pixel.
Substep D6, with the 2 d texture coordinate of each pixel, in conjunction with the life span of each particle that imports into and the ratio of life time, obtain the three-D grain coordinate of each pixel.
Substep D7, call the text3D function, will take out the corresponding color value of body texture from the three-D grain coordinate of each pixel of obtaining.
Substep D8, through calculating, convert the color value of body texture into final pixel color value.
Substep D9, GPU receive the output command of pixel color value, demonstrate the rendering result of all particles after process body texture rendering intent is played up with the final pixel color value output that obtains and through display.
The pixel illumination method that pursues of substep B3, employing normal pinup picture comes simulated flame effect, the flame effect after the simulation of acquisition.
In order to make those skilled in the art understand the present invention better, below introduce in detail by pixel illumination method, concavo-convex mapping method and normal chart pasting method, specific as follows said:
In computer graphics, be meant on each pixel of playing up of image and calculate illumination that this generates image more true to nature than common summit illumination by the pixel illumination method.Because summit illumination is to calculate illumination on each summit of three-dimensional model, then these values is carried out interpolation and calculate each color of pixel value.
By pixel light according to usually and other technologies combine to improve and play up quality, comprise concavo-convex mapping (bump mapping), (phong shading).The concavo-convex mapping of this invention use is carried out by pixel light and is shone.
Concavo-convex mapping is the rough technology of simulating surface in the computer graphics, the normal of its disturbance surface normal and use disturbance when illumination calculation.To under the situation that does not change body surface, make original level and smooth surface look like rough surface like this.Through the image of real-world object is carried out the processing of concavo-convex mapping method, make physics more near real image.
The normal pinup picture is a kind of application of concavo-convex mapping techniques, but concavo-convex mapping normally is the normal interpolation disturbance of existing model, and the normal pinup picture is to upgrade normal completely.With concavo-convex mapping class seemingly, the normal pinup picture also is to add details not increasing under the polygonal situation.An application of normal pinup picture is to use the normal pinup picture of high-resolution models to improve the display effect of low resolution model.
Can realize using the model of simplification and the details that the normal pinup picture is simulated original analog through the normal pinup picture.
Wherein, said substep B3 specifically can comprise:
Substep E1, from the normal pinup picture, take out normal, obtain the normal of each pixel according to the texture coordinate value of each pixel.
Substep E2, to the different normal of each pixel, adopt by the method for pixel light photograph and calculate, obtain the result of calculation of the different normals of each pixel.
Substep E3, with the result of calculation of the different normals of each pixel through GPU output and will export the result through display demonstrate adopt the normal pinup picture pursue pixel illumination method simulated flame effect, the flame effect after the simulation of acquisition.
In order to show the stereoscopic sensation of flame, the present invention uses by the pixel illumination method and strengthens the sense of reality.Wherein, the code that is adopted by the pixel illumination method can find in relevant well-known web sites, and volume can directly use.
In a word, the invention provides the analogy method that a kind of real-time flame effect based on GPU is provided, this method has realized the simulation and the render process of real-time rendering flame effect, thereby in real time environment, obtains flame effect true to nature.
More than the analogy method of a kind of real-time flame effect based on GPU provided by the present invention has been carried out detailed introduction; Used concrete example among this paper principle of the present invention and embodiment are set forth, the explanation of above embodiment just is used for helping to understand method of the present invention and core concept thereof; Simultaneously, for one of ordinary skill in the art, according to thought of the present invention, the part that on embodiment and range of application, all can change, in sum, this description should not be construed as limitation of the present invention.

Claims (8)

1. the analogy method based on the real-time flame effect of GPU is characterized in that, comprising:
Generate and the renewal particIe system particIe system after obtaining to upgrade through CPU;
It is smart to play up the corresponding point of all particles in the particIe system after the renewal through GPU, obtains the smart rendering result of the corresponding point of all particles.
2. the method for claim 1 is characterized in that, said through CPU generation and renewal particIe system, the step of the particIe system after obtaining to upgrade comprises:
Adopt the multiparticle crowd's of different parameters method to create particIe system, generate particIe system;
Upgrade particIe system, the particIe system after obtaining to upgrade.
3. method as claimed in claim 2 is characterized in that, said renewal particIe system, and the step of the particIe system after obtaining to upgrade comprises:
Initial phase according to the different demands of flame rendering effect, is created different vertex caches; The size in different top point cache district wherein, need be set in different vertex caches;
Initial phase is confirmed the primitive type of figure through the mode of selected element tabulation, obtains the primitive type of the figure of the particIe system after the renewal;
Initial phase, through flexible vertex format is set, the flexible vertex format of the particIe system after obtaining to upgrade; Wherein, said flexible vertex format is position data, color data and normal data;
Playing up in the function, the instruction of calling dx is provided with vertex cache, flexible vertex format and rendered formats, obtains the data of vertex cache, flexible vertex format and rendered formats;
The data of vertex cache, flexible vertex format and rendered formats are sent to the processing of carrying out data among the GPU, and activate the render process that the shader code carries out a spirit simultaneously.
4. the method for claim 1 is characterized in that, said to play up the corresponding point of all particles in the particIe system after the renewal through GPU smart, obtains the step of the smart rendering result of the corresponding point of all particles, comprising:
Employing GPU method is played up the corresponding some spirit of all particles of the particIe system after the renewal, obtains the data of all survival particles;
After each frame update is accomplished, send to the data of all survival particles among the GPU and to play up, obtain the smart rendering result of the corresponding point of all particles.
5. method as claimed in claim 4 is characterized in that, and is said after each frame update is accomplished, and sends to the data of all survival particles among the GPU and plays up, and obtains the step of the smart rendering result of the corresponding point of all particles, comprising:
Adopt the smart rendering intent of point to play up all particles, obtain the rendering result of all particles after the smart rendering intent of process point is played up;
Adopt the rendering intent of body texture to play up all particles, obtain the rendering result of all particles after process body texture rendering intent is played up;
That adopts the normal pinup picture comes simulated flame effect, the flame effect after the simulation of acquisition by the pixel illumination method.
6. method as claimed in claim 5 is characterized in that, the smart rendering intent of said employing point is played up all particles, obtains the step of the rendering result of all particles after the smart rendering intent of process point is played up, and comprising:
A smart rendering state and transparency hybrid rending state are set;
GPU receives the Data Receiving instruction, begins to receive the data of vertex cache, flexible vertex format and rendered formats;
The data that GPU will receive the particle size of all particles are imported in the vertex shader;
Vertex shader adopts the data of the particle size of all particles that receive to come the semantic variable assignments to PSIZE, obtains the functional value of PSIZE semantic variant;
Vertex shader adopts the data of the particle size of all particles that receive to come the semantic variable assignments to TEXCOORD, obtains the functional value of TEXCOORD semantic variant;
GPU receives the instruction of the functional value of input semantic variant, in the functional value output vertex tinter with the functional value of PSIZE semantic variant and TEXCOORD semantic variant.
7. method as claimed in claim 5 is characterized in that, the rendering intent of said employing body texture is played up all particles, obtains the step of the rendering result of all particles after process body texture rendering intent is played up, and comprising:
Download the Software tool of the body texture that can process and generate the body texture from the internet; Wherein, the Software tool of said body texture can merge several 2 d texture pictures and generate a body texture picture, and perhaps the some two field pictures of intercepting merge and generate a body texture picture from a video file;
8 kinds of two-dimentional flame body texture pictures from the Software tool of body texture, selecting appointment for use are as the primarily two-dimensional body texture picture that merges;
In the program initialization stage, load a certain two-dimentional body texture picture in the primarily two-dimensional body texture picture;
The two-dimentional body texture picture that loads is passed to the setting that the shader program is carried out parameter as global parameter;
In pixel coloring device, calculate the 2 d texture coordinate of each pixel;
With the 2 d texture coordinate of each pixel,, obtain the three-D grain coordinate of each pixel in conjunction with the life span of each particle that imports into and the ratio of life time;
Call the text3D function, will take out the corresponding color value of body texture from the three-D grain coordinate of each pixel of obtaining;
Through calculating, convert the color value of body texture into final pixel color value;
GPU receives the output command of pixel color value, demonstrates the rendering result of all particles after process body texture rendering intent is played up with the final pixel color value output that obtains and through display.
8. method as claimed in claim 5 is characterized in that, the pixel illumination method that pursues of said employing normal pinup picture comes simulated flame effect, and the step of the flame effect after the simulation of acquisition comprises:
Texture coordinate value according to each pixel is taken out normal from the normal pinup picture, obtain the normal of each pixel;
To the different normal of each pixel, adopt by the method for pixel light photograph and calculate, obtain the result of calculation of the different normals of each pixel;
With the result of calculation of the different normals of each pixel through GPU output and will export the result through display demonstrate adopt the normal pinup picture pursue pixel illumination method simulated flame effect, the flame effect after the simulation of acquisition.
CN201110325121XA 2011-10-24 2011-10-24 Real-time fire effect simulation method based on GPU Pending CN102426691A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201110325121XA CN102426691A (en) 2011-10-24 2011-10-24 Real-time fire effect simulation method based on GPU

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201110325121XA CN102426691A (en) 2011-10-24 2011-10-24 Real-time fire effect simulation method based on GPU

Publications (1)

Publication Number Publication Date
CN102426691A true CN102426691A (en) 2012-04-25

Family

ID=45960670

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201110325121XA Pending CN102426691A (en) 2011-10-24 2011-10-24 Real-time fire effect simulation method based on GPU

Country Status (1)

Country Link
CN (1) CN102426691A (en)

Cited By (29)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102915552A (en) * 2012-09-18 2013-02-06 中国科学院计算技术研究所 Controllable flame animation generation method and system
CN103295261A (en) * 2013-06-09 2013-09-11 江苏科技大学 Computer graphic rendering method
CN103310405A (en) * 2013-05-31 2013-09-18 新奥特(北京)视频技术有限公司 Method and device for controlling particle movement
CN103389387A (en) * 2013-07-05 2013-11-13 新奥特(北京)视频技术有限公司 Particle stressed effect achievement method and device
CN103455323A (en) * 2013-07-05 2013-12-18 新奥特(北京)视频技术有限公司 Implementation method and device of particle effects
CN103617594A (en) * 2013-12-16 2014-03-05 中国民航大学 Noise isopleth-surface drawing-oriented multi-GPU (Graphics Processing Unit) rendering parallel-processing device and method thereof
CN103839287A (en) * 2013-11-26 2014-06-04 北京航空航天大学 Method for enriching flame simulation details through turbulence equation
CN104077090A (en) * 2013-03-25 2014-10-01 北京发现角科技有限公司 Particle system based on gravity sensing and sound-based control of injection rate and method
CN104157000A (en) * 2014-08-14 2014-11-19 无锡梵天信息技术股份有限公司 Model surface normal calculating method
CN104574471A (en) * 2014-12-31 2015-04-29 电子科技大学 Realistic tail flame real-time animation method based on mixed model
CN104571993A (en) * 2014-12-30 2015-04-29 北京像素软件科技股份有限公司 Processing method of particle system, display card and mobile application platform
CN104700446A (en) * 2015-03-31 2015-06-10 境界游戏股份有限公司 Method for updating particle top point data in particle system
CN104778737A (en) * 2015-03-23 2015-07-15 浙江大学 Real-time rendering method of large-scale fallen leaves based on GPU
CN105046733A (en) * 2015-08-25 2015-11-11 克拉玛依红有软件有限责任公司 Three-dimensional multi-texture based mapping method
CN105719331A (en) * 2016-01-15 2016-06-29 网易(杭州)网络有限公司 Sprite drawing method, device and game system
CN105869106A (en) * 2016-04-27 2016-08-17 中国电子科技集团公司第二十八研究所 Improved method for drawing three-dimensional entity cloud
CN107609631A (en) * 2017-08-03 2018-01-19 福建省天晴互动娱乐有限公司 Cluster AI method, storage medium is realized in Unity
CN108198237A (en) * 2017-12-29 2018-06-22 珠海市君天电子科技有限公司 Dynamic wallpaper generation method, device, equipment and medium
CN108665531A (en) * 2018-05-08 2018-10-16 阿里巴巴集团控股有限公司 The transform method and device of 3D particle models
CN108769715A (en) * 2018-05-22 2018-11-06 深圳市腾讯网络信息技术有限公司 Method and device for processing graphic instruction data
CN110310348A (en) * 2019-07-09 2019-10-08 四川三秦电气有限责任公司 A kind of three-dimensional flame Dynamic Simulation Method based on particIe system
CN112215932A (en) * 2020-10-23 2021-01-12 网易(杭州)网络有限公司 Particle animation processing method, device, storage medium and computer equipment
CN112435304A (en) * 2020-07-20 2021-03-02 上海哔哩哔哩科技有限公司 Water body interactive mapping method and system
CN112652044A (en) * 2021-01-05 2021-04-13 网易(杭州)网络有限公司 Particle special effect rendering method, device and equipment and storage medium
CN113487474A (en) * 2021-07-02 2021-10-08 杭州小影创新科技股份有限公司 Content-related GPU real-time particle special effect method
CN113496538A (en) * 2021-07-30 2021-10-12 北京达佳互联信息技术有限公司 Image special effect generation method and device, electronic equipment and storage medium
CN113750536A (en) * 2020-06-04 2021-12-07 福建天晴数码有限公司 2D pixel flame method and system based on shader
CN114332323A (en) * 2021-12-24 2022-04-12 北京字跳网络技术有限公司 Particle effect rendering method, device, equipment and medium
CN114898032A (en) * 2022-05-10 2022-08-12 北京领为军融科技有限公司 Light spot rendering method based on shader storage cache object

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1753031A (en) * 2005-11-10 2006-03-29 北京航空航天大学 Particle system based on GPU
US20090070080A1 (en) * 2007-09-11 2009-03-12 Prometech Software, Inc. Method for constructing surface of fluid-body simulation based on particle method, program for the same, and storage medium for string program

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1753031A (en) * 2005-11-10 2006-03-29 北京航空航天大学 Particle system based on GPU
US20090070080A1 (en) * 2007-09-11 2009-03-12 Prometech Software, Inc. Method for constructing surface of fluid-body simulation based on particle method, program for the same, and storage medium for string program

Non-Patent Citations (4)

* Cited by examiner, † Cited by third party
Title
HE XIAO等: "Real-time Simulation of Fireworks Based on GPU and Particle System", 《2009 FIRST INTERNATIONAL WORKSHOP ON EDUCATION TECHNOLOGY AND COMPUTER SCIENCE》 *
HE XIAO等: "Real-time Simulation of Fireworks Based on GPU and Particle System", 《2009 FIRST INTERNATIONAL WORKSHOP TECHNOLOGY AND COMPUTER SCIENCE》 *
张卓鹏等: "基于GPU粒子系统的烟花实时仿真", 《东华大学学报(自然科学版》 *
齐路等: "基于多粒子系统的火焰三维模拟", 《计算机工程与应用》 *

Cited By (48)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102915552B (en) * 2012-09-18 2014-10-08 中国科学院计算技术研究所 Controllable flame animation generation method and system
CN102915552A (en) * 2012-09-18 2013-02-06 中国科学院计算技术研究所 Controllable flame animation generation method and system
CN104077090B (en) * 2013-03-25 2018-02-02 北京发现角科技有限公司 A kind of particIe system and method based on gravity sensing and acoustic control injection rate
CN104077090A (en) * 2013-03-25 2014-10-01 北京发现角科技有限公司 Particle system based on gravity sensing and sound-based control of injection rate and method
CN103310405A (en) * 2013-05-31 2013-09-18 新奥特(北京)视频技术有限公司 Method and device for controlling particle movement
CN103310405B (en) * 2013-05-31 2018-12-25 新奥特(北京)视频技术有限公司 A kind of control method and device of Particles Moving
CN103295261A (en) * 2013-06-09 2013-09-11 江苏科技大学 Computer graphic rendering method
CN103455323B (en) * 2013-07-05 2018-12-25 新奥特(北京)视频技术有限公司 A kind of implementation method and device of particle effect
CN103389387A (en) * 2013-07-05 2013-11-13 新奥特(北京)视频技术有限公司 Particle stressed effect achievement method and device
CN103455323A (en) * 2013-07-05 2013-12-18 新奥特(北京)视频技术有限公司 Implementation method and device of particle effects
CN103389387B (en) * 2013-07-05 2019-02-22 新奥特(北京)视频技术有限公司 A kind of particle effect implementation method that forces are applied and device
CN103839287A (en) * 2013-11-26 2014-06-04 北京航空航天大学 Method for enriching flame simulation details through turbulence equation
CN103839287B (en) * 2013-11-26 2016-09-28 北京航空航天大学 A kind of Equations of Turbulence enriches the method for flame simulating details
CN103617594A (en) * 2013-12-16 2014-03-05 中国民航大学 Noise isopleth-surface drawing-oriented multi-GPU (Graphics Processing Unit) rendering parallel-processing device and method thereof
CN103617594B (en) * 2013-12-16 2017-01-11 中国民航大学 Noise isopleth-surface drawing-oriented multi-GPU (Graphics Processing Unit) rendering parallel-processing device and method thereof
CN104157000A (en) * 2014-08-14 2014-11-19 无锡梵天信息技术股份有限公司 Model surface normal calculating method
CN104157000B (en) * 2014-08-14 2018-04-06 无锡梵天信息技术股份有限公司 The computational methods of model surface normal
CN104571993A (en) * 2014-12-30 2015-04-29 北京像素软件科技股份有限公司 Processing method of particle system, display card and mobile application platform
CN104571993B (en) * 2014-12-30 2018-01-30 北京像素软件科技股份有限公司 Processing method, video card and the mobile solution platform of particIe system
CN104574471A (en) * 2014-12-31 2015-04-29 电子科技大学 Realistic tail flame real-time animation method based on mixed model
CN104574471B (en) * 2014-12-31 2018-01-23 电子科技大学 A kind of sense of reality wake flame real-time animation method based on mixed model
CN104778737A (en) * 2015-03-23 2015-07-15 浙江大学 Real-time rendering method of large-scale fallen leaves based on GPU
CN104778737B (en) * 2015-03-23 2017-10-13 浙江大学 Extensive fallen leaves real-time rendering method based on GPU
CN104700446A (en) * 2015-03-31 2015-06-10 境界游戏股份有限公司 Method for updating particle top point data in particle system
CN104700446B (en) * 2015-03-31 2017-10-03 境界游戏股份有限公司 The update method of particle vertex data in a kind of particIe system
CN105046733A (en) * 2015-08-25 2015-11-11 克拉玛依红有软件有限责任公司 Three-dimensional multi-texture based mapping method
CN105719331A (en) * 2016-01-15 2016-06-29 网易(杭州)网络有限公司 Sprite drawing method, device and game system
CN105869106A (en) * 2016-04-27 2016-08-17 中国电子科技集团公司第二十八研究所 Improved method for drawing three-dimensional entity cloud
CN107609631A (en) * 2017-08-03 2018-01-19 福建省天晴互动娱乐有限公司 Cluster AI method, storage medium is realized in Unity
CN108198237A (en) * 2017-12-29 2018-06-22 珠海市君天电子科技有限公司 Dynamic wallpaper generation method, device, equipment and medium
CN108665531A (en) * 2018-05-08 2018-10-16 阿里巴巴集团控股有限公司 The transform method and device of 3D particle models
CN108769715A (en) * 2018-05-22 2018-11-06 深圳市腾讯网络信息技术有限公司 Method and device for processing graphic instruction data
CN108769715B (en) * 2018-05-22 2022-05-13 深圳市腾讯网络信息技术有限公司 Method and device for processing graphic instruction data
CN110310348A (en) * 2019-07-09 2019-10-08 四川三秦电气有限责任公司 A kind of three-dimensional flame Dynamic Simulation Method based on particIe system
CN113750536A (en) * 2020-06-04 2021-12-07 福建天晴数码有限公司 2D pixel flame method and system based on shader
CN113750536B (en) * 2020-06-04 2023-09-01 福建天晴数码有限公司 2D pixel flame method and system based on coloring device
CN112435304B (en) * 2020-07-20 2023-03-14 上海哔哩哔哩科技有限公司 Water body interactive mapping method and system
CN112435304A (en) * 2020-07-20 2021-03-02 上海哔哩哔哩科技有限公司 Water body interactive mapping method and system
CN112215932A (en) * 2020-10-23 2021-01-12 网易(杭州)网络有限公司 Particle animation processing method, device, storage medium and computer equipment
CN112215932B (en) * 2020-10-23 2024-04-30 网易(杭州)网络有限公司 Particle animation processing method and device, storage medium and computer equipment
CN112652044A (en) * 2021-01-05 2021-04-13 网易(杭州)网络有限公司 Particle special effect rendering method, device and equipment and storage medium
CN113487474A (en) * 2021-07-02 2021-10-08 杭州小影创新科技股份有限公司 Content-related GPU real-time particle special effect method
CN113487474B (en) * 2021-07-02 2024-08-16 杭州小影创新科技股份有限公司 Content-related GPU real-time particle special effect method
CN113496538A (en) * 2021-07-30 2021-10-12 北京达佳互联信息技术有限公司 Image special effect generation method and device, electronic equipment and storage medium
CN113496538B (en) * 2021-07-30 2024-03-19 北京达佳互联信息技术有限公司 Image special effect generation method and device, electronic equipment and storage medium
CN114332323A (en) * 2021-12-24 2022-04-12 北京字跳网络技术有限公司 Particle effect rendering method, device, equipment and medium
CN114898032A (en) * 2022-05-10 2022-08-12 北京领为军融科技有限公司 Light spot rendering method based on shader storage cache object
CN114898032B (en) * 2022-05-10 2023-04-07 北京领为军融科技有限公司 Light spot rendering method based on shader storage cache object

Similar Documents

Publication Publication Date Title
CN102426691A (en) Real-time fire effect simulation method based on GPU
EP3308359B1 (en) Rendering using ray tracing to generate a visibility stream
KR101820621B1 (en) Start node determination for tree traversal in ray tracing applications
CN102402791B (en) Three-dimensional fluid simulation method based on graphic processing unit (GPU)
KR102003655B1 (en) Determining the Start Node for Tree Traversal for Shadow Lays in Graphics Processing
CN102169596B (en) Method and device for realizing 3D rendering on embedded device
US9582929B2 (en) Dynamic skydome system
CN105556565A (en) Fragment shaders perform vertex shader computations
CN107016170A (en) A kind of LED lamp three-dimensional customization emulation mode based on WebGL
JP5873672B2 (en) Method for estimating the amount of light received at a point in a virtual environment
Friedrich et al. Exploring the use of ray tracing for future games
CN104407521A (en) Method for realizing real-time simulation of underwater robot
CN102402792A (en) Real-time shallow water simulation method
Fernando et al. Programming graphics hardware
JP5916764B2 (en) Estimation method of concealment in virtual environment
Nah et al. MobiRT: an implementation of OpenGL ES-based CPU-GPU hybrid ray tracer for mobile devices
CN112802165B (en) Game scene snow rendering method, device and medium
De Lucas Reducing redundancy of real time computer graphics in mobile systems
Nordahl Enhancing the hpc-lab snow simulator with more realistic terrains and other interactive features
WO2024027237A1 (en) Rendering optimization method, and electronic device and computer-readable storage medium
Apers et al. Interactive Light Map and Irradiance Volume Preview in Frostbite
Pohl et al. 15 Years Later: A Historic Look Back at “Quake 3: Ray Traced”
KR100789424B1 (en) System and method for implementating game special effect
Evangelou et al. Real-Time Volume Editing on Low-Power Virtual Reality Devices.
CN118397160A (en) Autonomous three-dimensional rendering engine for reverse site building system of oil field site

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C02 Deemed withdrawal of patent application after publication (patent law 2001)
WD01 Invention patent application deemed withdrawn after publication

Application publication date: 20120425