Hi everyone,
I wanted to share an open-source tool I’ve developed for Unreal Engine: Niagara Destruction Driver
The Problem: Chaos Fracture tools are great for creating destructible geometry in the editor, but the chaos physics runtime can be too expensive on the CPU to drive a lot of cosmetic destruction of props in your scene.
The Solution: Niagara Destruction Driver turns CHAOS destructibles (Geometry Collection assets) into very performant GPU simulated destructible static meshes driven by Niagara particles.
SETUP
On the master material you use for props that want to use with this plugin enable Use Material Attributes , and then add the MF_NiagaraDestructible
Material Function and set it up with the NiagaraDestructionDriver_Enabled
static switch as shown below:
more info in the github README
USAGE
STEP 1 - Select a Geometry Collection in the editor. (NOTE: it should have only one level of geometry chunks due to current plugin limitations). Right Click and run Create Niagara Destruction Driver
from the menu to generate the destruction driver blueprint and backing assets (destruction data asset, initial bone location texture, and the static mesh with custom UVs to drive the GPU simulation.
STEP 2 - Initiate destruction force in C++ or Blueprint using the static function:
more info in the github README
FAQ
- Why do I need to add the material function? … All of the destruction is driven by a shader vertex offset (WPO) so unfortunately you need to wire this up in the master prop material you plan to use in your game.
- Why do I need the
NiagaraDestructionDriver_Enabled
static switch in my material? … We don’t need all the shader code to be active for all your props. This plugin generates Material Instance assets for the destructibles generated, and on those instances it sets the static switch to TRUE so the vertex shader code only runs for props that are processed by this plugin. - Is any of this replicated? … No. For a poor man’s solution just use and RPC and call
InitiateDestructionForce
on all clients/servers/etc. - Can I generate destructibles at runtime? … No. The underlying engine code required to process the geometry collection is editor only.
- Can you trace for collisions for the destroyed fragments? … No. The fragments are animated using vertex offsets (WPO) in a shader. This system is intended for cosmetic destruction like wall surfaces and small props. In a future update we could allow this system to drive smaller chunks of a CPU driven chaos geometry collection where the larger chunks with collision etc. still work.
- What’s the point? Just use CHAOS destruction. … Niagara driven destructibles are more performant.
- Why did you make this? … We developed a houdini driven prototype of this tech when I was CTO at Counterplay Games. Two very talented tech and VFX artists (see acknowledgments) built that version. This is a clean room re-implementation of that system with a number of optimizations and that does not require houdini.
- I’m getting weird floating pieces in my destructibles? … Make sure to use the TinyGEO tool in Chaos Fracture tools to merge tiny geometry to it’s neighbors.
Under the Hood
Under the hood the plugin uses a niagara system to simulate the physics of the fragments (bones) on the GPU, write their transforms to render targets, and finally a vertex shader to constrain the vertices of a specific fragment to its respective bone using the render targets.
Special Thanks
- James Sharpe
- Milan Malata
- Alan Lee
- Joshua Carlos
Next Steps
- There’s a rough roadmap up on the github README.
- Hit me up on x.com/eanticev if you’d like to contribute.