Custom Depth Test

I’d like to perform a manual equals test between fragment depth and custom depth buffer in material. Question is how to get fragment depth as if it was stored in depth buffer?

When reading custom depth its already converted from DeviceZ to same units that PixelDepth is. If you sample custom depth buffer manually then you need to convert pixelDepth using ConvertToDeviceZ function.

Yeah, but comparison between PixelDepth and CustomDepth is not precise. In fact it is irrelevant, if SceneDepth or Device Depth is used. Sampling custom depth scene texture manually and comparing it against device coordinate Z yields pretty much same result.