Does anyone know how to render a translucent mesh/box with FDebugRenderSceneProxy? Or maybe point me in the right direction.
The default GetBoxMesh() is invisible if a translucent material is applied.
I tried looking at how the nav mesh preview does it in NavMeshRenderingComponent but I’m not sure how it works and why that can render a translucent material.
This is how the nav mesh preview renders:
FMeshBatch& Mesh = Collector.AllocateMesh();
FMeshBatchElement& BatchElement = Mesh.Elements[0];
BatchElement = MeshBatchElements[Index];
FDynamicPrimitiveUniformBuffer& DynamicPrimitiveUniformBuffer = Collector.AllocateOneFrameResource<FDynamicPrimitiveUniformBuffer>();
DynamicPrimitiveUniformBuffer.Set(FMatrix::Identity, FMatrix::Identity, GetBounds(), GetLocalBounds(), false, false, DrawsVelocity(), false);
BatchElement.PrimitiveUniformBufferResource = &DynamicPrimitiveUniformBuffer.UniformBuffer;
Mesh.bWireframe = false;
Mesh.VertexFactory = &VertexFactory;
Mesh.MaterialRenderProxy = &MeshColors[Index];
Mesh.ReverseCulling = IsLocalToWorldDeterminantNegative();
Mesh.Type = PT_TriangleList;
Mesh.DepthPriorityGroup = SDPG_World;
Mesh.bCanApplyViewModeOverrides = false;
Collector.AddMesh(ViewIndex, Mesh);
And I believe this is what GetBoxMesh does:
FMeshBatch& Mesh = Collector.AllocateMesh();
FMeshBatchElement& BatchElement = Mesh.Elements[0];
BatchElement.IndexBuffer = bHasValidIndexBuffer ? OneFrameResources->IndexBuffer : nullptr;
Mesh.VertexFactory = OneFrameResources->VertexFactory;
Mesh.MaterialRenderProxy = MaterialRenderProxy;
BatchElement.PrimitiveUniformBufferResource = OneFrameResources->PrimitiveUniformBuffer;
Mesh.CastShadow = Settings.CastShadow;
Mesh.bWireframe = Settings.bWireframe;
Mesh.bCanApplyViewModeOverrides = Settings.bCanApplyViewModeOverrides;
Mesh.bUseWireframeSelectionColoring = Settings.bUseWireframeSelectionColoring;
Mesh.ReverseCulling = LocalToWorld.Determinant() < 0.0f ? true : false;
Mesh.bDisableBackfaceCulling = Settings.bDisableBackfaceCulling;
Mesh.Type = PT_TriangleList;
Mesh.DepthPriorityGroup = DepthPriorityGroup;
Mesh.bUseSelectionOutline = Settings.bUseSelectionOutline;
Mesh.BatchHitProxyId = HitProxyId;
BatchElement.FirstIndex = DrawOffset ? DrawOffset->FirstIndex : 0;
BatchElement.NumPrimitives = DrawOffset ? DrawOffset->NumPrimitives : (bHasValidIndexBuffer ? (OneFrameResources->IndexBuffer->Indices.Num() / 3) : (bHasValidVertexBuffer ? OneFrameResources->VertexBuffer->Vertices.Num() / 3 : 0));
BatchElement.MinVertexIndex = DrawOffset ? DrawOffset->MinVertexIndex : 0;
BatchElement.MaxVertexIndex = DrawOffset ? DrawOffset->MaxVertexIndex : (bHasValidVertexBuffer ? OneFrameResources->VertexBuffer->Vertices.Num() - 1 : 0);
Collector.AddMesh(ViewIndex, Mesh);