How do I add per-object custom depth to a material?
See the image above. It's what I'm trying to achieve in UE4. Basically, I want to control depth sorting for my material so that only the front-most pixels are drawn, even if the material itself is transparent. This was relatively trivial to achieve in Unity (the screenshot's from Unity as well) by using a multpass material, drawing to the z-buffer once, and using ZTEST EQUAL (drawing only those pixels whose depth matches the existing buffer exactly) in a second pass to draw only the front-most pixels. I'm looking for a way to achieve the same in UE4.
I've already found this link which explains a way to do this with custom depth. However, it says the effect will break if there are overlapping objects. I need the effect to work even with many overlapping objects as the screenshot shows. Any ideas?
Follow this question
Once you sign in you will be able to subscribe for any updates here