Particle Decals Mini Tutorial
The intention of these mini tutorials is to have easily searchable reference for implementations of some of the newer (or altered) features in Niagara.
While waiting for Epic to (pretty please) implement decal renderers, I thought I’d share a little trick to creating pretty convincing decals inside of Niagara. (kinda)
The goal is to use WorldPositionBehindTranslucency, which @imbueFX shared a few months ago, to recreate the behaviour of decals for translucent and additive materials.
Here’s the material we are going to be using
Essentially, We calculate the mesh particle localspace position, but unstead of using the position of the fragment we are drawing, we using WorldPositionBehindTranslucency to find the surface position behind it.
After that we scale and offset and saturate the uv’s to create one distinct tile of the texture. (you could also set tiling in the texture settings, instead of saturating)
We also calculate a zMask, allowing us to fade the decal in and out when it moves outside of the z-range of our decal.
- In the material settings, set Blend Mode to Translucent or Additive, and make sure the material doesn’t cull back faces.
- In the advanced Translucency settings, make sure to disable depth testing as well, otherwise we won’t be able to see our decal up close.
- Under Usage, Enable Used with Niagara Mesh Particles
- Create a new empty emitter and a mesh renderer.
- I also added an Update Mesh Orientation module to make my decal rotate over time
- In the Mesh Renderer Module, for Particle Mesh, use a cube with it’s pivot in the center.
- Also override the material of that cube to be our newly created material.
- Make sure Local Space is on in the Emitter Properties Module.
- In the Initalize Particle Module, we can use Mesh scale to scale our decal.
Please let me know if you don’t understand something, or if I made a mistake somewhere.