# Rendering Fluid Simulations?

I've read about Lagrangian and Eulerian fluid simulations and here's what I take from their methods:

1. Lagrangian - Simulating fluid particles by calculating displacement for each particle
2. Eulerian - Simulating fluid particles by calculating interactions between finite spaces containing group of fluid particles.

(?) Do each method have different rendering technique suitable for it?

My guess is that you can take the finite space or 'voxel' data for Eulerian simulation, but I would like an expert's say in my hypothesis.

(?) Also regarding MPM (Material Point Method) which is a hybrid of both worlds, if Lagrangian and Eulerian sims does have different rendering technique, does it mean that I can use either techniques?

• There is no one way. Also is this a liquid or gas? With liquids we often try to acquire a polygonal surface through something like marching cubes. For gasses volume rendering is more common. Then there are completely different techniques like screen space fluids. The list goes on and on. For MPM you're free to use either but often background grids are much coarser than the particles themselves Commented Dec 10, 2018 at 18:40
• Have a look at Cubical Marching Cubes --- a good alternative to MC when visualising liquids. Commented Dec 11, 2018 at 10:26

Here's a more complete answer from the extent of my knowledge. A sort of brief overview you can google more about. I'm sure I didn't cover all the different techniques but most branch off the mentioned ones. Note: if it's a liquid we are more concerned with getting an accurate surface representation.

• Surface Extraction Methods: The most common way would be to rasterize the particles into a 3d image/grid using a basis function, unless they're already in a grid. Then extract the polygonal surface from the image using marching cubes or some variant of it. Then render that polygon. There are some methods to extract polygonal surfaces directly from particles without rasterizing.

• Ray Marching with an Implicit Surface: Again we rasterize the particles into an image but quickly convert into an implicit surface in our 3d image then ray march render the implicit surface, very fast.

• Splat Volume Rendering (doing it in screen space): Splatting is good for visualizing extremely large datasets and used to be used a lot for volume rendering because of how fast it is. Basic idea is to rasterize all or most points as discs from the volume. You can do many effects, lighting, etc. Nvidia's screen space fluids is a form of this (SSF). Simple, fast, quality is acceptable for many cases.

• Slicing/Texture Based Volume Rendering: Here we overlay 2d semi transparent images. You can just overlay some precomputed textures on various particles or compute a series of sliced 2d images a set distance apart in the 3d image/volume given the camera angle. More expensive. Gives better results than splatting.

• Ray cast Volume Rendering: Similar to ray marching, we march along the ray from every pixel but instead of looking for an implicitly defined surface we sample the volume directly and map it too color and transparency then composite it back along the ray. For lighting we can do it similar to surface based rendering but use the gradient of the image as the normal. There are many other tricks.

• Ray traced Volume Rendering: Basically the same as the ray casting but we bounce the rays around inside of the volume. They're distributed according to a phase function. I'm sure all the clouds in your favorite animated movies were rendered this way. Disney did this for their MPM simulated Snow in Frozen. The ray tracing approach is the most expensive of all of them, more expensive then surface based ray tracing. Not for real time as of writing this.

Note: The first two methods aren't for gasses. The last 3 are best for gasses due to their lack of surface representation.

I think it's also worth noting the value of having a stored representation for post processing effects. For manual deformations or effects by an artist. Procedural effects like spray, foam, bubbles, etc. Or just some extra geometric processing (smoothing or whatever).