How to convert units [distance from camera] to [depth value] on a depth map

I wanna have everything more than 10units away from the camera in yellow. how would I go about doing it?

specifically how do I get the depthCutoff value in this PG for a specific distance from the camera

tysm

The computation is done using the camera’s min and max values. Take the minimum and the maximum, the distance between them is “1”. so setting minimum to 0 (or 0.001) and max to 100, if the cutoff if 0.5, elements more than 50 units away from the camera will be yellow:

distance from camera to depth value | Babylon.js Playground (babylonjs.com)

The default maxZ is quite high, this is why the low number 0.00009 was working in your playground.

1 Like

tysm! leaving this as tutorial

1 Like