Camera Far-clipping plane.

Started by
3 comments, last by Hodgman 12 years, 3 months ago
Hi guys,

Just a quick question. Around what values (in floats) are used for the Camera's Far-clipping plane in todays modern fps games? Does it base on the gameplay and situation? For example, if the camera is attached to a soldier, the far clipping plane wouldn't be too far. Whereas if the camera is on a airplane (doing Dogfights and so on), the far clipping plane will be greater?

Hope this makes sense.

Thanks
Advertisement
I imagine it varies widely per game. some might want massive draw distances, others might want intense immediate surroundings.

Why do you want to know?
Many games use their own units, so the actual farplane in floats they provide to OpenGL or DirectX has little meaning. Also don't forget that the bigger the farplane is, the less accurate the depth buffer becomes (since in general, most of the scene is actually located very close to the camera, only landscapes or whatever are located at the far plane, so if your far plane is too big you might get z-fighting for close objects).

“If I understand the standard right it is legal and safe to do this but the resulting value could be anything.”

Generally speaking the near/far planes are going to be the same whatever you are doing, however there is nothing saying you have to have a single near/far plane setup.

A common method to get large draw distances is to do it in two, or more, passes. The first pass would be a short distance (say 0.02 near, 333.0 far) to ensure you have enough detail close up, and then a second near/far setup of say 333.0 near and 5000.0 far. So if you were using 1.0f == 1m you'd have a near clip plane 2cm away from the canera and a far of 333m away for the first pass and 333m to 5Km for the second.

In each pass you only draw the objects within that range (and the later is a good point to use simplified shaders).

This does have an impact on things like post processing effects etc as you no longer have a single depth range but this can be worked around (and doing so is left as an exercise for the reader).
In theory, you want to set the near plane to be as large as possible, and the far plane to be as near as possible.

games use their own units, so the actual farplane in floats they provide to OpenGL or DirectX has little meaning.
Quoted for emphasis -- in some games 1unit will be one metre, in other games it might be one inch, in another it might be a kilometre.
Also don't forget that the bigger the farplane is, the less accurate the depth buffer becomes[/quote]N.B. the far-plane value does have some impact on your z-buffer accuracy, but the value of the near-plane is much, much more important -- approximately half of your z-buffer bit-depth is dedicated to the depth values up to twice the distance of the near-plane.
e.g. if we assume you've got a 16-bit depth buffer (range 0-65535) and you set your near plane to 1cm and far to 1km, then depths of 1cm are mapped to z=0, 2cm mapped to z~=32768, and 1km mapped to z=65535... most of your precision is wasted on objects between 1cm and 2cm, whereas objects from 2cm to 1km get the same number of values spread over them as that first centimetre did.

This topic is closed to new replies.

Advertisement