How do I set my near plane and far plane ?

Question


«I've written a 3D engine, and I'm using a Z-Buffer to hide non visible faces. The problem is I can't figure what to put as the near plane and far plane value when setting up my frustum. I constantly get artifacts either polygons drawn on top of each other when they should be hidden, or geometry that is cut when they come near of or too far from the camera. Shouldn't I put the near plane to zero since this is where my camera is lying?»

Answer


Short answer :

No you shouldn't put the near plane to zero, because zero is the plane where every object is drawn at infinity in your conic projection and this will definitely cause artifacts. In fact you should put the near plane as far as you can, as it will have an immediate effect on the precision of your z-buffer and the presence of z-fighting artifacts. Same you shouldn't put the far plane too far as it will also consume some of the precision of your z-buffer.

Long answer :

You should definitely take a look at my previous article called Depth buffer the gritty details.


If you want to learn more..




Partner websites : LEGREG | GRAPHICS | GRAPHISME | PHOTOGRAPHY | OUT OF MY MIND | ANIMATION MENTOR | GREEN LIVING | VOXEL | RAY TRACING | GUENARDI | Add this page rank counter to your page.