I’m using Niagara with the Mesh Renderer where I have multiple mesh variants in the array. I select one randomly on particle spawn using the MeshIndex. Everything works fine but when I switch to Pathtracer, I get this error:
Error: Ensure condition failed: InstanceDesc.InstanceId <= 0xFFFFFF [File:C:\unreal\git\upp-unrealengine\Engine\Source\Runtime\Renderer\Private\RayTracing\RayTracingInstanceBufferUtil.cpp] [Line: 316]
Error: InstanceId must fit in 24 bits.
Error: [Callstack] 0x00007ffe6def872b UnrealEditor-Renderer.dll!`WriteInstanceDescriptor'::`2'::<lambda_1>::operator()() [C:\unreal\git\upp-unrealengine\Engine\Source\Runtime\Renderer\Private\RayTracing\RayTracingInstanceBufferUtil.cpp:316]
Error: [Callstack] 0x00007ffe6d722fea UnrealEditor-Renderer.dll!WriteInstanceDescriptor() [C:\unreal\git\upp-unrealengine\Engine\Source\Runtime\Renderer\Private\RayTracing\RayTracingInstanceBufferUtil.cpp:317]
Error: [Callstack] 0x00007ffe6d6c5f2f UnrealEditor-Renderer.dll!`FillRayTracingInstanceUploadBuffer'::`2'::<lambda_1>::operator()() [C:\unreal\git\upp-unrealengine\Engine\Source\Runtime\Renderer\Private\RayTracing\RayTracingInstanceBufferUtil.cpp:481]
Error: [Callstack] 0x00007ffe6d6dfab7 UnrealEditor-Renderer.dll!FRayTracingInstanceBufferBuilder::FillRayTracingInstanceUploadBuffer() [C:\unreal\git\upp-unrealengine\Engine\Source\Runtime\Renderer\Private\RayTracing\RayTracingInstanceBufferUtil.cpp:969]
Now, the level is empty and there’s nowhere near 16 mil particles in the scene (I’ve checked using the Niagara debugger) so I assume Niagara takes ParticleNum * MeshVariants from the Raytracing instance buffer. I’ve tried using just a single mesh variant with the same amount of particles and the numbers seem to support that (looking at the Raytracing total instaces in stat SceneRendering).
Related to that, I’d also like to know whether the InstanceId Buffer doubles/triples when rendering with Temporal samples, possibly causing some particle culling as well.
I’ve attached an example scene. If you open the Niagara asset, disable the MeshIndex module and switch the two Mesh Renderer modules, you should be able to compare the results.
testNiagara.zip(92.9 KB)