How to render an instanced static mesh so that it doesn't affect Scene Depth in a postprocess material?

I have an instanced static mesh, where the instances are simple cubes marking specific locations in the scene (think: waypoints). The material I’m using is a simple emissive material that doesn’t cast shadows and has “Used with instanced static mesh” checked.

I have a SceneCapture2D component which uses a postprocess material that simply grabs the Scene Depth, to generate a depth image.

The problem I have, is that the depth image shows the cubes and I’d like it not to. How can I achieve this? I think I’d like to do something where the cubes are rendered with depth testing ON, but do not actually write to the depth buffer. How can I achieve this?

Thanks in advance!

1 Like

If you make the material translucent/transparent, it will not write the depth buffer.
Another option is to use Custom Depth Stencil for the object in question.

2 Likes

Thank you! Changing the material’s Blend Mode from Opaque to Translucent did the trick. I did not try the Custom Depth Stencil option.

2 Likes