PostProcessMaterial - Accessing SceneDepth

Hi, first time asking a question so please go easy on me! I usually can find the answers I need already on here but this time I’m stumped.

I’m trying to access scene depth in a post process material effect and I need to do it in a Custom node with a while loop.

If I were accessing a texture I’d march through with a Tex.SampleGrad(TexSampler, UV + offset, dx, dy) but is there a way to march through scene depth? It seems like the depth information is available based on other nodes (DepthFade, etc) but is there a way to grab the scene depth in a Custom node?

Hopefully this makes sense and I didn’t use too many terms incorrectly.

Thanks for any help! Hopefully I didn’t just miss a question that already addresses this.

theres a ue4 tutorial on cel shading that ive linked below that has the info your looking for. if you go to about 20 mins in it shows how to get the scene depth.