Description

A crash occurs when using ray tracing with spline meshes preceded by the following ensure :

Ensure condition failed: NumCPUVertices <= VertexBufferNumElements  File: Engine\Source\Runtime\Renderer\Private\RayTracing\RayTracingDynamicGeometry.cpp [Line: 310]

Vertex buffer contains 503 vertices, but RayTracingDynamicGeometryConverterCS dispatch command expects at least 3670051.

Taking a look at FRayTracingDynamicGeometryCollection::AddDynamicMeshBatchForGeometryUpdate and the MeshBatch *from *UpdateParams *that is failing, shows garbage numbers in *MeshBatch.Elements[0].MaxVertexIndex and MeshBatch.Elements[0].MinVertexIndex. This explains the assert, but not the why. The piece of code responsible for creating this mesh batch is FSplineMeshSceneProxy::GetDynamicRayTracingInstances.

The LodModel.sections and LODModel data don't appear to be correct and *MeshBatch.Elements[0] *can be left in an uninitialized state leading to garbage values in MinVertexIndex and MaxVertexIndex.

A workaround is to default initialize MeshBatch.Elements[0] and use the sum of all the section vertex ranges.

Steps to Reproduce

n/a

Using the asset in a vanilla template project didn't repro the crash.

Callstack

Editor_Core!UE::Assert::Private::EnsureFailed+0x75 [Engine\Source\Runtime\Core\Private\Misc\AssertionMacros.cpp@826]
Editor_Renderer!FRayTracingDynamicGeometryCollection::AddDynamicMeshBatchForGeometryUpdate+0xE7B [Engine\Source\Runtime\Renderer\Private\RayTracing\RayTracingDynamicGeometry.cpp@310]
Editor_Renderer!RayTracing::FDynamicRayTracingInstancesContext::Finish+0x277 [Engine\Source\Runtime\Renderer\Private\RayTracing\RayTracing.cpp@573]
Editor_Renderer!RayTracing::AddDynamicInstancesToRayTracingScene+0x224 [Engine\Source\Runtime\Renderer\Private\RayTracing\RayTracing.cpp@1636]
Editor_Renderer!RayTracing::FinishGatherInstances+0x510 [Engine\Source\Runtime\Renderer\Private\RayTracing\RayTracing.cpp@1720]
Editor_Renderer!FDeferredShadingSceneRenderer::Render+0x2E37 [Engine\Source\Runtime\Renderer\Private\DeferredShadingRenderer.cpp@1813]
Editor_Renderer!RenderViewFamilies_RenderThread+0x5C6 [Engine\Source\Runtime\Renderer\Private\SceneRendering.cpp@5431]
Editor_RenderCore!UE::Core::Private::Function::TFunctionRefBase<UE::Core::Private::Function::TFunctionStorage<1>,void __cdecl+0x29 [Engine\Source\Runtime\Core\Public\Templates\Function.h@470]
Editor_RenderCore!UE::Core::Private::Function::TFunctionRefBase<UE::Core::Private::Function::TFunctionStorage<1>,void __cdecl+0x23 [Engine\Source\Runtime\Core\Public\Templates\Function.h@470]
Editor_RenderCore!TFunctionGraphTaskImpl<void __cdecl+0x23 [Engine\Source\Runtime\Core\Public\Async\TaskGraphInterfaces.h@1710]
Editor_RenderCore!TFunctionGraphTaskImpl<void __cdecl+0x2A [Engine\Source\Runtime\Core\Public\Async\TaskGraphInterfaces.h@1703]
Editor_RenderCore!TGraphTask<TFunctionGraphTaskImpl<void __cdecl+0x4F [Engine\Source\Runtime\Core\Public\Async\TaskGraphInterfaces.h@634]
Editor_Core!UE::Tasks::Private::FTaskBase::TryExecuteTask+0x102 [Engine\Source\Runtime\Core\Public\Tasks\TaskPrivate.h@504]
Editor_Core!FBaseGraphTask::Execute+0x8 [Engine\Source\Runtime\Core\Public\Async\TaskGraphInterfaces.h@482]
Editor_Core!FNamedTaskThread::ProcessTasksNamedThread+0xB3A [Engine\Source\Runtime\Core\Private\Async\TaskGraph.cpp@779]
Editor_Core!FNamedTaskThread::ProcessTasksUntilQuit+0xCE [Engine\Source\Runtime\Core\Private\Async\TaskGraph.cpp@668]
Editor_RenderCore!RenderingThreadMain+0x13C [Engine\Source\Runtime\RenderCore\Private\RenderingThread.cpp@325]
Editor_RenderCore!FRenderingThread::Run+0x54 [Engine\Source\Runtime\RenderCore\Private\RenderingThread.cpp@451]
Editor_Core!FRunnableThreadWin::Run+0x6D [Engine\Source\Runtime\Core\Private\Windows\WindowsRunnableThread.cpp@159]
Editor_Core!FRunnableThreadWin::GuardedRun+0x6F [Engine\Source\Runtime\Core\Private\Windows\WindowsRunnableThread.cpp@79]
kernel32!BaseThreadInitThunk+0x1D
ntdll!RtlUserThreadStart+0x28

Have Comments or More Details?

There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-241524 in the post.

0
Login to Vote

Unresolved
ComponentUE - Graphics Features - Ray Tracing
Affects Versions5.5
Target Fix5.6
CreatedJan 31, 2025
UpdatedFeb 1, 2025
View Jira Issue