Download

Using CustomDepth to highlight (as a whole, not line)?

Hi,
What I’d like to archieve is that an object is highlighted.
I though I’d use CustomDepth. So all objects which should highlight have Render Custom Depth set. By looking at the Custom Depth Buffer, it seems that it is initialized with MaxValue and not 0 where nothing has been drawn? (at least it shows up white when using SceneTexture:CustomDepth)
My first goal was to simply add some BlueColor to each pixel where CustomDepth is modified. But my mind already requires branching, and this is not available in UE4(since sm2 or 3? you can use dynamic branching in HLSL)

So i am already stuck at the beginning.
(Exceuse me for not adding screenshots atm, but it’s 0:40am and i need some sleep, if requested i’ll add them tomorrow evening)

Greetings
Memnarch

You would need to divide the custom depth by a large number to show up as a black/white mask which you could use for a Lerp between the regular SceneColor and a modified highlight color.

customdepthhighlight7lsr4.png