Weird Glitch when using outline post process material

Hi, I created Post process material that creates outline around objects. Originally i created it using engine version 5.5 and everything was working correctly there, but after migration to version 5.7 i started seeing very weird glitches on camera


After moving and changing direction camera is facing it suddenly dissapears and starts working normally again.


Did anyone see anything at least sligthly similar to that?
Not posting ful material as it’s splitted between few files/helper functions but I’m using nodes like scene depth (not sceneTexture:SceneDepth), SceneTexture:CustomStencil and SceneTexture:WorldNormal. Rather typical stuff when creating outline material.
It’s somehow related to custom depth pass, after mesh with custom depth pass enabled is rendered it starts to glitch, but after disabling it or when it gets culled from view, material looks normal again.
Any idea what could be wrong is appreciated. I’ll try to minimize the blueprint and pinpoint which node is problematic and then post screenshot of the material

The issue was that I used custom depth with stencil on object but in project settings I had custom depth stencil pass set to enabled. Setting to enabled with stencil solved the issue.
I missed it during copying asset from other project.
Still, I think it would be nice if there was some kind of warning or information that you are using stencil without enabling it in settings to avoid issues like this