Description

A crash occurs when Nanite override material instance is used in a project with Ray tracing enabled where:

1 The Material assigned to the static mesh uses Deferred Decal / Translucent and the Nanite material override uses Masked / Surface

Common call stacks for the crash may include:

  • (during caching) FPrimitiveSceneInfo::CacheRayTracingPrimitives → CacheRayTracingPrimitive → CacheRayTracingMeshBatch → check(!bMustEmitCommand || CommandContext.CommandIndex >= 0)

    .

  • (during gather) RayTracing::GatherRelevantStaticPrimitives → FPrimitiveSceneInfo::GetRayTracingLODData(0) → TArray::operator[] → ...
  • (array OOB when
    RayTracingLODData

    is empty, i.e. Nanite RT commands were never generated).

In the clean repro, the crash also happens as soon as the mesh with the above material setup is viewed/loaded with RT+Nanite enabled.

It's possible the suspect the mesh gets classified by the base Deferred Decal domain, while the Nanite path tries to use the Override Surface material, leading to inconsistent flags and missing Nanite RT mesh commands, then an unchecked access occurs.

Steps to Reproduce

Option 1
Open the attached project and assign the M_BaseDecal_Inst material to the Nanite cube in the level

Option 2
1. In an existing project enable ray tracing
2. Make two materials:

  • Base:
    Domain = Deferred Decal

    ,

    Blend Mode = Translucent

    (any simple setup is fine). Used with Nanite - True.

  • Nanite:
    Domain = Surface

    ,

    Blend Mode = Masked

    (default lit, trivial graph). Used with Nanite - True.

1. Make material instances: Base_Inst (from Base) and Nanite_Inst (from Nanite).
2. In Base_Inst, set Nanite Override Material = Nanite_Inst.
3. Create a simple Static Mesh (e.g. default Cube). Enable Nanite on the mesh and set the mesh/component to be Visible in Ray Tracing.
4. Assign Base_Inst to the mesh/component.
5. Open the level (or open the mesh asset in the editor) with RT enabled.

Expected

The Nanite override material is used on the mesh and the Editor doesn't crash

Actual

The Editor crashes

Callstack

UnrealEditor-Renderer.dll!CacheRayTracingMeshBatch<TArray<FRayTracingMeshCommand,TSizedDefaultAllocator<32>>>(const FMeshBatch & MeshBatch, FPrimitiveSceneInfo * SceneInfo, TArray<FPrimitiveSceneInfo::FRayTracingLODData,TSizedDefaultAllocator<32>> & RayTracingLODData, TArray<FRayTracingMeshCommand,TSizedDefaultAllocator<32>> & Commands, FCachedRayTracingMeshCommandContext<TArray<FRayTracingMeshCommand,TSizedDefaultAllocator<32>>> & CommandContext, FRayTracingMeshProcessor & RayTracingMeshProcessor, FDeferredPrimitiveRayTracingData & OutDeferredData, bool bMustEmitCommand) Line 1137 C++
UnrealEditor-Renderer.dll!CacheRayTracingMeshCommands<TArray<FRayTracingMeshCommand,TSizedDefaultAllocator<32>>>(FPrimitiveSceneInfo * SceneInfo, const FRayTracingInstance & RayTracingInstance, ERayTracingPrimitiveFlags Flags, TArray<FRayTracingMeshCommand,TSizedDefaultAllocator<32>> & Commands, FCachedRayTracingMeshCommandContext<TArray<FRayTracingMeshCommand,TSizedDefaultAllocator<32>>> & CommandContext, FRayTracingMeshProcessor & RayTracingMeshProcessor, TArray<FDeferredPrimitiveRayTracingData,TSizedDefaultAllocator<32>> & DeferredDatas) Line 1224 C++
> UnrealEditor-Renderer.dll!FPrimitiveSceneInfo::CacheRayTracingPrimitives::__l18::<lambda_2>::operator()(FCacheRayTracingPrimitivesContext<TArray<FRayTracingMeshCommand,TSizedDefaultAllocator<32>>> & Context, int Index) Line 1299 C++
[Inline Frame] UnrealEditor-Renderer.dll!ParallelForImpl::CallBody(const FPrimitiveSceneInfo::CacheRayTracingPrimitives::__l18::<lambda_2> &) Line 74 C++
UnrealEditor-Renderer.dll!ParallelForImpl::ParallelForInternal<`FPrimitiveSceneInfo::CacheRayTracingPrimitives'::`18'::<lambda_2>,`ParallelForWithTaskContext<FCacheRayTracingPrimitivesContext<TArray<FRayTracingMeshCommand,TSizedDefaultAllocator<32>>>,TSizedDefaultAllocator<32>,`FPrimitiveSceneInfo::CacheRayTracingPrimitives'::`18'::<lambda_1>,`FPrimitiveSceneInfo::CacheRayTracingPrimitives'::`18'::<lambda_2>>'::`5'::<lambda_1>,FCacheRayTracingPrimitivesContext<TArray<FRayTracingMeshCommand,TSizedDefaultAllocator<32>>>>(const wchar_t * DebugName, int Num, int MinBatchSize, FPrimitiveSceneInfo::CacheRayTracingPrimitives::_l18::<lambda_2> Body, ParallelForWithTaskContext::_l5::<lambda_1> CurrentThreadWorkToDoBeforeHelping, EParallelForFlags Flags, const TArrayView<FCacheRayTracingPrimitivesContext<TArray<FRayTracingMeshCommand,TSizedDefaultAllocator<32>>>,int> & Contexts) Line 150 C++
UnrealEditor-Renderer.dll!ParallelForWithTaskContext<FCacheRayTracingPrimitivesContext<TArray<FRayTracingMeshCommand,TSizedDefaultAllocator<32>>>,TSizedDefaultAllocator<32>,`FPrimitiveSceneInfo::CacheRayTracingPrimitives'::`18'::<lambda_1>,`FPrimitiveSceneInfo::CacheRayTracingPrimitives'::`18'::<lambda_2>>(const wchar_t * DebugName, TArray<FCacheRayTracingPrimitivesContext<TArray<FRayTracingMeshCommand,TSizedDefaultAllocator<32>>>,TSizedDefaultAllocator<32>> & OutContexts, int Num, const FPrimitiveSceneInfo::CacheRayTracingPrimitives::_l18::<lambda_1> & ContextConstructor, const FPrimitiveSceneInfo::CacheRayTracingPrimitives::_l18::<lambda_2> & Body, EParallelForFlags Flags) Line 707 C++
[Inline Frame] UnrealEditor-Renderer.dll!ParallelForWithTaskContext(TArray<FCacheRayTracingPrimitivesContext<TArray<FRayTracingMeshCommand,TSizedDefaultAllocator<32>>>,TSizedDefaultAllocator<32>> &) Line 724 C++
UnrealEditor-Renderer.dll!FPrimitiveSceneInfo::CacheRayTracingPrimitives(FScene * Scene, const TArrayView<FPrimitiveSceneInfo *,int> & SceneInfos) Line 1313 C++
[Inline Frame] UnrealEditor-Renderer.dll!FScene::Update::__l391::<lambda_13>::operator()() Line 6358 C++
[Inline Frame] UnrealEditor-Renderer.dll!FRDGBuilder::AddSetupTask::__l2::<lambda_1>::operator()() Line 603 C++
UnrealEditor-Renderer.dll!FRDGBuilder::AddSetupTask<`FScene::Update'::`391'::<lambda_13>,UE::Tasks::Private::FTaskHandle &>(FScene::Update::__l391::<lambda_13> && TaskLambda, UE::Tasks::FPipe * Pipe, UE::Tasks::Private::FTaskHandle & Prerequisites, LowLevelTasks::ETaskPriority Priority, bool bCondition, ERDGSetupTaskWaitPoint WaitPoint) Line 612 C++
UnrealEditor-Renderer.dll!FScene::Update(FRDGBuilder & GraphBuilder, const FScene::FUpdateParameters & Parameters) Line 6356 C++
UnrealEditor-Renderer.dll!FSceneRenderer::OnRenderBegin(FRDGBuilder & GraphBuilder, const FSceneRenderUpdateInputs * SceneUpdateInputs) Line 4071 C++
UnrealEditor-Renderer.dll!FDeferredShadingSceneRenderer::Render(FRDGBuilder & GraphBuilder, const FSceneRenderUpdateInputs * SceneUpdateInputs) Line 1652 C++
UnrealEditor-Renderer.dll!RenderViewFamily_RenderThread(FRDGBuilder & GraphBuilder, FSceneRenderer * Renderer, const FSceneRenderUpdateInputs * SceneUpdateInputs) Line 4929 C++
[Inline Frame] UnrealEditor-Renderer.dll!FRendererModule::BeginRenderingViewFamilies::__l116::<lambda_4>::operator()(FRDGBuilder &) Line 5217 C++
UnrealEditor-Renderer.dll!`FRendererModule::BeginRenderingViewFamilies'::`116'::<lambda_4>::<lambda_invoker_cdecl>(FRDGBuilder & GraphBuilder, const FSceneRenderFunctionInputs & Inputs) Line 5219 C++
[Inline Frame] UnrealEditor-Renderer.dll!UE::Core::Private::Function::TFunctionRefBase<UE::Core::Private::Function::TFunctionStorage<1>,bool __cdecl(FRDGBuilder &,FSceneRenderFunctionInputs const &)>::operator()(FRDGBuilder &) Line 414 C++
UnrealEditor-Renderer.dll!FSceneRenderProcessor::Execute::__l30::<lambda_4>::operator()(FRHICommandListImmediate & RHICmdList) Line 889 C++
[Inline Frame] UnrealEditor-Renderer.dll!UE::Core::Private::Function::TFunctionRefBase<UE::Core::Private::Function::TFunctionStorage<1>,void __cdecl(FRHICommandListImmediate &)>::operator()(FRHICommandListImmediate & <Params_0>) Line 414 C++
UnrealEditor-Renderer.dll!FRenderThreadCommandPipe::Enqueue<TRenderCommandTag<`FSceneRenderProcessor::Execute'::`30'::TSTR_SceneRenderBuilder_Render829>,TUniqueFunction<void __cdecl(FRHICommandListImmediate &)>>(TUniqueFunction<void __cdecl(FRHICommandListImmediate &)> && Lambda) Line 615 C++
[Inline Frame] UnrealEditor-Renderer.dll!FRenderCommandDispatcher::Enqueue(TUniqueFunction<void __cdecl(FRHICommandListImmediate &)> &&) Line 1091 C++
UnrealEditor-Renderer.dll!FSceneRenderProcessor::Execute() Line 829 C++
UnrealEditor-Renderer.dll!FSceneRenderBuilder::Execute() Line 1080 C++
UnrealEditor-Renderer.dll!FRendererModule::BeginRenderingViewFamilies(FCanvas * Canvas, TArrayView<FSceneViewFamily * const,int> ViewFamilies) Line 5231 C++
UnrealEditor-Renderer.dll!FRendererModule::BeginRenderingViewFamily(FCanvas * Canvas, FSceneViewFamily * ViewFamily) Line 5047 C++
UnrealEditor-UnrealEd.dll!FEditorViewportClient::Draw(FViewport * InViewport, FCanvas * Canvas) Line 4641 C++
UnrealEditor-Engine.dll!FViewport::Draw(bool bShouldPresent) Line 1809 C++
UnrealEditor-UnrealEd.dll!UEditorEngine::UpdateSingleViewportClient(FEditorViewportClient * InViewportClient, const bool bInAllowNonRealtimeViewportToDraw, bool bLinkedOrthoMovement, bool * bOutViewportDrawn) Line 2686 C++
UnrealEditor-UnrealEd.dll!UEditorEngine::Tick(float DeltaSeconds, bool bIdleMode) Line 2331 C++
UnrealEditor-UnrealEd.dll!UUnrealEdEngine::Tick(float DeltaSeconds, bool bIdleMode) Line 530 C++
UnrealEditor.exe!FEngineLoop::Tick() Line 5761 C++
[Inline Frame] UnrealEditor.exe!EngineTick() Line 60 C++
UnrealEditor.exe!GuardedMain(const wchar_t * CmdLine) Line 187 C++
UnrealEditor.exe!LaunchWindowsStartup(HINSTANCE__ * hInInstance, HINSTANCE__ * hPrevInstance, char * __formal, int nCmdShow, const wchar_t * CmdLine) Line 266 C++
UnrealEditor.exe!WinMain(HINSTANCE__ * hInInstance, HINSTANCE__ * hPrevInstance, char * pCmdLine, int nCmdShow) Line 334 C++

Have Comments or More Details?

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

5
Login to Vote

Unresolved
ComponentUE - Graphics Features - Ray Tracing
Affects Versions5.65.7
Target Fix5.7
CreatedAug 14, 2025
UpdatedAug 14, 2025
View Jira Issue