Here's a function I wrote to compute it, based on the given distance:
float getDepth(float dist) {
float zNear = 0.1, zFar = 1000; // from main.cpp
float a = zFar / (zFar - zNear);
float b = zFar * zNear / (zNear - zFar);
float z = dist;
return a + b / z;
}
No comments:
Post a Comment