   Resources on Smoothed Particle Hydrodynamics (SPH)
  Does anyone know of any good resources on Smoothed Particle Hydrodynamics (SPH)? I know of the book (http://www.worldscibooks.com/engineering/5340.html), does anyone know if that is pretty good? It looks rather helpful, and the text says its focused on the computational and implementation issues, which is what I'm looking for. They have the first chapter on the web site, and I read it, it seems pretty good so far.I also heard that Game Programming Gems 6 has an article on "Real-Time Particle-Based Fluid Simulation". Has anyone read that, and, if so, would you say that the gem gives one a good start to implement real-time fluids? I was looking for some resource (book or web reference) that gives a good explanation behind the theory behind SPH and also goes into how one would begin the implementation in code. Does anyone know of any good resources for SPH?   
  Smoothed Paricle Hydrodynamics by JJ Monaghan is an excelent resourceThis code is an ok rendition of a SPH system that runs in real time.  As pointed out in another thread, this could be improved masively with good sse codeTime stepping N-body simulations by Thomas Quinn, Neal Katz, Joachim Stadel, and George Lake is a good resource for understanding SPH with a variable timestep.[Edited by - KulSeran on June 12, 2006 7:49:12 PM];  I edited that fluids chapter for the book Game Programming Gems 6 (GPG6), and tweaked some of the chapter text prior to publication. Its an okay-but-not-great chapter, and I wouldn't suggest buying the book just for any one chapter. The GPG6 chapter references another article that is more of a solid background in SPH. The chapter discusses how to implement fluid interaction with rigid bodies that might be affected by---and affect---the fluid. And the author had intended this idea to be the focal point of the chapter. The code referenced by KulSeran is exactly the same code from that chapter---maybe a slightly later version. Its kind of university-quality/quick-and-dirty code---not professional quality and not necessarily easy to read (students don't often have time to make the most polished code), but does work as advertised for at least some test cases.I actually would suggest that the other fluids chapter in GPG6 is a very good chapter, Erin Catto's discussion of exact buoyancy for polyhedra. You can get some really neat fluid-like effects---arbitrary objects bobbing around and floating as though they were in a pool or bathtub or the ocean---without doing any actual fluid simulation. And Erin's presentation is very straightforward.   ;  grhodes:Thanks for the confirmation that Catto's article is pretty good. I thought his GDC presentation was pretty good, so I'll definetly check out the article. The Gems series has enough other useful information in it (I looked at the index, and there's a few other articles I thought looked interesting anyways).I was also interested in level set methods for simulating fluids, but from the information I've seen, those methods are not yet real-time, whereas low-scale SPH simulations are.   ;  You can do visual level set fluids in real-time, at least for the 2D case. The idea is this. Use a traditional gridded method of some sort to run the fluid simulation, such as Jos Stam's famous stable fluids approach. The results, say the scalar density, can be stored in a texture---immediately ready to draw on the surface of a quad. Now...the way you do the real-time "level set" extraction is to first choose an appropriate tone mapping approach. Make sure you color the texture to something meaningful and interesting for your visual. Next, use a texture with alpha. Set alpha to 0 every except where density is around a certain value. In that case, set alpha to 1. Do this per-pixel while you are storing off the result. A low-cost addition. That'll get you an image-space isocurve with arbitrary topology, which is what you get from traditional level-set methods. You don't get actual mesh geometry, but perhaps you don't need the geometry anyway? If time, you might want to post-process to smooth the resulting image---avoiding having an aliased isocurve.   ;Quote:Original post by grhodes_at_workYou can do visual level set fluids in real-time, at least for the 2D case. The idea is this. Use a traditional gridded method of some sort to run the fluid simulation, such as Jos Stam's famous stable fluids approach. The results, say the scalar density, can be stored in a texture---immediately ready to draw on the surface of a quad. Now...the way you do the real-time "level set" extraction is to first choose an appropriate tone mapping approach. Make sure you color the texture to something meaningful and interesting for your visual. Next, use a texture with alpha. Set alpha to 0 every except where density is around a certain value. In that case, set alpha to 1. Do this per-pixel while you are storing off the result. A low-cost addition. That'll get you an image-space isocurve with arbitrary topology, which is what you get from traditional level-set methods. You don't get actual mesh geometry, but perhaps you don't need the geometry anyway? If time, you might want to post-process to smooth the resulting image---avoiding having an aliased isocurve.Thanks for the info. I've already implemented Stam's fluid solver (he gives a pretty good explanation), so I'll think I try the level set route. Sounds like parts of the computations would be suited for the GPU, but I'll would worry about that after I have a CPU version working.I'm thinking of using the marching cubes algorithm for rendering the fluid. That should take care of problem of not having the mesh geometry, right?   ;Quote:Original post by wyrzyQuote:Original post by grhodes_at_workYou can do visual level set fluids in real-time, at least for the 2D case. The idea is this. Use a traditional gridded method of some sort to run the fluid simulation, such as Jos Stam's famous stable fluids approach. The results, say the scalar density, can be stored in a texture---immediately ready to draw on the surface of a quad. Now...the way you do the real-time "level set" extraction is to first choose an appropriate tone mapping approach. Make sure you color the texture to something meaningful and interesting for your visual. Next, use a texture with alpha. Set alpha to 0 every except where density is around a certain value. In that case, set alpha to 1. Do this per-pixel while you are storing off the result. A low-cost addition. That'll get you an image-space isocurve with arbitrary topology, which is what you get from traditional level-set methods. You don't get actual mesh geometry, but perhaps you don't need the geometry anyway? If time, you might want to post-process to smooth the resulting image---avoiding having an aliased isocurve.Thanks for the info. I've already implemented Stam's fluid solver (he gives a pretty good explanation), so I'll think I try the level set route. Sounds like parts of the computations would be suited for the GPU, but I'll would worry about that after I have a CPU version working.I'm thinking of using the marching cubes algorithm for rendering the fluid. That should take care of problem of not having the mesh geometry, right?i believe using surface particles (surfels) is a more common technique.   ;Quote:Original post by Eelcoi believe using surface particles (surfels) is a more common technique.Thanks, I'll look into it. From some quick looking around on the internet, it seems surfels are more suited for real-time applications. Do you happen to know of any introductory papers / web resources on surfels. Wikipedia doesn't seem to have a page on it, so I'm guessing the technique is new/slighly undocumeted.   ;Quote:Original post by wyrzyQuote:Original post by Eelcoi believe using surface particles (surfels) is a more common technique.Thanks, I'll look into it. From some quick looking around on the internet, it seems surfels are more suited for real-time applications. Do you happen to know of any introductory papers / web resources on surfels. Wikipedia doesn't seem to have a page on it, so I'm guessing the technique is new/slighly undocumeted.google 'Point Based Animation of Elastic, Plastic and Melting Objects' for a start. its an interesting read anyway.   ;Quote:Original post by wyrzyThanks for the info. I've already implemented Stam's fluid solver (he gives a pretty good explanation), so I'll think I try the level set route. Sounds like parts of the computations would be suited for the GPU, but I'll would worry about that after I have a CPU version working.Be wary of his actual code though. It's *horribly* unoptimized. You can quadruple the performance of the solver without changing more than a few lines of code. Using a few more advanced tricks, you can probably double performance again on top of that. (And yes, these numbers are based on my own results)   