$0+

Niagara - Damage Mask

4 ratings
I want this!

Niagara - Damage Mask

$0+
4 ratings

Unreal SceneCapture alternative using Niagara for rendering damage mask or basically any object space rendering.

There are 2 variants of the setup
PerVertex System which evaluates the Niagara simulation stage for every vertex in the mesh.
This results in lower memory usage and faster rendering times at the cost of quality.
PerPixel System which evaluates the logic per texel in UV map and the quality scales with texture resolution. This can get a bit expensive :)

PerVertex System
The Only thing worth mentioning about the per-vertex setup is the way UVs are baked. Instead of using a lightmap style UV the vertex UVs contain vertex indices. This allow us to index into render target without any resolution constraints (we use a fixed size render target to get the best quality results)
sudo code for calculating uvs (baked in DCC)
textureWidth = ceil(sqrt(numVertices))
uvX = vertexIndex % textureWidth
uvY = 1 - vertexIndex / textureWidth //unreal flips Y coordinate


PerPixel System
Per-pixel setup uses familiar lightmap style UVs (non overlapping UVs).
In order to accelerate the rendering stage we cache some data.

(A) BuildUVMap module initializes the acceleration structure for querying triangle data using UVs. This usually requires a frame delay before we can access the data. This is handled using module B.
The input to the module is the UV channel we would like to use with mask generation.
(B) TriggerOnFrame module manages a flag used by module C to cache the triangle coordinate data as this requires a frame delay from when we call BuildUVMap
(C) CacheTriCoordMap module stores the triangle coord data for every texel in the UV map. This is used in the render pass to accelerate tri coord data lookup.

Issues:
At the moment there is a compilation issue related to staticmesh data interface which is encountered in the per-vertex setups.
Niagara team is aware of the issue and will submit a fix in next release. In the meantime you can follow these simple steps to fix it locally (doesn't require code compilation)

  1. Navigate to "Engine\Plugins\FX\Niagara\Shaders\Private\NiagaraDataInterfaceStaticMeshTemplate.ush" and add a new line at the end of the file.
  2. Restart editor.
  3. "Full Rebuild" the Niagara system.

Requirements:
Unreal Engine version 5.1.0 Preview 2

$
I want this!

Niagara system

License
MIT
Copy product URL

Ratings

5
(4 ratings)
5 stars
100%
4 stars
0%
3 stars
0%
2 stars
0%
1 star
0%