NVIDIA Cataclysm Realtime Liquid Solver

Hey Folks,

I’m the lead developer on Cataclysm. Let me answer some questions I saw here.

  1. Cataclysm is Win10 only. Currently, this is due to our use of Volume Tiled Resources, the 3D version of Tiled Textures for which support was added in D3D11.3.
  2. Cataclysm is an R&D experiment and not a supported product.
  3. It was developed on a Titan X, and later on a 1080 GTX. Any timing I may mention is on my 1080.
  4. I added a map I used in development to the github project, and updated the Getting Started section of the README. I do not know when I will be able to release the maps seen in the video, but I am working on it. The Dev/SingleEmitter map has some good settings on the FLIP Domain, and I have the particles set up with a lifetime that should keep them at around 2M after the sim runs a while. With 2M particles I get about 45fps on that map. It’s also clear from that map the tricks I use to make the solid boundaries thick enough to hold water, and to make sure all their scales are constant. With a stable emitter, the simulation explosions are usually due to the solid boundaries being too thin and causing pockets of air and strange collisions (sometimes due to the use of non closed meshes), or from non uniform scaling on the geometry.
  5. If you want to turn VTR off, and try to figure out how to get this running on earlier version of windows, you should set USE_FAKE_VTR to 1, and you will probably want to set USE_SMALL_DOMAIN to 1, and LS_MULTIPLIER to 1 which will save a lot of memory when not using VTR. After that, you will have to update the RHI so that it uses an earlier D3D version. Sorry, there are no current plans to make Cataclysm work on an OS other than Win10 TH2, which is what I develop on.

Thanks for your interest. And thanks to my boss for letting me open source this experiment!

1 Like

Thanks bro! that’s awesome! I’ve got a solid 24fps on my Clevo P650RG-G 980m! look super sweet! have a game in mind for this!

Quick question… is there a way of inferring the ‘weight’ of the particles in any given volume?

chur!

Jamie

Hey Jamie,

That’s good news about the 980, I have not tested Cataclysm on that. There are some things you can do to speed up the simulation. If you are ok with the grid crawling artifacts, you can set LS_MULTIPLIER to 1 instead of 2. That will save some. You may also want to play with the life of the partilces so there are not 2M in there, or lower the rate in cascade so less come out (there is a careful balance between how many particle appear per voxel and how well the simulation behaves, so be aware of that, see answer #3 below).

There is a complex answer to that, and the question can be interpreted in a few ways, so bear with me.

  1. If by weight, you mean you want some particles to float, and some to fall faster, then yes. On a per-emitter basis, you can change the Const Acceleration module on the emitter in cascade. In fact using the cascade to change around the attributes is one of the great powers of Cataclysm. The image below shows two emitters. The emitter on the right has the a slight leftward acceleration added, it’s particles are going toward the wall like gravity has changed. For the emitter on the left, I decreased the acceleration down by an order of magnitude, and added som edo the right, so those particles stay in the air longer and rush to the right. So each emitter has it’s own gravity, and that is taken into account in the simulation, the same way other cascade particle attributes are for GPU particles.

  2. If by weight you mean, you have 10 particles in a voxel and you want 1 to affect the velocity more then the other 9, then no, all the particles have the same weight in that sense. However, Cataclysm sees all the per particle attributes that Cascade passes to the GPU particles. So if you wanted to take over one of those and use it as a weight you may be able to do that. You could also add your own per-particle attribute in ParticleGPUSimulation.cpp. Similar to how class FParticleStateTextures has RandomSubImageTexture, or if you just want it for the liquid you would add it to class FLiquidParticleStateTextures similar to FLIPVelocityTexture. Then, you could access it inside FluidVelocityToGrid.usf the same way VelocityTexture is used but use it as a weight that blends with the normal distance weighted contribution.

  3. If by weight you mean how much mass a particle has then the short answer is that FLIP particles have no mass, and they are only used as tracer particles to define the volume in the voxel grid to simulate. So you can’t really make them heavier in that sense. However, for FLIP to work well, you really want to have more than one particle per voxel contributing. 8 particles per voxel is a common target in research papers, and 4 seems to work good. Anything above MAX_SPLAT_COUNT (defaults 12) will be ignored for velocity/smooth density/surface contribution (that trick is specific to Cataclysm, and not normal FLIP behavior). You can see how large the grid voxels are by using the console variable Fluid.ShowBricks 1. When you do that, you will see the walls of the max domain outlined in red, and you will see in the center a brick in green, and a set of 8 voxels in purple.
    GridSize.jpg
    The splat radius for the velocity is fixed. So each particle is guaranteed to contribute it’s velocity to a voxel. But if you lower the Smooth Kernel Radius (which defines the liquid domain if Surface At Density is > 0) of the Particle Radius(which defines the liquid domain ifSurface At Density<= 0), your particle will have less affect on the simulation and you will get less liquid volume. For less visual volume, separate from the simulation volume, you can lower theRadius Multiplier` which only affects the rendered liquid surface.

I hope that answers your question. If not, please ask again in a different way :slight_smile:

I had an e-mail with a couple questions I want to post the answers to here, because it may help others while we wait for me to release the other maps. I rephrased the questions, and removed any names, but the gist is this:

To answer your question, there are two types of liquid domain generation, which is the basis for the rendered liquid surface:

  1. If Surface at Density is Positive, Cataclysm extracts a levelset at the value Surface at Density from a smooth density field created from particle splatting, where each particle has a radius of Smooth Kernel Radius (in units of Voxel Width, so the default radius of 2 would splat up to 4 voxels wide, you can see the kernel used in FluidDensityToGrid.usf). Shrinking the Smooth Kernel Radius to 1.5 may help, but will give you less liquid volume, and I have noticed some different results with Use Density Velocity Stretch on, which will make velocity anisotropy on during the density splat… the differences are subtle and for me not worth the increased work. Your millage may vary.

  2. If Surface at Density is <= 0, Cataclysm extracts a levelset from sphere splatting with radius Particle Radius (also in voxel units). This can be a more complex surface, and for liquid domain, there may be too much surface noise for a nice solution so Cataclysm uses abs(Surface at Density) to cull out particles with a density below that. The noise problem will look like loose particle floating on the surface and causing cottage cheese looking floaties (technical language, I love it).

Those two techniques are only for generating the liquid domain. Which controls how the simulation moves, and is the start levelset for the rendered liquid surface. If you want to get rid of that simulation surface before you create the rendered liquid surface for display, you can set the Surface Offset to a high number which will basically delete the entire liquid domain and build the rendering surface from scratch, instead of union-ing it with the liquid domain first. After starting with the offset liquid domain, the rendered liquid surface is always built with the sphere levelset splatting technique with a radius of Particle Radius x Radius Multiplier. Since LS_MULTIPLIER defaults to 2, Cataclysm is actually rendering at twice the surface resolution from the simulation, which gives you a detailed surface even with smaller radius multiplier (too small and particles may pass between voxels instead of rasterize too them). But if you always start with a smooth liquid domain, and don’t offset it, then all the extra detailed may be buried inside the start surface and never seen.

Anyway, getting a detailed surface is difficult and we never settled on the perfect solution. You could run the simulation, skip building the high resolution levelset for rendering, and render the particles in an entirely new way.

To get diffuse particle foam, like the ones used in the city, you have to have the Enable Diffuse Particles box checked. That’s an entirely different simulation for visuals only and won’t affect the liquid flow. You can see how that is done in FluidDiffuseParticles.usf. I’ll include the settings we use for the city scene for you, but since those are all far away camera, I’m not sure they will give you what you need. It may take time and tweaking to get good settings, and maybe even some code changes to get good looking foam.

Thanks for the responses to our questions ! That helped quite a bit… definately clarified a bunch of issues for us. Working great so far now

The Art content for Cataclysm is now available on github.

Thanks that was above and beyond the answer I was expecting… I’m sure this will help out enormously… I was looking to implement water based puzzles where a body of water drives rising or lowering floating land masses… either through draining or filling a volume…

I managed to get the sample running on a 1070 and curiously the framerate is the same as if I ran it on my 980m laptop!

Thanks again for supporting the community

Jamie

Cataclysm does have trigger boxes that let you know CPU side when liquid is inside of them. You may also want to use a Fluid Velocity And Kill Field (which is poorly named because it no longer stamps velocity into the grid) to kill any particles that are outside your area of interest and avoid the extra computation on and memory for any leaking liquids. All the art levels use these kill fields to control the flow.

Hey guys would love to grab that demo map…I am still pretty noob at the whole github thing…do I have to recompile the whole engine to get the map? I try to sync in github desktop and it can never find my .git and my commits never seem to merge. Any tips would be greatly appreciated!

Cataclysm is a new engine, so yes, you must compile it to see liquid. If you can get the generic 4.12.5 engine compiling with Development Editor for Win64, then you should be able to use that as a starting point and pull the Cataclysm code into that branch. Then do a clean build.

I would suggest making a local repository getting the 4.12.5 branch and running the setup.bat file to get all the files you need to build the engine. Then you can use that as the base for the CataclysmDemo branch and pull the new engine in. running setup.bat after getting the CataclysmDemo branch may overwrite some nvapi binaries that are newer in Cataclysm then they are in generic unreal. Anyway, the important thing is, if you can get generic 4.12.5 compiling then I hope you will have no problem getting CataclysmDemo up and running.

You mentioned commits and syncs. You should not have to do any commits, just pulls to get the code. As a side note, any commits you do to your local repository won’t show up in the remote branch unless you push them to it.

Good luck,

Maybe this will help: Setting Up Your Development Environment for C++ in Unreal Engine | Unreal Engine 5.3 Documentation

1 Like

Dang. It’s gone…

I’m getting this prompt when running Setup.bat. Should I choose Y or N?

Probably. I really only ran setup once in the beginning and then developed in the same workspace so I never had to worry about it again.

You do not want to overwrite those settings so you should pick no. If you pick yes the changes that NVIDIA made will not be applied.

Does this solver work with AMD GPUs? I had thought so since it uses DX11 compute shaders instead of CUDA, but I can’t see any SPH particles on my HairWorks/Cataclysm merged branch. This problem persists even in the Cataclysm demo maps.
My specs are:
CPU: Intel Core i7 4790k @ 4.8 GHz
GPUs: XFX Fury X CrossFire @ 1175/575 MHz
RAM: 32 GB G.Skill Ripjaws X DDR3 2400 OC’d to 2600 MHz
Mobo: MSI Z97 Gaming 5
PSU: Corsair HX1200i
SSD: Samsung 950 Pro 512 GB

P.S. I am using Windows 10.

why are all the links dead to the cataclysm branches on github? could someone re-up?

Nvidia doesn’t hurry to implement their fluid simulation features like Flow and I really don’t understand why this great Cataclysm fluid solver doesn’t have further implementation. We have really powerful GPUs but still see a very rough 2d sprite based visual effects in each new game. It is very sad situation.

Hi, how do you get the Art Content Cataclysm Demo to work? When I try to open the project after I unzip the folders, it shows this: