CN103679802A - Method for drawing surface of SPH (smoothed particle hydrodynamics) fluid in real time on basis of screen spaces - Google Patents

Method for drawing surface of SPH (smoothed particle hydrodynamics) fluid in real time on basis of screen spaces Download PDF

Info

Publication number
CN103679802A
CN103679802A CN201310636586.6A CN201310636586A CN103679802A CN 103679802 A CN103679802 A CN 103679802A CN 201310636586 A CN201310636586 A CN 201310636586A CN 103679802 A CN103679802 A CN 103679802A
Authority
CN
China
Prior art keywords
fluid
flow surface
sph
real
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
Application number
CN201310636586.6A
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.)
Beihang University
Original Assignee
Beihang University
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 Beihang University filed Critical Beihang University
Priority to CN201310636586.6A priority Critical patent/CN103679802A/en
Publication of CN103679802A publication Critical patent/CN103679802A/en
Pending legal-status Critical Current

Links

Images

Abstract

The invention provides a method for drawing the surface of SPH (smoothed particle hydrodynamics) fluid in real time on the basis of screen spaces. The method aims to track the surface of the fluid in real time and vividly draw the surface of the fluid on the basis of dynamic behavior of the fluid simulated by an SPH process, and research is carried out around an acceleration computation process on the basis of the screen spaces. The method includes generating depth graphs of the fluid in three-dimensional spaces from viewpoint positions; smoothing and filtering the depth graphs to dynamically extract the surface of the fluid relative to viewpoints; combining optical effects of environment mapping, fluid reflection, refraction and the like; simulating interaction among the fluid and other three-dimensional solid bodies in virtual scenes; vividly drawing flexible body and fluid interaction scenes on the basis of a GPU (graphics processing unit). The method has the advantages that various computation and rendering are carried out completely on the basis of the GPU, all operation can be carried out in a parallel mode, and the method is good in real-time performance and physical realism.

Description

SPH flow surface real-time drawing method based on screen space
Technical field
The present invention relates to a kind of SPH flow surface real-time drawing method based on screen space.
Background technology
In recent decades, rapid for the simulation study development of the mobile objects such as flowing water, smog.The research in this field relates to a plurality of academic directions such as fluid dynamics, numerical evaluation, infinitesimal analysis and computer graphics, at aspects such as Entertainment, science calculating, simulation trainings, there is very high practical value, always also be a very challenging study hotspot.In recent years, along with popularizing of multi-core CPU, GPU parallel processing technique, modeling and simulation technology based on fluid has obtained fast development, become the study hotspot that field of Computer Graphics is new, and by means of the parallel speed-up computation of GPU, the fluid simulation under particular range and precision can meet the needs of real-time, interactive substantially.
Based on physical streams n-body simulation n Technology Need, the fluid mechanics equation in three dimensions is solved, thereby there is very high computation complexity, mainly contain at present Lagrangian method and the Euler's method based on grid based on particle.In recent years, without grid method, become gradually an effective tool that solves engineering scientific problems.With traditional numerical method based on grid, as differences such as finite element, finite difference and finite volumes, without grid particle method, use discrete particle to carry out the governing equation of integrated form or differential form discrete and approximate.These particles can distribute arbitrarily, and not by certain grid, are linked together.The instability problem of so just having avoided ill grid to cause, and can process easily the topology change problems such as fracture.
SPH method is carried out discrete simulated continuous medium (fluid or solid) with one group of particle, and each particle represents the macroscopic view medium group in field continuously, follows the motion of medium to move with local speed, is a kind of typical Lagrangian method.In SPH method, particle, not only for estimating field variable and approximation control equation, also represents medium system, has macroscopic physical quantities such as density, pressure, speed, interior energy.
SPH fluid emulation mode is carried out the physical behavio(u)r of emulation fluid with a large amount of discrete particles, but lack the explicit flow surface geological information that can be used for visual performance, therefore dynamic fluid surface extraction algorithm has become restriction fluid simulated effect one of Main Bottleneck presenting true to nature in real time efficiently.
In order to address the above problem, the present invention proposes a kind of SPH flow surface real-time drawing method based on screen space, with flow surface real-time follow-up and the target that is plotted as true to nature, around the speed-up computation method based on screen space, launch research, first the depth map of fluid from viewpoint position generating three-dimensional space, and it is carried out to smothing filtering and carry out viewpoint Dynamic Extraction flow surface relatively, then combining environmental mapping, fluid reflection, the optical effects such as refraction, and by the reciprocation of other 3D solids in simulation fluid and virtual scene, based on GPU, realized the drafting real-time true to nature of beformable body and fluid interaction scenarios.
Summary of the invention
The technical matters that the present invention solves is: overcome the efficiency of existing flow surface extraction and method for drafting, a kind of SPH flow surface real-time drawing method based on screen space is provided.And by using the Data Structure and Algorithm based on GPU, met fluid motion process and carried out the needs that real time modelling is played up.
The technical solution used in the present invention is: a kind of SPH flow surface real-time drawing method based on screen space, comprises following three steps:
The physical simulation of step (1), fluid: by coming convection cell to carry out physical simulation by SPH method, utilize GPU dynamically position, the density information of all smooth fluid particles of parallel computation, as the input data of whole surface rendering method;
The surface extraction of step (2), fluid: from viewpoint position, each particle that step (1) is calculated is depicted as particle ball according to position and size, depth information and thickness under intercepting current view point, obtain case depth figure and thickness chart, then adopt the two-sided filter effects on surface degree of depth to carry out smoothing processing, using this as approximate flow surface;
The drafting real-time true to nature of step (3), fluid: the depth of smoothness figure calculating in step (2), as approximate flow surface, based on the dynamic thickness chart generating in step (2), carrys out the transparency of Fluid Computation according to Beer-Lambert law; , based on depth map, carrying out on the basis of flow surface method line computation meanwhile, by conjunction with Feng Shi illumination model and delay dye technology, carrying out reflection, the refraction effect of real time modelling flow surface;
Above all operations and calculate and all to carry out on GPU, has massive parallelism, and has avoided the time loss that brought by the exchanges data of video memory and internal memory, has very high real-time.
Further, the physical simulation method of the fluid described in step (1), the method is used one group of discrete particle to represent fluid, utilize the physical parameter of smoothing kernel approximation to function particle, by Na Wei-Stokes (Navier-Stokes, N-S) equation is only converted into the differential equation with the discrete form of time correlation, and recycling integration method solves.
Further, the flow surface extracting method described in step (2), the method is drawn fluid particles in the mode of bead, the replacement flow surface being similar to by the depth map being truncated to.
Further, passing through described in step (3), in conjunction with Feng Shi illumination model, Beer-Lambert law and delay dye technology, carrys out the optical effect of real time modelling flow surface.
Further, all operations described in step (1), (2), (3) and calculating are all carried out on GPU, except pretreatment stage, there is no the exchanges data of video memory and internal memory, and all operations and calculating are all to utilize CUDA and the parallel processing of OpenGL technology.
Principle of the present invention is:
The invention provides a kind of SPH flow surface real-time drawing method based on screen space, on the basis of dynamic behavior that utilizes SPH method emulation fluid, with flow surface real-time follow-up and the target that is plotted as true to nature, around the speed-up computation method based on screen space, launch research, first the depth map of fluid from viewpoint position generating three-dimensional space, and it is carried out to smothing filtering and carry out viewpoint Dynamic Extraction flow surface relatively, then combining environmental mapping, fluid reflection, the optical effects such as refraction, and by the reciprocation of other 3D solids in simulation fluid and virtual scene, based on GPU, realized the drafting real-time true to nature of beformable body and fluid interaction scenarios.Content of the present invention has mainly comprised following three aspects:
(1) physical simulation of fluid, smooth particle flux body dynamics (Smoothed Particle Hydrodynamics, SPH) method is a kind of typical in grid method, in fluid emulation, the method is used one group of discrete particle to represent fluid, utilizes the physical parameter of smoothing kernel approximation to function particle, by Na Wei-Stokes (Navier-Stokes, N-S) equation is only converted into the differential equation with the discrete form of time correlation, and recycling integration method solves.The present invention has furtherd investigate SPH side's ratio juris, and whole physical simulation process has been carried out to the realization based on GPU, usings that this extracts the basis with drafting true to nature as flow surface.By SPH method simulation fluid motion, to utilize GPU to carry out parallel computation to the motion state of each particle, and proposed a kind of efficient Method of Data Organization, all data are all stored in video memory, carry out easily and efficiently access and the storage of data.
(2) surface extraction of fluid, SPH fluid emulation mode is carried out the physical behavio(u)r of emulation fluid with a large amount of discrete particles, but lack the explicit flow surface geological information that can be used for visual performance, therefore dynamic fluid surface extraction algorithm has become restriction fluid simulated effect one of Main Bottleneck presenting true to nature in real time efficiently.The present invention studies and has realized the flow surface extracting method based on screen space, its core concept is: particle is drawn as bead, and extract two-dimensional depth figure and thickness chart at screen space, on this basis, by depth map being carried out to smothing filtering, carry out the viewpoint geometry of approximate flow surface relatively.The method has effectively avoided convection cell surface geometry in three dimensions to carry out explicit extraction and gridding processing, thereby, the topological computational problem of three-dimensional geometry can be converted into the processing problem to two-dimentional floating-point texture image, and further reduced time complexity by means of GPU parallel computation, for fluid simulation result true to nature represents the assurance that real-time Geometric Modeling aspect is provided.
(3) drafting real-time true to nature of fluid, the simulation of fluid optical characteristics has considerable influence to true to nature the representing of its visual effect, comprising multiple optical effects such as environment mappings, reflection, refractions.The present invention is based on the thickness chart dynamically generating at screen space, according to Beer-Lambert law, carry out the transparency of Fluid Computation; , based on depth map, carrying out on the basis of flow surface method line computation meanwhile, by conjunction with Feng Shi illumination model and delay dye technology, carrying out reflection, the refraction effect of real time modelling flow surface.
The present invention completely carries out every calculating and plays up based on GPU, and all operations are all carried out in the mode walking abreast, and have real-time good, the feature that physical third dimension is strong.
The present invention's advantage is compared with prior art:
1, the efficient data organizational form that the present invention proposes, GPU more easy to use carries out parallel computation acceleration on the one hand, also can avoid on the other hand the time loss bringing due to the exchanges data between internal memory and video memory.
The operations such as 2, efficiency is high: this method is extracted problem by flow surface and forwarded two-dimensional screen space to by three dimensions, level and smooth, conversion are all to carry out at two-dimensional space, have effectively reduced computing time; In addition, in algorithm, obtaining of depth map, thickness chart can be completed by hardware, so the efficiency of this method is very high.
3, level and smooth flow surface: for the depth map obtaining, adopt smothing filtering operation conventional in image processing, reduce particle and draw the distortion bringing.In addition, the level and smooth degree of flow surface is convenient to be controlled, and can alleviate smooth excessiveness or not enough situation.
4,, without the 3D grid that generates flow surface: the illumination of this method, refraction etc. are all the flow surface based on screen space, effectively avoided building a large amount of calculating and the memory consumption that flow surface 3D grid brings.In addition, this method only generates visible flow surface under current view point, has avoided extra computation;
5, the relevant level of detail of viewpoint: the depth map that this method builds is in the screen space of current view point, naturally has the level of detail that viewpoint is relevant.
6, all processing, drafting and coloring process all directly carry out on graphic hardware, have very high efficiency.
Accompanying drawing explanation
Fig. 1 is the SPH flow surface method for drafting process flow diagram based on screen space;
Fig. 2 is particle ball and fluid depth figure schematic diagram; Fig. 2 (a): particle ball, Fig. 2 (b): depth map;
Fig. 3 is the smoothing processing design sketch of depth map; Fig. 3 (a): before smoothing processing, Fig. 3 (b): after smoothing processing;
Fig. 4 is that particle thickness calculates schematic diagram and thickness chart; Fig. 4 (a): particle thickness calculates schematic diagram; Fig. 4 (b): thickness chart;
Fig. 5 is the result of calculation of flow surface normal and the result of calculation of illumination; Fig. 5 (a): the result of calculation of normal, Fig. 5 (a): the result of calculation of illumination;
Fig. 6 is Ambient and the Fresnel reflection result of fluid; Fig. 6 (a): Ambient result of calculation, Fig. 7 (b): Fresnel reflection result of calculation, Fig. 6 (c): both mix;
Fig. 7 is the reflecting effect figure of fluid to environment;
Fig. 8 is the refraction effect figure of fluid to background; Fig. 8 (a): the result of calculation of refraction, Fig. 8 (b): the refraction to bowl;
Fig. 9 is the final drawing result of fluid.
Embodiment
Fig. 1 has provided the overall process flow of the SPH flow surface real-time drawing method based on screen space, below in conjunction with other the drawings and the specific embodiments, further illustrates the present invention.
The invention provides a kind of SPH flow surface real-time drawing method based on screen space, key step is described below:
1. the physical simulation method of fluid
The present invention adopts SPH method to simulate the motion of fluid, SPH method is carried out discrete simulated continuous medium (fluid or solid) with one group of particle, each particle represents the macroscopic view medium group in field continuously, follows the motion of medium to move with local speed, is a kind of typical Lagrangian method.In SPH method, particle, not only for estimating field variable and approximation control equation, also represents medium system, has macroscopic physical quantities such as density, pressure, speed, interior energy.
Of the present inventionly focus on the extraction of flow surface and play up, so no longer SPH method is described in detail, can on network, find the GPU of many SPH algorithms of increasing income to realize, what the present invention adopted is that one of them CUDA realizes.
By SPH, carrying out the data such as particle position that physical simulation obtains is to be all kept in video memory, in order to carry out data sharing with OpenGL, the present invention has adopted a kind of interoperability of CUDA and OpenGL to realize, be the pointer to CUDA by the buffer zone handle map of OpenGL, just can directly to the buffer zone of OpenGL, carry out accessing operation by the kernel function of CUDA, avoid data back internal memory to pass to again the unnecessary time loss that video memory brings.
2. the flow surface based on screen space is extracted
The flow surface extracting method adopting is herein drawn particle with the form of bead, then at screen space, obtain its depth information, then carries out smothing filtering and obtain the approximate flow surface that viewpoint is relevant.This method is directly used the depth map of particle of flow surface as the surface of fluid, need not carry out triangle gridding, and the operation such as smothing filtering is all in two-dimensional depth figure concurrent operation, method realizes simple, and all operations all can directly be carried out or parallel computation on GPU by hardware, therefore there is good real-time.
A) calculating of the flow surface degree of depth
The degree of depth is a conventional concept in computer graphics, in OpenGL, what it represented is the distance that object arrives viewpoint, can decide the hiding relation between object according to the degree of depth, OpenGL remains is the degree of depth of the object nearest apart from viewpoint, the present invention has utilized this point just, by the depth buffer of intercepting OpenGL, obtains the depth map (as right in Fig. 2) of flow surface.
Due to what use, be the pipeline able to programme of OpenGL, self-defined vertex shader and the fragment shader of rendering pipeline, so need to carry out self-defined to the degree of depth.OpenGL function is conventionally handled is two dimension or three-dimensional summit, but they are to be nearly all taken as the three-dimensional homogeneous coordinates with 4 coordinates to process in inside, i.e. (x, y, z) tbe expressed as (x, y, z, w) t.As long as w is not equal to 0, (x, y, z, w) tjust corresponding to three-dimensional point (x/w, y/w, z/w) t; If w equals 0, it is no longer corresponding to Euclid point, but more corresponding Utopian " infinity points ".
So here we define the degree of depth and are:
depth=posEye.z/posEye.w
The degree of depth that wherein depth is homologous segment, posEye transforms to the coordinate vector of putting after view space.Depth represents that this is for the distance of viewpoint like this, and we represent the degree of depth of fluid with it.
We draw particle by a some spirit, can utilize its texture coordinate to obtain very easily the degree of depth of its each position, and will play up target and be redirected to texture, then intercept depth map buffer zone and just can obtain depth texture, for operation below.
B) smoothing processing of the flow surface degree of depth
The flow surface depth map obtaining is as right in Fig. 2, the bead of now simulating fluid has been drawn into particle ball, look and had the roughly profile of fluid, but their surfaces are still apparent bulbous rim, therefore need to carry out smoothing processing to obtain level and smooth flow surface to it.
The present invention adopts the convection cell case depth value of improving one's methods of bilateral filtering (Bilateral Filter) to carry out smoothing processing.Bilateral filtering and Gaussian Blur are similar, and different is that it is a kind of wave filter that can protect limit denoising.It consists of two functions, function be by geometric space apart from determining filter coefficient, another determines filter coefficient by pixel value difference.Therefore, bilateral filtering not only has the blur effect the same with Gaussian Blur, and because added a filter coefficient that pixel value difference determines, so the pixel weight that the degree of depth differs larger is relatively little, fog-level reduces, and so just can well accomplish Edge keeping, as right in Fig. 3.
The value of depth buffer is floating number, and scope changes from 0.0f to 1.0f, the 0.0 nearly shear surface that represents view frustums wherein, and 1.0 represent the shear surface far away of view frustums.But the floating number in depth buffer is not linear distribution, nearly 90% floating number is all close to nearly shear surface, and only accounts for depth bufferedly 10%, and remaining 10%(is from 0.9f to 1.0f) accounted for 90% of depth buffer.If represent 0.0f with black, by white, represent 1.0f, you will see that almost 99.999% color is all white, this shows to be inaccurate apart from the degree of depth at this.So need to carry out linearization process to the degree of depth, use following formula:
linearizeDepth=(2*near)/(far+near-depth*(far-near))
The value that wherein near is nearly shear surface, the value that far is shear surface far away, depth is depth value.
Herein the smoothing processing of depth map is completed in coloration program, for a certain photo section in fragment shader, the main process of processing is as follows:
1. set a fixed-size smooth window, this window is centered by this fragment;
2. for each sampled point in smooth window:
A) obtain sampled point depth value SampleDepth;
B) r is that sampled point is apart from the distance at smooth window center;
C) w=e -r*rweight as geometric space;
D) d is the poor of sampled point depth value and this fragment depth value;
E) g=e -d*dweight as pixel value difference;
F) ask weighted sum sum=sum+sampleDepth*w*g;
G) ask weight and wsum=wsum+w*g.
3. try to achieve weighted mean value fragDepth=sum/wsum, as the new depth value of this fragment.
The depth texture that upper joint is obtained imports coloration program into, according to above-mentioned processing procedure, it is processed, and result as shown in Figure 3.And catch up with joint and equally will play up target and be redirected in texture, the depth map after level and smooth is stored in depth of smoothness texture, for below.
4. flow surface drafting true to nature
A) calculating of fluid thickness
The same with obtaining of depth map, we draw particle by some spirit, and different is in coloration program, with the smart texture coordinate of point, to obtain the thickness of particle, and we carry out the thickness of Fluid Computation by the quantity of statistics particle.
Utilize the account form of the smart texture coordinate of point, in fragment shader, we can obtain particle very easily at the thickness of this fragment, be illustrated in figure 4 a sectional view of a spirit (particle ball), that fragment that red arrow indication is being processed for fragment shader, wherein l is this fragment centre of sphere, the i.e. distance of texture coordinate initial point after conversion, d is that particle is at the thickness of this fragment.Can significantly know:
d = 2 1 - l 2
Here the radius that we give tacit consent to particle is 1, and:
l=length(pointCoord.xy)
The length of length () function compute vector wherein, the texture coordinate that pointCoord is this fragment.The thickness value obtaining is like this larger, and we can change with normal distyribution function:
d , = 1 2 π σ 2 e - ( d - μ ) 2 / ( 2 σ 2 )
Wherein μ and σ are constant, and for easy, we make μ=0, σ=3.
Then when drawing, open and mix (blend), it is (GL_ONE that mixed function is set, GL_ONE) pattern, while drawing, color of object and source color simple superposition, so just utilize the rendering pipeline of OpenGL to realize population quantitative statistics, but also calculated the thickness of single particle at certain pixel, so just obtained the thickness chart of whole particIe system.Due to the executed in parallel of rendering pipeline, the method efficiency of this calculated thickness is very high.
B) calculating of normal and illumination
The calculating of normal can be simply by being used the method for partial differential to obtain, here we still use coloration program to carry out the calculating of normal, the calculating of normal is according to the depth map after level and smooth, depth of smoothness texture is passed to coloration program, use normal formula can obtain normal vector, wherein partial differential can be used predefined dfdx () and dfdy () function in GLSL, vector product can be used cross () function to calculate, what pay particular attention to here is exactly the degree of depth need to be transformed in view space when calculating normal.The same with previous processing, also will play up target and reset to texture, be denoted as normal map, for below.
C s=K a×A+K d×D×max(N·L,0)+K s×D×F×(max(N·H,0)) n
Illumination adopts above-mentioned calculating, and wherein N is normal line vector, can from normal map, directly obtain, L is the incident direction of light, because light source position is defined as infinite distance, so incident direction is the position of light source, for half-angle vector H, we are simply calculated as:
H=normalize(V+L)
Wherein normalize () is the predefined normalized function of GLSL, and V is viewpoint position vector.
Can obtain specular light thus:
specular=pow(max(0.0f,dot(H,N)),50.0f)
Pow () wherein, max (), dot () is predefined function in GLSL, is respectively used to gauge index, maximal value and dot product are made as 50 by specular light constant (shininess) here.
Then also can obtain scattered light:
diffuse=max(0.0f,dot(L,N))
So just completed the calculating of illumination.If Fig. 5 left side is the result of calculation of normal, the right side is the result of calculation of illumination, here in order to show that the color of fluid is set to redness.
C) calculating of Ambient
The water surface is more complicated to the reflection of environment, but because we have used GLSL, system can be automatically for we realize a lot of functions, and we can directly use.To the realization of Ambient, it is exactly typical example.
Will introduce us herein has below used day sylphon to realize the drafting of environment, and drawing result is stored in day sylphon texture, it sylphon texture is different with simple 2D texture, it is a cube texture, we can use the predefined texture of GLSL () function by texture coordinate, to obtain the color of reflection, and we need to obtain texture coordinate so before this.And GLSL also provides a reflect () function, by it, we can obtain the texture coordinate of Ambient texture easily:
refl=reflect(-viewer,N)
Then just can obtain the color of reflection:
refl_color=texture(u_Cubemaptex,refl)
Wherein u_Cubemaptex is the texture of day sylphon.
Fresnel reflection can be obtained by approximate formula below:
fres_refl=r_0+(1-r_0)*pow(1-dot(N,viewer),5.0f)
R_0=0.2f wherein.
D) calculating of background refraction
Refraction is the phenomenon that the traffic direction of light changes, performance is the most intuitively exactly that object under flow surface has been bent, especially uneven in flow surface, while being wavy, under flow surface also along with becoming wavy bending, so can find out, refraction is relevant with the normal of flow surface, and can significantly know and the distance dependent of flow surface to refractor.We can calculate refraction color like this:
refrac_color=texture(u_Backgroundtex,fs_Texcoord+N.xy*thickness)
Wherein u_Backgroundtex and fs_Texcoord are respectively background texture and corresponding fragment texture coordinate, and N is flow surface normal line vector, and the thickness that thickness is fluid refers to the distance between flow surface and background object here especially.The background color obtaining is not like this to see through the color that fluid is directly seen, but along with normal direction has the color at certain deviation place, like this refraction color is mixed with fluid afterwards and just can be obtained the phenomenon of background bending, the same with refraction effect.
E) calculating of color decay
First calculate the decay of color, light successively decreases along with suction brightness is exponential type, and absorbs brightness A=K/c, and wherein K is absorption coefficient, the thickness that l is absorbing medium, the concentration that c is extinction material.The fluid of considering due to us is incompressible, so concentration is constant, here for calculate easy we suppose c=1.According to Beer-Lambert law, the rate of decay of each Color Channel is different, and this is decided by absorption coefficient K, rule of thumb we respectively the absorption coefficient of red, green and blue channel be set to:
k r=5.0f,k g=1.0f,k b=0.1f
So decay of color:
color_atten=vec3(e -kr*thickness,e -kg*thickness,e -kb*thickness)
K wherein r, k g, k bthe absorption coefficient that is respectively redness, green and blue channel, the thickness that thickness is fluid directly obtains from thickness chart texture.
F) flow surface is complete painted
Final drafting is exactly briefly the mixing of color, depth map after this is level and smooth is as the surface of fluid, thickness chart is used for calculating the decay of color, and the result of normal and illumination is used for the color on Fluid Computation surface, adds the colors such as reflection, refraction and is finally mixed into fluid.Owing to having used frame buffer zone object (FBO), the result of calculating each time has all been plotted to corresponding texture, facilitates so final synthesizing.
First be the refraction blend of colors of fluid, we have obtained refraction color before, we mix according to the thickness of fluid, in this step, have also carried out the mixing of scattered light.
final_color=mix(color_atten.rgb*diffuse,refrac_color.rgb,transparency
Wherein mix () function is predefined function in GLSL, be used for carrying out hybrid operation, it is mixed into second parameter in first parameter in proportion according to the 3rd parameter, transparency is transparency, transparency=1-thickness, other amount all calculates before.
Finally add specular light photograph, the Fresnel reflection effect to environment:
out_Color=vec4(final_color.rgb+specular*vex3(1.0f)+refl_color.rgb*fres_refl,1.0f)
Wherein out_Color is exactly the color of final fluid output.
The technology contents that the present invention does not elaborate belongs to those skilled in the art's known technology.
Although above the illustrative embodiment of the present invention is described; so that those skilled in the art understand the present invention; but should be clear; the invention is not restricted to the scope of embodiment; to those skilled in the art; as long as various variations appended claim limit and definite the spirit and scope of the present invention in, these variations are apparent, all utilize innovation and creation that the present invention conceives all at the row of protection.

Claims (5)

1. the SPH flow surface real-time drawing method based on screen space, is characterized in that comprising following three steps:
The physical simulation of step (1), fluid: by coming convection cell to carry out physical simulation by SPH method, utilize GPU dynamically position, the density information of all smooth fluid particles of parallel computation, as the input data of whole surface rendering method;
The surface extraction of step (2), fluid: from viewpoint position, each particle that step (1) is calculated is depicted as particle ball according to position and size, depth information and thickness under intercepting current view point, obtain case depth figure and thickness chart, then adopt the two-sided filter effects on surface degree of depth to carry out smoothing processing, using this as approximate flow surface;
The drafting real-time true to nature of step (3), fluid: the depth of smoothness figure calculating in step (2), as approximate flow surface, based on the dynamic thickness chart generating in step (2), carrys out the transparency of Fluid Computation according to Beer-Lambert law; , based on depth map, carrying out on the basis of flow surface method line computation meanwhile, by conjunction with Feng Shi illumination model and delay dye technology, carrying out reflection, the refraction effect of real time modelling flow surface;
Above all operations and calculate and all to carry out on GPU, has massive parallelism, and has avoided the time loss that brought by the exchanges data of video memory and internal memory, has very high real-time.
2. the SPH flow surface real-time drawing method based on screen space according to claim 1, it is characterized in that: the physical simulation method of the fluid described in step (1), the method is used one group of discrete particle to represent fluid, utilize the physical parameter of smoothing kernel approximation to function particle, by Na Wei-Stokes (Navier-Stokes, N-S) equation is only converted into the differential equation with the discrete form of time correlation, and recycling integration method solves.
3. the SPH flow surface real-time drawing method based on screen space according to claim 1, it is characterized in that: the flow surface extracting method described in step (2), the method is drawn fluid particles in the mode of bead, the replacement flow surface being similar to by the depth map being truncated to.
4. the SPH flow surface real-time drawing method based on screen space according to claim 1, it is characterized in that: passing through described in step (3), in conjunction with Feng Shi illumination model, Beer-Lambert law and delay dye technology, carrys out the optical effect of real time modelling flow surface.
5. the SPH flow surface real-time drawing method based on screen space according to claim 1, it is characterized in that: all operations described in step (1), (2), (3) and calculating are all carried out on GPU, except pretreatment stage, the exchanges data that there is no video memory and internal memory, all operations and calculating are all to utilize CUDA and the parallel processing of OpenGL technology.
CN201310636586.6A 2013-12-01 2013-12-01 Method for drawing surface of SPH (smoothed particle hydrodynamics) fluid in real time on basis of screen spaces Pending CN103679802A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201310636586.6A CN103679802A (en) 2013-12-01 2013-12-01 Method for drawing surface of SPH (smoothed particle hydrodynamics) fluid in real time on basis of screen spaces

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201310636586.6A CN103679802A (en) 2013-12-01 2013-12-01 Method for drawing surface of SPH (smoothed particle hydrodynamics) fluid in real time on basis of screen spaces

Publications (1)

Publication Number Publication Date
CN103679802A true CN103679802A (en) 2014-03-26

Family

ID=50317243

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201310636586.6A Pending CN103679802A (en) 2013-12-01 2013-12-01 Method for drawing surface of SPH (smoothed particle hydrodynamics) fluid in real time on basis of screen spaces

Country Status (1)

Country Link
CN (1) CN103679802A (en)

Cited By (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104360896A (en) * 2014-12-04 2015-02-18 北京航空航天大学 Parallel fluid simulation acceleration method based on GPU (Graphics Processing Unit) cluster
CN105302580A (en) * 2015-11-28 2016-02-03 武汉斗鱼网络科技有限公司 Method and system for rapidly acquiring game graphics through GPU (Graphics Processing Unit) texture sharing
CN106373179A (en) * 2016-08-29 2017-02-01 北京像素软件科技股份有限公司 Illumination scene rendering method
CN106408639A (en) * 2016-08-31 2017-02-15 上海交通大学 Curvature flow-based screen space fluid rendering method
US10002432B2 (en) 2015-11-04 2018-06-19 Samsung Electronics Co., Ltd. Method and apparatus for rendering target fluid
CN110717269A (en) * 2019-10-10 2020-01-21 北方工业大学 Fluid surface detail protection method based on grid and particle coupling
CN111508055A (en) * 2019-01-30 2020-08-07 华为技术有限公司 Rendering method and device
WO2022135018A1 (en) * 2020-12-25 2022-06-30 北京字跳网络技术有限公司 Dynamic fluid display method and apparatus, electronic device, and readable medium
CN114972595A (en) * 2022-05-05 2022-08-30 北京领为军融科技有限公司 Particle system rendering optimization method based on geometric information

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102044086A (en) * 2010-11-30 2011-05-04 华北水利水电学院 Soft tissue deformation simulation method

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102044086A (en) * 2010-11-30 2011-05-04 华北水利水电学院 Soft tissue deformation simulation method

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
AIMIN HAO等: "Hydraulic Flow Simulation on Dynamical Changing Terrain", 《COMPUTATIONAL AND INFORMATION SCIENCES (ICCIS), 2010 INTERNATIONAL CONFERENCE ON》 *
张昆: "流体场景的屏幕空间实时绘制研究", 《万方学位论文数据库》 *
张海涛: "屏幕空间海洋场景的真实感绘制", 《万方学位论文数据库》 *

Cited By (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104360896A (en) * 2014-12-04 2015-02-18 北京航空航天大学 Parallel fluid simulation acceleration method based on GPU (Graphics Processing Unit) cluster
CN104360896B (en) * 2014-12-04 2017-12-15 北京航空航天大学 A kind of parallel flow emulation accelerated method based on GPU cluster
US10002432B2 (en) 2015-11-04 2018-06-19 Samsung Electronics Co., Ltd. Method and apparatus for rendering target fluid
CN105302580B (en) * 2015-11-28 2019-04-23 武汉斗鱼网络科技有限公司 It is a kind of to pass through the shared method and system for realizing quick obtaining game image of GPU texture
CN105302580A (en) * 2015-11-28 2016-02-03 武汉斗鱼网络科技有限公司 Method and system for rapidly acquiring game graphics through GPU (Graphics Processing Unit) texture sharing
CN106373179A (en) * 2016-08-29 2017-02-01 北京像素软件科技股份有限公司 Illumination scene rendering method
CN106373179B (en) * 2016-08-29 2019-02-26 北京像素软件科技股份有限公司 Illumination scene rendering method
CN106408639A (en) * 2016-08-31 2017-02-15 上海交通大学 Curvature flow-based screen space fluid rendering method
CN111508055A (en) * 2019-01-30 2020-08-07 华为技术有限公司 Rendering method and device
US11710266B2 (en) 2019-01-30 2023-07-25 Huawei Technologies Co., Ltd. Rendering method and apparatus
CN110717269A (en) * 2019-10-10 2020-01-21 北方工业大学 Fluid surface detail protection method based on grid and particle coupling
CN110717269B (en) * 2019-10-10 2023-07-25 北方工业大学 Fluid surface detail protection method based on grid and particle coupling
WO2022135018A1 (en) * 2020-12-25 2022-06-30 北京字跳网络技术有限公司 Dynamic fluid display method and apparatus, electronic device, and readable medium
CN114972595A (en) * 2022-05-05 2022-08-30 北京领为军融科技有限公司 Particle system rendering optimization method based on geometric information

Similar Documents

Publication Publication Date Title
CN103679802A (en) Method for drawing surface of SPH (smoothed particle hydrodynamics) fluid in real time on basis of screen spaces
CN102915559B (en) Real-time transparent object GPU (graphic processing unit) parallel generating method based on three-dimensional point cloud
CN102096941B (en) Consistent lighting method under falsehood-reality fused environment
CN103700143B (en) A kind of Three-Dimensional Dynamic ocean simulation method drawn based on GPU multipass
CN108090947A (en) A kind of ray tracing optimization method towards 3D scenes
CN102930583B (en) Method for interactively generating droplet effect
CN101593345A (en) Three-dimensional medical image display method based on the GPU acceleration
CN102855400A (en) Sea surface modeling and real-time illuminating method based on projected grid
CN107644453A (en) A kind of rendering intent and system based on physical colored
CN101441774B (en) Dynamic scene real time double face refraction drafting method based on image mapping space
CN107093207A (en) A kind of dynamic and visual method of the natural gas leaking diffusion based on GPGPU
CN103530907A (en) Complicated three-dimensional model drawing method based on images
CN112396684A (en) Ray tracing method, ray tracing device and machine-readable storage medium
CN101615300B (en) Ambient light occlusion method for microstructural surface object of screen space
Goswami A survey of modeling, rendering and animation of clouds in computer graphics
CN104008567A (en) City haze weather visualization drawing method based on GPU
CN103247070A (en) Interactive relighting sense of reality rendering method based on precomputed transfer tensor
CN102867336B (en) Method for simulating solid combustion process based on thermodynamic model
Nah et al. MobiRT: an implementation of OpenGL ES-based CPU-GPU hybrid ray tracer for mobile devices
CN116385623A (en) Drawing method and system for multiple scattering of participating medium with depth information
CN103871091A (en) Night scene map making method for point element distribution characteristic expression
Zhang et al. A fast framework construction and visualization method for particle-based fluid
CN104272351A (en) Method for representing a participating media in a scene and corresponding device
Shen et al. Fast global rendering in virtual reality via linear integral operators
CN102402798B (en) Method for interactively drawing heterogeneous translucent object

Legal Events

Date Code Title Description
PB01 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: 20140326