This topic is now archived and is closed to further replies.


What should I set the near clipping plane to?

Recommended Posts

Z01    134
I''m fooling around with a terrain renderer. The camera''s veiwpoint is set as:
camera.z = terrainHeight(camera.x, camera.y) + epsilon   //epsilon small

I want my camera to be closer to the terrain''s surface, ie. epsilon smaller. But if I make it too close to the surface, the near clipping plane sometimes slices the geometry close to the camera. I can fix this by making the near clipping plane closer to the camera. I completely understand what is going on here, and why things are working this way. My questions: 1) Is having the near clipping plane below 1.0f bad? I seem to remember somewhere that this causes problems. 2) I''m sure other people have had this problem, is there another way to resolve it, or did you do it the same way? Right now I have the near and far clipping (frustum) planes to 0.1 and 10000:
gluPerspective(60.0f, (GLfloat)width/(GLfloat)height, 0.1f, 10000.0f);
Thanks guys, Z01

Share this post

Link to post
Share on other sites
Rudan    158
You could get a problem with the z-buffer precision if the near clipping-plane is too close (the far clipping-plane matter too, but the near affects this much more). You'll see if there's a precision problem, polygons will be jagged and look weird. Just use something that look good, and if you see any problems, try to increase the near clipping-plane.

BTW I've never needed to use a clipping-plane as low as 0.1 but I guess that depends on the scale of your world, among other things.

"problems have solutions
a lifetime of fucking things up fixed in one determined flash"
- The Downward Spiral, NIN

//Edit: spelling...

Edited by - Rudan on January 30, 2002 7:08:03 PM

Share this post

Link to post
Share on other sites