• What's the point of the near clipping plane in 3d games?
    8 replies, posted
  • I can understand the reason for the far clipping plane, so that you wouldn't just render infinitely beyond, but what's with the near clipping plane? If you have a model, and scale it up, you'll probably be able to see the model and look around. But if you have the small model, and scale it down, the near clipping plane will dissect the model in half when you should be exactly where you were last time in the huge model scale wise. Is there any reason for this?
  • [url]http://www.sjbaker.org/steve/omniv/love_your_z_buffer.html[/url] I don't think this has any relevance when you have a deferred renderer, as you can scale the Z-Buffer as you want; I could be wrong though, I'm not deep into CG.
  • You can think of that near clipping plane as the full area of your screen. Everything is projected onto that plane, then it is scaled to fit your monitor. Now what if your monitor was a singularity?
  • [QUOTE=ROBO_DONUT;28951329]Now what if your monitor was a singularity?[/QUOTE] Light would have a hard time leaving it. Black holes need one hell of a backlight.
  • The clipping plane is usually represented by a logarithmic scale. This means that if you set your clipping plane at the camera, the distance between the clipping plane and the camera would be zero. Log(0) is -infinity, so the near plane must be greater than 0. [editline]now[/editline] It looks like Zeeky's link has similar information.
  • Yeah HueyFreeman is pretty much on the money, its to do with the fact that your zBuffer (or DepthBuffer) is stored as a floating point surface on your graphics card. Floating points are actually represented inside your computer as a fraction. [img]http://blogs.mathworks.com/images/seth/2009Q4/floating_pointCleve.png[/img] (A number line representation of some float numbers see how the accuracy is not constant) By defining clear bounds for your clipping plane you can change the accuracy of it to one that suits your situation, for example a game with mainly enclosed indoor spaces will have a much smaller far plane than a game that features wide outdoor vistas. You will see examples of zFighting (an error caused by your zBuffer being too inaccurate if you set your far plane to really really far) when there is not enough accuracy in the zbuffer for the graphics card to determine if two depths are equal. [img]http://thetavern.servebeer.com/article_data/D3DTutorial4/ZFighting.png[/img]
  • Some games have multiple rendering passes with different values for zNear and zFar to account for this inaccuracy.
  • And the higher the near clip plane value can be the better. Depending on what type of game it is, you can get away with different values. Third person games can get away with very large near clip values, but FPSs allow you to get close to walls and such, which means you have to go with a lower value.
  • [QUOTE=knighty;28957518]And the higher the near clip plane value can be the better. Depending on what type of game it is, you can get away with different values. Third person games can get away with very large near clip values, but FPSs allow you to get close to walls and such, which means you have to go with a lower value.[/QUOTE] Although in this case you could do what most games don't seem to do and prevent people from embedding their bodies in walls. Might give you several units of possible extra distance to the near-z plane.