Stencil

This tutorial has been created in the Tutorial/Maps/TutorialMap_VFX map provided in the Demo Project. It covers how to ignore the fog post-process effect on objects rendered with a custom stencil.

Custom depth render

While developing your game, you might want certain objects to retain their appearance and ignore the FOW pass. By default, varying this effect by object is challenging, but custom depth allows it! By modifying a few settings, the GPU will access a new data set, enabling logic per Stencil ID.

The material logic is already configured, so only asset settings need adjustment.

StencilPictures

First, ensure that the stencil is correctly enabled in your Project Settings. Change the Custom Depth-Stencil Pass to Enable with Stencil.

StencilPictures

Now select your assets and search for depth. You'll find 3 variables to change:

  • Render CustomDepth Pass: Enable this to let the stencil render update with the asset's primitive.
  • CustomDepth Stencil Value: Set this to the stencil value the asset will use.
  • Custom Depth Stencil Write Mask: Set to All bits (255).

StencilPictures

Hit play, and you'll see that the cylinder is unaffected by the grey fog!

Custom depth settings

By default, the FOW is set to ignore fog for assets with a Stencil ID of 1. To change this, open the MPP instance MPP_FOW_Floor_Inst and enable IgnorFogByStencil. If you need to change the Stencil ID you will need to open the parent material and update StencilIgnoringFog value (The value should be move to the MPC with a console command soon)

StencilPictures


Documentation built with Unreal-Doc v1.0.9 tool by PsichiX