This question was created in reference to: [Crash when switching to Wireframe (F1) with [Content removed]
We are using UE5.6.1, and we forward integrated CL46444386, in order to solve issues with Nanite meshes, bRenderInMainPass and custom depth.
In our project, we rely on a Scene View Extension to add a mesh drawing pass, in PostRenderBasePassDeferred_RenderThread.
We have an array of FPrimitiveSceneProxy pointers for the frame, that we want to render. Some of these are Nanite-enabled, and they all have bRenderInMainPass to false (= we only want them to be drawn through our custom FMeshPassProcessor in the SVE, not normal BasePass).
We use the “AddSimpleMeshPass” function to setup the rendering pass :
AddSimpleMeshPass(GraphBuilder, PassParameters, InView.Family->Scene->GetRenderScene(), InView, nullptr, RDG_EVENT_NAME("MyCustomPass %dx%d - %u prims", RTSize.X, RTSize.Y, RegisteredPassPrimitiveProxies.Num()), static_cast<const FViewInfo&>(View).ViewRect,
[&InView, this, &RegisteredPassPrimitiveProxies](FDynamicPassMeshDrawListContext* DynamicMeshPassContext)
{
FMyMeshPassProcessor Processor(InView.Family->Scene->GetRenderScene(), &InView, DynamicMeshPassContext);
for (const FPrimitiveSceneProxy *const Primitive : RegisteredPassPrimitiveProxies)
{
if (!Primitive)
{
continue;
}
TArray<FMeshBatch> MeshElements;
Primitive->GetMeshDescription(0, MeshElements); // <- For Nanite meshes, MeshElements remains empty
if (MeshElements.IsEmpty())
{
continue;
}
for (const FMeshBatch& Batch : MeshElements)
{
Processor.AddMeshBatch(Batch, ~0ull, Primitive);
}
}
});
Unfortunately, even with the forward integrated CL fix, GetMeshDescription returns no FMeshBatch for Nanite meshes.
This is very inconvenient, as we heavily rely on micropolygon meshes and we don’t want to use bForceDisableNanite as a hack.
Is there anyway we could access the Nanite mesh proxy’s FMeshBatch array ?
Thanks in advance,
Tim