When View.Family->EngineShowFlags.CompositeEditorPrimitives is false in the function RenderEditorPrimitivesForDPG.
This code picks which version of the batched lines to render
const FBatchedElements& BatchedViewElements = DepthPriorityGroup == SDPG_World ? View.BatchedViewElements : View.TopBatchedViewElements;
However at the bottom of the function:
View.TopBatchedViewElements.Draw(RHICmdList, DrawRenderState, View.GetFeatureLevel(), View, false, 1.0f, EBlendModeFilter::All, View.GetStereoPassInstanceFactor());
Should read
BatchedViewElements.Draw(RHICmdList, DrawRenderState, View.GetFeatureLevel(), View, false, 1.0f, EBlendModeFilter::All, View.GetStereoPassInstanceFactor());
Additionally, it appears that since RenderEditorPrimitivesForDPG is called multiple times for both World and Foreground, the Mesh rendering is executed multiple times.
As both the ViewMeshElements and TopViewMeshElements are rendered in each case.
I believe the fix should be thus:
static void RenderEditorPrimitivesForDPG( FRDGBuilder& GraphBuilder, const FViewInfo& View, FOpaqueBasePassParameters* PassParameters, const FMeshPassProcessorRenderState& DrawRenderState, ESceneDepthPriorityGroup DepthPriorityGroup, FInstanceCullingManager& InstanceCullingManager) { const FScene* Scene = View.Family->Scene->GetRenderScene(); GraphBuilder.AddPass( RDG_EVENT_NAME("%s", *UEnum::GetValueAsString(DepthPriorityGroup)), PassParameters, ERDGPassFlags::Raster, [&View, DrawRenderState, DepthPriorityGroup](FRHICommandList& RHICmdList) { RHICmdList.SetViewport(View.ViewRect.Min.X, View.ViewRect.Min.Y, 0.0f, View.ViewRect.Max.X, View.ViewRect.Max.Y, 1.0f); View.SimpleElementCollector.DrawBatchedElements(RHICmdList, DrawRenderState, View, EBlendModeFilter::OpaqueAndMasked, DepthPriorityGroup); if (!View.Family->EngineShowFlags.CompositeEditorPrimitives) { DrawDynamicMeshPass(View, RHICmdList, [&View, &DrawRenderState, DepthPriorityGroup](FDynamicPassMeshDrawListContext* DynamicMeshPassContext) { FEditorPrimitivesBasePassMeshProcessor PassMeshProcessor( View.Family->Scene->GetRenderScene(), View.GetFeatureLevel(), &View, DrawRenderState, false, DynamicMeshPassContext); const uint64 DefaultBatchElementMask = ~0ull; // <FIX> Render the appropriate set of data depending on the depth priority if (DepthPriorityGroup == SDPG_World) { for (int32 MeshIndex = 0; MeshIndex < View.ViewMeshElements.Num(); MeshIndex++) { const FMeshBatch& MeshBatch = View.ViewMeshElements[MeshIndex]; PassMeshProcessor.AddMeshBatch(MeshBatch, DefaultBatchElementMask, nullptr); } } else { for (int32 MeshIndex = 0; MeshIndex < View.TopViewMeshElements.Num(); MeshIndex++) { const FMeshBatch& MeshBatch = View.TopViewMeshElements[MeshIndex]; PassMeshProcessor.AddMeshBatch(MeshBatch, DefaultBatchElementMask, nullptr); } } }); const FBatchedElements& BatchedViewElements = DepthPriorityGroup == SDPG_World ? View.BatchedViewElements : View.TopBatchedViewElements; // Draw the view's batched simple elements(lines, sprites, etc). // <FIX> Render the set we want depending on the DepthPriorityGroup //View.TopBatchedViewElements.Draw(RHICmdList, DrawRenderState, View.GetFeatureLevel(), View, false); BatchedViewElements.Draw(RHICmdList, DrawRenderState, View.GetFeatureLevel(), View, false); // </FIX> } }); }
Steps to Reproduce
When View.Family->EngineShowFlags.CompositeEditorPrimitives is false in PIE or in Game, try rendering some lines like:
void Draw(FViewElementPDI& PDI)
{
for (int LineIndex = 0; LineIndex < Lines.Num(); ++LineIndex)
{
Line& Entry = Lines[LineIndex];
PDI.DrawLine(Entry.Start, Entry.End, Entry.Color, SDPG_World);
}
}
Notice the lines appear in the DepthPass but not in the BasePass (a Renderdoc capture will confirm this)
There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-359736 in the post.
| 0 |
| Component | UE - Rendering Architecture - RHI |
|---|---|
| Affects Versions | 5.7 |
| Created | Jan 7, 2026 |
|---|---|
| Updated | Jan 7, 2026 |