Post process effects for "X-Ray" vision

Hello, I am trying to achieve an “X-Ray” vision effect very similar to that of Hunt: Showdown’s, as it is in this video:

Shortly, what I want is a darkening of the whole screen by a controllable amount and a visible post-process effect generated around objects with a certain tag (such a player pawns). How would you achieve this?

Hi Heiko,

first open project settings and under Rendering: Change the Custom Depth Stencil Pass like so (in the picture)

secondly create a post process material like so:

and so (avoid flickering):

275763-stencil01.png

Alternatively you can switch off temporal aa or aa in common to avoid flickering.

After that create a common level with light, place in a cube and change the cube’s settings like so:

In the Details Panel you can activate the Custom Depth Render Pass and you can use a Stencil Value. The Stencil Value works like a tag.

Cheers

Thanks, it works! However, I have no clue why it works. What exactly have you done in the material?

Hi Heiko,

it would take long to explain everything in detail. You have to swallow the pill and learn post process materials.

Here is the doc to start with: https://docs.unrealengine.com/en-US/Engine/Rendering/PostProcessEffects/PostProcessMaterials

The only thing i can do is giving you the best tip for post process materials:

Everything that is developed within the post process material will be done per pixel and usually 60 times per second (60fps). Understanding that and you already have walked the half way.

You should take a look at basic PP Mats, it´s quite simple. As a quickstart help:
“SceneTexture PostProcess input 0” is just the Image before your PP Mat.
The If statement switches between an Orange Color and the unaltered Scene image based on the Stencil ID at the current pixel compated to the Stencil ID you use to mask out your object.

The Mat says: If the Stencil ID at that pixel is the expected ID → Pixel is Orange. Else → Pixel is darker version of regular Pixel

Nice, this is very helpful!

That’s fair, I will have a look at it, thanks.