The use of vector fields to set particle velocity is pretty well documented when one is using cascade, but Niagara is still something of a mystery for many users.
Vector fields are indeed supported, using the same .fga format, and their capabilities in Niagara are extended in a number of key ways. In Cascade a vector field can only influence velocity directly, but in Niagra support is built in to just as easily use the field to drive acceleration, which can result in a much smoother and more natural motion.
Furthermore, Niagara’s open approach to, well, everything, allows users to dig in and perform much more advanced effects. With custom modules and a bit of hacking it’s possible to blend between multiple vector fields for instance, or use a vector field to control any attribute such as size or rotation of particles. Epic and Unreal have provided us a playground with a ton of potential.
Here’s an example which barely scratches the surface, but should be enough to get anyone reading a head start into using vector fields in Niagara. In this very straightforward effect a vector field is used to break up the usually spherical shape of a bunch of particles emitted from a sphere by varying their velocities. The result is a more irregular, jagged blast of particles which looks much more natural than a simple firework, and for almost no extra effort.
All that was done was to place two pre-made modules in the “particle update” region.
The “Sample Vector Field” module specifies the vector field to be used (in this case one of hundreds which I am releasing on Unreal Marketplace, but note there are free vector fields both in Niagara and here on this site). It also has some very nice advanced options allowing you to scale and transform the vector field, fade out the influence by distance and so on.
Then the “Apply Vector Field” follows immediately and applies a considerable amount of velocity to the particles every frame. Bang, a nice irregular shaped explosion. That’s really it.
To control the effect to a greater degree I took things one (small) step further and created a custom module. I had some particles which were slowing almost to a stop, so I first wrote a simple logic which kills any particle below a user-defined minimum velocity. This however killed some slow particles at the beginning of the explosion I liked, so I added a factor which accumulates a value proportional to the particle’s age (Particles.AccumulatedDeltaTime thanks to a GDC presentation 2018) and used that to specify a user time threshold after which particles could be killed. Here’s a look at the graph:
I could have just as easily tweaked the vector field’s falloff to free up the offending particles, but this custom module is now saved and ready to go any time I need it. SWEET.
Niagara looks daunting at first, but it’s really very logical and straightforward, and allows for very deep customization. Vector fields are supported nicely, and have far greater potential under Niagara than the simple implementation in cascade. So don’t hesitate, dive in!