Reputation:
In openGles decreasing the frustum near plane (as you see here) makes the objects appear closer. I come from 3d where for example in Vray, changing the near clip plane doesn't modify the distance and just clips some geometry.
Why changing the near plane of the frustum makes the object appear closer?
Upvotes: 1
Views: 980
Reputation: 2202
I'm assuming that changing the frustum has the effect described here.
So according to the docs, when you call this function
void glFrustum(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble nearVal, GLdouble farVal);
what you're doing is multiplying the current projection matrix by a matrix built from the values specified in the parameters.
If you take a look at how that matrix is built, you will notice that it is very similar to a scaling matrix. The element at 3,3 (which goes by the name of C
in the doc page) is equal to -(far+near)/(far-near)
. This means that if you decrease near
and leave far
as it is, C
will get closer to zero. When the matrix multiplication takes place, this will act like a downscaling of the Z coordinate.
So when you decrease the near value, the vertices will appear as though they have been brought closer to the origin proportionally to their Z coordinate. This decrease also has an effect on the X and Y coordinates, of course, and should make the objects look more "compressed" towards the center. I guess that effect is more consistent with what we intuitively expect from bringing the near clipping plane closer to the point of view.
Upvotes: 1