<p>A good reference for game physics is <a href="https://books.google.it/books?id=ynQZBwAAQBAJ&amp;printsec=frontcover&amp;dq=game+physics+eberly&amp;hl=en&amp;sa=X&amp;ved=0CCAQ6AEwAGoVChMIkKr24aSjxwIVwS4aCh3nrg55#v=onepage&amp;q=game%20physics%20eberly&amp;f=false" rel="nofollow">this</a> chapter 4 describes the basic free deformable surfaces (nurbs and bspline are of course cited and treated enough well) fluid and gases are instead treated in chapter five (basically the author derivate simplified model of navier stokes equations, suitable for real time applications).</p>

<p>So actually i guess what i've written commenting your post was correct, i.e. combine the physical deformation of the point that controls the shape of the surface with a ffd computations.</p>

<p>The book i cited should provide somewhere/somehow on the web source code, and itself it cites some example involving the technique i cited. If that is what you need let me know for a more specific explanation.</p>

CC BY-SA 3.0
2015-08-12T15:36:25.090Z
Could you perhaps expand on your answer so it's self-contained. Reading it without the link and its contents, the answer isn't all that clear.
Bart
CC BY-SA 3.0
2015-08-12T15:48:24.733Z
Actually i think the "idea" (not the implementation) is quite clear. @Cristian said he implemented the simulation on a set of points, basically he should consider the set of points as they belong to a deformable surface (i.e. a continuous surface described by a set of discrete points), then when the points position are updated the surface surface shape too is updated. The effectiveness depends on what he wants specifically to achieve, but i've assumed he wanted to use a kind of "continuous" instead of a discrete point set.
user8469759
CC BY-SA 3.0
2015-08-12T15:53:13.983Z
Also... i don't know why i can't use formulas here... but of course they would be useful for a more detailed explanation. However physically speaking good reference is any book of computational fluidodynamics, for rendering game physics of course, simplified methods could be found in literature too. For "code" itself depends on the environment he's using he can even find a complete implementation on the CUDA toolkit, i'm not sure about openCL, even the directX SDK presents some example of fluid simulation (espacially the last version, but probably it simulates using tons of points too).
user8469759
CC BY-SA 3.0
2015-08-12T16:39:23.130Z
My understanding of the question is that the author has the simulation part covered, but is only asking about visualization. I think it'll prove to be quite difficult to create sets of spline patches that satisfactorily represent the "shape" of the water, and there is little detail on this answer about how you'd do that.
yuriks
CC BY-SA 3.0
2015-08-13T17:23:20.537Z
Many of us would like to see the ability to use MathJax for formulas, and plenty of other SE sites already have it. All we need to do is demonstrate a need for it. Any questions that would benefit from MathJax, just add a link to them to [this meta answer](http://meta.computergraphics.stackexchange.com/a/34/231).
trichoplax is on Codidact now
CC BY-SA 3.0
2015-08-13T17:25:43.667Z
The additional information in your comments would make good additions to the answer.
trichoplax is on Codidact now
CC BY-SA 3.0
2015-08-12T10:17:33.037Z
2015-08-12T10:17:33.037Z
user8469759
<p>For rendering of gases, I think the usual approach is to simply render each particle as a tiny disc. Gases don't really coalesce into surfaces like liquids do, so this should produce acceptable results. You could perhaps apply a light blur over the gas layer afterwards to soften it and hide the fact that it is made of discrete elements.</p>

<p>Liquids, on the other hand, tend to coalesce together to form droplets and smooth surfaces, so you need to derive a surface from the particles somehow. One way to do this is to use <a href="https://en.wikipedia.org/wiki/Metaballs" rel="nofollow noreferrer">Metaballs</a>, which also display this behavior and can be tweaked to suit different liquids and particle densities. By interpreting each particle as a metaball, you will have an implicit equation representing your liquid surface. To render this implicit surface you can then use an algorithm like <a href="https://en.wikipedia.org/wiki/Marching_tetrahedra" rel="nofollow noreferrer">Marching Tetrahedra</a> to convert it to triangles, or utilize <a href="https://gamedev.stackexchange.com/a/67745/5337">Ray Marching</a> to directly render it. (Ray marching can be easily done in realtime in a fragment shader these days.) You can also use this approach for gases if you want a somewhat softer look.</p>

CC BY-SA 3.0
2015-08-12T16:55:26.340Z
2015-08-12T17:01:00.427Z
2017-04-13T12:18:54.697Z
yuriks
<p>How can I overlay graphics on particle simulations? For instance if I am representing a liquid or gas with tons of little points how can I make those points look like a liquid or gas? Take Nvidia Flex for instance, they simulate liquids and gases with tons of small points but can render them as realistic liquids and gases instead of small balls.</p>

CC BY-SA 3.0
2015-08-12T10:08:43.980Z
Have you tried a closed surface with control points, i.e. nurbs or bspline? or free form deformation stuff? both of these are described by using point, but moving a point you deforms the surface described. (In the mean while i try to gather more info on the problem). I was even thinking to convex hull, but i'm not sure of the result, since a liquid deformation could be not convex at all.
user8469759
<simulation><physics><particles>
Overlaying graphics on particle simulation
Andrew Wilson
# Overlaying graphics on particle simulation

(Asked by: username_0 on 2015-08-12)

How can I overlay graphics on particle simulations? For instance if I am representing a liquid or gas with tons of little points how can I make those points look like a liquid or gas? Take Nvidia Flex for instance, they simulate liquids and gases with tons of small points but can render them as realistic liquids and gases instead of small balls.

**Tags:** simulation, physics, particles

> **Comments:**
> **username_1**: Have you tried a closed surface with control points, i.e. nurbs or bspline? or free form deformation stuff? both of these are described by using point, but moving a point you deforms the surface described. (In the mean while i try to gather more info on the problem). I was even thinking to convex hull, but i'm not sure of the result, since a liquid deformation could be not convex at all.  

---

## 2 answers

### Answer by username_3 on 2015-08-12. Score: 4 | Accepted answer

For rendering of gases, I think the usual approach is to simply render each particle as a tiny disc. Gases don't really coalesce into surfaces like liquids do, so this should produce acceptable results. You could perhaps apply a light blur over the gas layer afterwards to soften it and hide the fact that it is made of discrete elements.

Liquids, on the other hand, tend to coalesce together to form droplets and smooth surfaces, so you need to derive a surface from the particles somehow. One way to do this is to use [Metaballs](https://en.wikipedia.org/wiki/Metaballs), which also display this behavior and can be tweaked to suit different liquids and particle densities. By interpreting each particle as a metaball, you will have an implicit equation representing your liquid surface. To render this implicit surface you can then use an algorithm like [Marching Tetrahedra](https://en.wikipedia.org/wiki/Marching_tetrahedra) to convert it to triangles, or utilize [Ray Marching](https://gamedev.stackexchange.com/a/67745/5337) to directly render it. (Ray marching can be easily done in realtime in a fragment shader these days.) You can also use this approach for gases if you want a somewhat softer look.


---

### Answer by username_1 on 2015-08-12. Score: -1

A good reference for game physics is [this](https://books.google.it/books?id=ynQZBwAAQBAJ&printsec=frontcover&dq=game+physics+eberly&hl=en&sa=X&ved=0CCAQ6AEwAGoVChMIkKr24aSjxwIVwS4aCh3nrg55#v=onepage&q=game%20physics%20eberly&f=false) chapter 4 describes the basic free deformable surfaces (nurbs and bspline are of course cited and treated enough well) fluid and gases are instead treated in chapter five (basically the author derivate simplified model of navier stokes equations, suitable for real time applications).

So actually i guess what i've written commenting your post was correct, i.e. combine the physical deformation of the point that controls the shape of the surface with a ffd computations.

The book i cited should provide somewhere/somehow on the web source code, and itself it cites some example involving the technique i cited. If that is what you need let me know for a more specific explanation.

> **Comments:**
> **username_2**: Could you perhaps expand on your answer so it's self-contained. Reading it without the link and its contents, the answer isn't all that clear.  
> **username_1**: Actually i think the "idea" (not the implementation) is quite clear. @Cristian said he implemented the simulation on a set of points, basically he should consider the set of points as they belong to a deformable surface (i.e. a continuous surface described by a set of discrete points), then when the points position are updated the surface surface shape too is updated. The effectiveness depends on what he wants specifically to achieve, but i've assumed he wanted to use a kind of "continuous" instead of a discrete point set.  
> **username_1**: Also... i don't know why i can't use formulas here... but of course they would be useful for a more detailed explanation. However physically speaking good reference is any book of computational fluidodynamics, for rendering game physics of course, simplified methods could be found in literature too. For "code" itself depends on the environment he's using he can even find a complete implementation on the CUDA toolkit, i'm not sure about openCL, even the directX SDK presents some example of fluid simulation (espacially the last version, but probably it simulates using tons of points too).  
> **username_3**: My understanding of the question is that the author has the simulation part covered, but is only asking about visualization. I think it'll prove to be quite difficult to create sets of spline patches that satisfactorily represent the "shape" of the water, and there is little detail on this answer about how you'd do that.  
> **username_4**: Many of us would like to see the ability to use MathJax for formulas, and plenty of other SE sites already have it. All we need to do is demonstrate a need for it. Any questions that would benefit from MathJax, just add a link to them to [this meta answer](http://meta.computergraphics.stackexchange.com/a/34/231).  
> **username_4**: The additional information in your comments would make good additions to the answer.  

---

