# culling polygons (when too near)

Hi,
I’m still working on my 3D-shooter, and my actual Problem is, that when I’m too close to an Oject (some Polygons), I can look through it, although it’s actually in front of me.
I’ve got that problem since I changed the “near”-parameter of the gluPerspective(…) function from 0.01f to 1.0f (because I’ve read that this parameter should be >= 1.0f).

What can I do?

peter

What you can do is to move it back again (it does not have to be greater than 1.0). Just make sure you don’t set it to zero or less.

Hello,
I’ve just read that the z-Buffer doesn’t work fine if the near-value of the gluPerspective-function gets to close to zero. It’s right that it’s not allowed to set it zero or less, but it is recommended to set it at least at 1.0f.
I’ve tried settin the near-value to 0.001f, and the result was very bad. At 0.01f it’s not so very bad, but worse than at 1.0f.

Isn’t there another solution to avoid the clipping-effect?

peter2345

Prevent the player from moving so close to the object?

Setting zNear less than 1 is ok, as long as you also change zFar so that the zNear to zFar ratio remains reasonable. I usually try to keep the ratio around 1000 for 16 bit depth, and 10000 for 24 bit depth, though that may be a bit conservative.

I’ve just read that the z-Buffer doesn’t work fine if the near-value of the gluPerspective-function gets to close to zero.

Both right and wrong. If the zNear get clsoe to zero, you MIGHT have some strange behaviour in the Z-buffer, but that depends in the zFar value. As DFrey says, the absolute value does not matter, but zNear relative the zFar does. The Z-buffer will only behave strange if the near Z-plane is close to zero AND the far plane is far away (thats relative, as DFrey said, a ratio of about 1-10k is good). Having a zNear or 0.0001 and a zFar of 0.1 is not bad at all.