PDA

View Full Version : Changing frustum effects objects on the near/far plane.



f-error
10-25-2015, 08:28 AM
I set up a frustum with near 1.0 and far 2.0.
I place "the camera" at (0, 0, 1.0) thereby making the near plane identical to the xy plane.
I draw a quad on the xy plane. It shows up in the center.
Now I make the frustum deeper by pushing zFar further away.
Somewhere between setting zFar=5.0 and zFar=6.0 is a value after which the quad does not show up anymore.
(To clarify: The quad is NOT moved at all the entire time)

Where does that effect come from?
Is it a problem with floating point precision? Is a lack of precision pushing the quad towards the camera so it gets clipped against the near plane when the frustum changes?
Objects inside the frustum get different depth values when the frustum scales. Even when they are relatively at the same position between near and far.
But how can a quad on the near plane ever get clipped.
Does it mean a floating point multiplication somewhere with the MVPmatrix results in a distance between eye and object that is slightly smaller than 1.0?
Then the quad would end up slightly in front of the 1.0 near plane and get clipped?
If that is the case, should I not be able to find other values for zFar that result in precise representations of all values and thereby make the quad show up again?