Jump to content
  • Advertisement
Sign in to follow this  
lorddanny

Camera Far-clipping plane.

This topic is 2521 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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).

Share this post


Link to post
Share on other sites
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).

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!