Viewport glitching when using Custom Depth Stencil

When I set my viewmode to custom stencil, my viewport gets all weird and glitchy.
I need the custom stencil for my material, which will be a multi color see-through-walls material.

It happens when I looking at any object that has “Render CustomDepth pass” enabled.

To reproduce the above image, the only thing I have to do is to add any object to the start-up map (in this case a static mesh cube) and switch viewmode to Custom Stencil. It will then happen if the cube is within my viewport.

Things I have tried already:

  • Update my GPU drivers.
  • Disabling the integrated graphics on my CPU.
  • Adding a post-process volume to the scene.
  • Enabling Custom Depth-Stencil Pass in the project settings.
5 Likes

Same.

I had this issue. I realised I had custom depth set to “Enabled” not “Enabled with Stencil” in project settings.

8 Likes

Thanks! That fixed the problem!