How can I get the actual distance to the scene using the depth texture?

I want to get the actual distance and not the depth, how can I do that?

(I think I basically want to do what bgolus(the one and only) did here, but the other way around and messure the distance to the camera)

Thanks in advance!

You can start by knowing the minimum possible value is at the camera’s near clipping plane, and the maximum is at the camera’s far clipping plane. You then account for the trigonometry in the reverse of the examples in that thread.

1 Like

Ok, thank you

Search for “reconstructing world space from depth”.

1 Like

Sorry, I forgot to answer. I found some great resources that way. Thank you!