Setting the near and far clipping planes

Started by
1 comment, last by mikenavyseal 18 years, 4 months ago
When setting the near and far clipping planes when creating the perspective matrix in either DirectX or OpenGL, I'm confused as to how these values should be chosen. I understand that both zNear and zFar must be positive, non-zero numbers. However, most tutorials give values such as 0.1 or 1 to zNear and a much larger value for zFar. Are these values conditional on whatever your game is rendering, or is there a certain rule to follow when setting the planes? Thanks.
Advertisement
Other than clipping, the most important consideration is the affect on the resolution of the depth buffer. Ideally, the near and far planes should be as close together as possible. However, the distance to the near plane is usually much more important than the distance to far plane because it affects the resolution of the depth buffer the most.

In absolute terms, the distances are irrelevant -- i.e. 1 is no better than 0.1 or 100. A good rule of thumb is to place the near plane no closer than 1/1000 of the distance to the farthest displayed object. You should set the distance to the far plane far enough away so that it doesn't clip objects that you want rendered. Setting it to infinity is possible and for certain techniques it is required.
John BoltonLocomotive Games (THQ)Current Project: Destroy All Humans (Wii). IN STORES NOW!
Thanks, that helps a lot.

This topic is closed to new replies.

Advertisement