Disabling the near clipping plane?

Is there any way I can disable the near clipping plane? Or at least, make it approach 0 without distorting my world?
I’m currently using the following:

glFrustum(-1.0, 1.0, -1.0, 1.0, near, 200.0);


near = 1.0 in here. Although it works fine, gl is clipping my polygons 1.0 meters away from the camera, which is bad. Appart from scaling everything up (by a factor of 100, which is bad for the z-buffer), what would be another solution to my problem?


I’ve found a temporary workaround, which is to use glScalef(10, 10, 10) after glLoadIdentity(). Any real fix though?

Just set it to 0.0001f

Be aware, setting the near plane TOO close, will kill the z-buffer. So this is not recomended. Same effect with placing the far plane too far away.

The problem is that setting the near clipping plane to anything but 1.0f distorts what I render, making a very cool warping effect of some sort :slight_smile: but it doesn’t fix the problem. Unless the problem is with glFrustum; is there a way to manually set those, without messaing with all those amtrix calcs?

You can’t disable the near clip plane. It’s there because it’s a fundamental aspect of cameras… not just opengl cameras, but ALL cameras. The near clip plane is effectively the retinal plane… the thing that captures the light from the lens. The far plane is a device introduced by graphcis cameras to get around precision problems, and so you could (theoreticaly) disable THAT. real cameras don’t have a far plane, but they certainly have a retinal plane.


The image distorts if you set the near plane too close because as Z nears 0, X approaches infinity. If you were to remove the near plane no polygons would be cliped and the would would be completely distorted to the point where it would be unviewable.

There was a thread several weeks ago which discussed this topic. If I remember correctly the distortion occurs because of a combination of the near AND far clipping planes. It’s a matter of playing around with both Planes until you get the right ratio. You could use gluPerspective to make it easier or set your collision detection to prevent you from getting too close to an object.

I use the following code with my latest programme and I don’t get any problems.


While we are into the discussion about near/far plane, and z-buffer distortion, I can add this. When setting the near and far plane, you get a near to far ratio (ratio=far/near), and you will loose log2(ratio) bits of depthbuffer precision (log2(ratio) is the two-logarithm or ratio). So, if you let the near plane approach zero, ratio will approach infinity, and you will loose ‘infinity’ number of bits in you depthbuffer, but you generally only have 16 or 32 of 'em
Same effect when far approaches infinity.

So this tells us one thing, keep the near to far ratio as small as possible, or you will loose depthprecision (VERY important if you are using 16-bit depthbuffer)

gluPerspective is good when you want to setup a standar camera for games and similar application. But when you want the frustum to cover a certain part of the world, and no more, you are more or less forced to use glFrustum (don’t get me wrong, I use gluPerspective most of the time, and I like it too, but it has it’s drawbacks sometimes )

You can’t not have the near plane. You can theoretically set it to the plane at infinity, but it IS used to define projection.
Why? Because projection is a matrix to take a dimensional space to a lesser dimensional space. In this case you’re talking about projecting 3D onto a 2D plane (as opposed to some 4D space onto a 3D space, or a 5D space onto a 1D space or whatever you want to make up). The near plane IS the resulting plane of projecting 3D onto 2D. It MUST, by defn of projection, therefore exist.

Setting the retinal/near plane to inf gives ortho proj. Anything else gives perspective.