Cached/baked fluid sim as in-game triggered FX?

I came across this clever tutorial that uses a niagra fluid explosion on projectile impacts. https://youtu.be/STM33pJIAZE?si=M5vAZQ00bbeAXoVZ
I’m wondering if there’s a way to cache this simulation so it can be more optimized for in-game use like this where it get triggered on projectile impacts. (Yes, I know it will be too expensive, just humor me.)
If one wanted to optimize a baked 3d volumetric explosion for gameplay, how would they go about it?

  • Could a niagra sim be baked into a VDB, and that would help performance?

  • Does it make more sense to use a VDB created externally?

  • Can VDBs or cached fluid sims be used similarly to the effect in this tutorial with the orientation changing based on the normal?

  • Is it possible to blend or fade between 2 or more still VDBs to cheat like you have more frames in your VDB (similar to how can do that with a 2d flipbook by fading between frames)?

  • Could you cheat and turn a niagra sim or VDB into a flipbook-based volume texture?

Volumetrics are obviously the future of FX. So many questions!

Yes, you can bake Niagara simulations from within the editor.

  • Most performant will be a flipbook, which can be generated from the baker tab: Niagara Baker | Tutorial
  • Also from the baker you can instead save it as a simulation cache asset - this will save all the simulation data in a cache, so you’ll have the full sim at runtime. To get good perf here I’d try and sample at a low rate and then use interpolation option, that way you don’t have to save a lot of cache frames.
  • Similar to the baker, you can also save cached versions of a Niagara system with sequencer: Niagara Simulation Caching in Sequencer | Tutorial
1 Like

Thanks for the info! Can those cached fluid sims be triggered on projectile hits with the correct orientation (for example if your projectile hits a wall)? The only cached fluid demos I’ve seen have been in sequencer for cinematics.

Also that tutorial you linked was great. Do you know of any other tutorial that would help explain how to set up the multiple “top down” and “side” etc. flipbooks into a view angle dependant FX asset? So if the effect gets triggered if the player is ground level the “side” flipbook would play, and if the player is above the location of the effect the “top down” flipbook gets triggered etc…

You can set sim caches on Niagara components either from Blueprint or C++. Or you set them up in a sequence and them play the sequence instead of playing a Niagara system directly.

You can of course create flipbooks with different orientations and then if you want to play them use the direction vector from camera position to particle position to choose the right flipbook to play. Usually aligning the flipbook sprite with the camera plane is enough though.

1 Like

Could you please help how I can attache SimCache to Niagara component with Blueprint or C++? I cannot find a way to run that cache in my game

Ok. I’ve found a way. There is SetSimCache() function for Niagara component. It can be used to attache Baked cache to Niagara component.