Depth sprites

Hi all.

I’m trying to do something which seems quite simple at first, in fact I can code this up really quickly in OpenGL or unity.

but I’m struggling to do it in unreal (which is what I’m actually using).

So, I want to draw a camera facing quad on screen (easy enough). Then I want to have two textures, one which is the texture seen by user. The other texture however (let’s say it’s grey scale for now, 0 to 1) sets the depth buffer value for the pixel (which can be anywhere from near plane to far plane)

Now I can do this in a pixel shader easily enough, by finding where 0 to 1 appears on the depth buffer curve and ouputting it to the depth output of the pixel shader.

But I cant figure out how to do this in unreal. The custom shader editor doesn’t seem to allow me to output to depth. If I write a custom shader, it seems to want me to write to a material first, etc.

There seems to be a way to do it in material blueprint editor. Using “pixel depth offset”, but I can’t find any info on what the input to it should be?? Nor as to whether it’ll allow me to specify anywhere in depth buffer?

will “pixel depth offset” work for this? If so, can someone let me know what the input value should be?

If not, how do I do this? I can’t be only one needing depth sprites surely?