Controlling the perspective plane position.

edited August 2015 in GLSL / Shaders

Why is there a "near" clipping plane in perspective()? And why would I not want to set it to, say, zero? I'm guessing that somehow it must become an expensive graphics operation if the clipping plane is at the camera position, but I can't see why that would be the case. Is that true? or is there another reason the default clipping plane is where it is?

The documentation also gives a trig formula they use to compute the clippin plane position by default. I don't understand the logic of the formula.

Background:

The problem I am trying to solve is that when I place the camera inside a constellation of, say, boxes that many of boxes close to the camera are visibly "sliced open". This happens even though the camera position is not inside any of these boxes.

I'm not quite sure why this happens. My theory is that perspective is handled by projecting the line-of-sight from the camera from every point through a perspective plane that is a little bit in front of the camera. (that's a common technique and how I do it when I roll my own perspective). The downfall of this approach is figuring out how to process objects that pass through the perspective plane singularity. Truncation is one way but its not what you would "see" in real life. You know this because you don't see objects you are close to as sliced!

assuming that is correct then building slicing is occuring when the perspective plane slices through a building not when the the camera is inside the building.

Thus the workaround for this is to control the location of the perspective plane, not the camera location, so that the perspective plane is outside of any close-by objects.

So I'm trying to figure out how to do that so I can either move the camera back to get the clipping plane out of trouble or I want to set the clipping plane offset to zero.

Sign In or Register to comment.