Write to depth buffer from custom pixel shader?

Hi,

I want to render a plane but I want to write to the depth buffer using depth values stored inside a texture I send to the material. I know I can’t do it using material blueprint (If i’m not mistaken), except for pixel depth offset which is not appropriate for my needs. I found a way to edit sources files to have a custom shading model, but I still can’t write to the depth buffer.

My questions are :

  • Is it possible to write a custom vertex/pixel shader and use it ? I know there is FGlobalShader, but i don’t want a post-process shader, and FVertexFactory use a vertex shader from what I know. And I didn’t find an example for a material shader.
  • Is it possible to write to the depth buffer from a pixel shader or one of the source shader ?

It is possible to write custom shader from scratch, yet extremely impractical. However, there is a Custom Depth buffer. Maybe you could use it to achive what you need.

Using the Custom Depth buffer is heavier because I just want to write to depth buffer but I’ll give it a try. I didn’t think about it because of the post-process pass I want to avoid.

Is the Custom Depth buffer usable in stereo for each eye ?

Thx for your answer!