Explicit State Particle System Prototype

It was difficult for me to bring over a particle/fluid effect, created in a DCC like Blender or Houdini, with all the detailed art-directed motion and volumetric properties left intact.

I decided to prototype an exporter that samples the effect from my DCC package and a particle system that lets me play it back in a realtime environment.

This is a standalone OpenGL demo, but I will be integrating it into the Unreal Engine after working out some more of the features:

The clip shows 94699 particles sampled at 60hz over 4.33 seconds, with per-particle variable lifespans & birth times, yielding 19,053,563 positions. The positions and attributes are packed into a texture used by shaders that move and render particles. If there’s enough interest, I can clean up the code a bit and post it on github.

Next up: adding little slices of color for each particle (these particles were advected through a shaded fluid sim), positions as deltas from previous positions (rather than final positions, to support external forces), and compression/optimizations.

How much space an effect takes up can be tuned by reducing the sampling rate, lifespans, and/or number of particles.

Cheers,

I can see this being super useful. To my understanding there is no way to import particle data, like from realflow or other software?

The closest thing I found was the ability to import vector fields, but those act as forces that each particle looks up based on its current position. The resolution is limited and if every particle has the same start point, it will travel the same path through the vector field.

Very cool! I think you are right that there is not a solution to directly drive the velocities, other than vectorfields which have the behavior you mentioned.

The closest other methods would probably be using the various Alembic cache options. In particular, the morph mode might work well here, since it requires a fixed vert count and gives smooth transitions. You could fake the ‘variable lifetime’ by scaling the particles to 0 that are no longer in the sim (similar to Norman Schaars method). The per frame vertex cache would probably look very choppy or require too many frames.

So since you are storing a complete copy of each particles motion I guess you are also able to blend between the N and N+1 frame to get a smooth result? If you have not seen Norman Schaars method I suggest looking it up for interesting reference if nothing else.

Right now I just get away with a high sampling rate, but yeah, the plan is to use some method of interpolation… Either letting texture filtering do the work, or using some manual numerical method in the shader if it isn’t too slow. A todo after I finish a decent method of texturing the effect.

I found an article on Norman’s work; a good read, there’s some really similar & helpful ideas in there. Thanks for the tip!

Sampled heat and density. Used only heat, for now, to color the effect. In Unreal, I would expose the arbitrary attributes I sampled/exported to the material for use in a shader blueprint. Here, it’s just a fragment shader.

Demo, complete with cheesy 90’s corporate HR video music:

Got a chance to make some more progress. Sampling at low frequencies is working!

The sampling frequency that should be used depends on how high the motion path’s curvature is and how quickly the particles are moving.

The interpolation is done simply by setting the magnification texture filtering to linear and sampling between the position sample pixels.

At 3 Hz you do start to see a bit of linear motion at the quick beginning of the explosion:

You can really cut down from the original 60 Hz sampling rate I was using and still have the sim look smooth, using a lot less memory.

A simpler effect showing different sample rates:

Really interesting, Subbed.

Reworked my particle system to send baked relative velocities (relative to accumulated velocity at the sample point) instead of absolute positions. Now I can do cool effects like gravity, increasing gravity over time, cutting off the baked data and letting the system settle with drag, and turbulent wind forces. This will actually make it easier to integrate into UE, since the sim shader there does a similar process of adding in velocities to get the final motion.

Hey guys! I took a little (astronomical units) break, but I finally sat down and implemented a fair amount of this in UE! It was pretty cool to learn how cascade works, although I’ll have to reimplement this once Niagara comes out. :-p

First test video, simple 8 particle explicit state system. The idea & implementation of the system in UE is similar to the prototype standalone version shown in the other videos.

Each particle goes through a precise, pre-calculated square motion, starting at arbitrary intial positions (along a diagonal in this case), and lives for 4 seconds. All attributes are per-particle and can be variable. You can see in the video that existing interactive unreal engine forces/modules still work on the particles as they move through their explicit state. While recording this demo, I realized I should also halt any kind of simulation, not just explicit state, while the particles are in an unborn state (burst spawn happens once at the beginning, less work for the cpu to do at arbitrary times).

Next up, some code cleanup, testing with a more interesting data set, and introducing per-particle custom attributes like heat/density for the shader blueprints to use.

Got Unreal Engine reading particle simulation data exported from Houdini using the file import and a new type of asset factory. Simple fireball effect, low number of particles (3,000) advecting through it. Demo also shows that existing modules still affect the particles. Still some tweaks to make as there are misplaced particles here and there…

An update with a few tricky bugs fixed… with a basic material effect applied. Recording the video dinged the framerate, but still fun to look at. :slight_smile:

Fixed a few more bugs. Motion can now be overlaid on top of regular unreal engine forces.

Made a few more interesting demos showing the effects playing in Houdini, then in unreal, then with additional unreal forces and collisions.

It’s awesome!