Is it possible to sample custom depth in UI Material?

I have been trying to sample custom depth in User Interface Material Domain.
I have assigned the material as translucency and tried various combinations of Sample Scene Texture and pixel depth to no avail. I am starting to wonder whether its possible at all to sample the custom depth in anything other than Post Process?

The general idea is to get the UI to render behind the main character but on top of everything else in order have no clip with walls.

Best Regards

No one has any idea?

Hello -

UI Materials and the UI specifically cannot read from Scene Depth at all. It is rendered outside of the world Scene Depth passes.

Eric Ketchum

Thank you for your help Eric, on the off chance that you see this again… Is there another way to in anyway occlude UI material? If its rendered outside of SceneDepth passes, can the depth be saved between frames to be used for occlusion?
Thank you again.

Hello again!

Through an accident I discovered that a UI Material can sample from Custom Stencil when drawn in HUD event!
Thus you could get that the material is occluded only by the player.

But when using widgets its still not possible to sample Custom Depth in UI material.

The current working idea is to move everything from widget to HUD with draw simple.
If there is another way, I would be very eager to hear about it. :slight_smile:

1 Like