Disabling Custom Depth Rendering on certain objects

In my project I have interact-able objects outlined to show that they can be interacted with.

The problem is that the outline is shown through the player mesh (third person template). Is there a way to make the outline not render through the player mesh?

Thanks!

I assume the outline is implemented as PostprocessMaterial reading CustomDepth.
You can read SceneDepth there as well and with some depth comparison you can mask or dim the areas you want.

I know it is an old question but I wanted to share a way to achieve that effect since I couldn’t find one anywhere.
Just modify M_Highlight in the following way:
To outline only unoccluded parts of objects:

To outline only occluded parts of an object just switch the inputs of the if node (A>=B and A).

What it dose is the following:
When we want to draw an outline we compare the depth value of the custom depth buffer and the depth value of the buffer at that uv.
If the value of the depth buffer is less then the value of the custom depth buffer at that uv then it means that that uv is occluded and we discard the outline draw at that uv coordinate.

6 Likes

I cannot thank you enough!

1 Like

Thanks so much ! When u change the upper SceneTexture:SceneColor to SceneTexture:PostProccessInput0 then it works with UDK 4.13 too.

Dude! It’s been years… but THANK YOU!!! hahaha

1 Like

Not working on 4.27 for me:(

I was also in search of a fix. Check out this blog, it has everything you need and also downloadable material:

Outline effect (Part 3) – Parallelcube

Don’t forget to turn this on Project Settings > Rendering > Postprocessing > Custom-Depth Stencil Pass > Enabled With Stencil.

Otherwise, the material will not work!

1 Like