Skip to main content
GameDev.net gamedev.net
🔒 Locked

Typical Near and Far plane values?

Started by GekkoCube Feb 11, 2003 at 10:24 AM 13 replies 13.3k views
Original Post
GekkoCube
GekkoCube
In a typical 3d first person shooter, what is the near and far plane values? what about in a landscape engine? I recently changed mine from 1000.0f to 100.0f for the far planes. im also wondering if a near plane of 0.0f makes that much of a difference from a 1.0f. because i dont notice anything different as far as clipping is concerned. thanks.
Expendable
Expendable
There is no standard. It really depends on what you need. Also keep in mind that your unit scale will likely be different from others. What do I mean? Well, does 1.0f = 1 foot, 1 meter, 100 meters, 1000 meters? It's up to you. So the values for near and far clip planes will have different meaning depending on your scale.

[edited by - Expendable on February 11, 2003 11:51:50 AM]
E-x-p-e-n-d-a-b-l-e
Joe Forhens
Joe Forhens
Setting ur Z buffer near clipping plane to 0.0f might result in rendering order not looking proper wich in turn has the effect wich would be the same as not having Z Buffering turned on .
Thank you all :)
GekkoCube
GekkoCube
THanks.
i pretty much understood everything.
(other than the question of "why a smaller near plane value results in poorer z-resolution?").

The main thing is this...how can i set the scale?
in other words, how can i set 1.0f to be equal to 100 meters or 100 feet???

where in my code setup is all this determined?
Brother Bob
Brother Bob
OpenGL have no sense of units. One OpenGL-unit can be whatever you want it to be. If you say that one OpenGL-unit is one foot long, then a far clip plane of 100 will be 100 feet away from the viepwoint. You don''t set this up in the code, you set it up in your head.
Brother Bob
Brother Bob
I don''t know where I got OpenGL from, probably because I though for a second this was the OpenGL forum. Sorry for that. Anyways, I assume the same applies for Direct3D or whatever API you use.
quasar3d
quasar3d
a 10 meter by 10 meter by 10 meter cube, with the camera 10 meter away looks exactly the same as a 1 feet by 1 feet by 1 feet cube, with the camera 1 feet away

My Site
GekkoCube
GekkoCube
I figured this as much.
BUT, i read alot of posts with specific unit formats, such as feet or meters or whatever. Why dont they just say units instead of meter or whatever? (was that clear to understand?)
GekkoCube
GekkoCube
Here''s an example of what im talking about...

I remember reading about a game being developed and how it boasted on it''s vast terrain/landscape.

It said something to the effect of 25 or so square miles of level exploration.

so if a mile is one unit, what''s the big deal if one unit could easily be 1 foot, or 1 inch even???
MrFreeze
MrFreeze
If you can't decide what values are best for your clipping planes, compute them new every frame according to sampled depth values. That's what I do:

Render your scene first with a very close and very far clipping plane. When the scene is rendered, read the z-buffer (with glReadPixels) at some specific points (5 around the center of the screen, and some others in the borders for example) and compute their corresponding distance from your camera. Then set your clipping planes for the next rendering as follow (for example):

nearClippingPlane = smallest_measured_depth_distance*0.1
farClippingPlane = biggest_measured_depth_distance*2.0

Repeat the last steps everytime you render your scene.

EDIT: Of course you should set a minimum limit for your near clipping plane (which you can compute with your scene size and the minimum relative distance between superposed planes) if you don't want to have z-fighting problems.

[edited by - MrFreeze on February 13, 2003 6:36:18 AM]
Prosper/LOADED
Prosper/LOADED
quote:
Original post by GekkoCube
Here''s an example of what im talking about...

I remember reading about a game being developed and how it boasted on it''s vast terrain/landscape.

It said something to the effect of 25 or so square miles of level exploration.

so if a mile is one unit, what''s the big deal if one unit could easily be 1 foot, or 1 inch even???


The trick is to always think in a relative way when you think about "size" in OpenGL (or any other 3D API). Objects size only make sense when compared to other objects.

Saying "my object is X units big" just doesn''t make sense. But if you say that your terrain is 1000x1000 units and that a typical car is 1 unit long, you can see your terrain has being 2000x2000 meters provided you consider a car to be something like 2 meters long.

Having a 100x100 units terrain and 0.1 unit car would give the same result too. Remember : that''s the size ratios that matters.

I hope I haven''t confused you even more with my bad english.
thona
thona
Just be careful that you take something you can easily work with.

1 unit = 1m is pretty easy to grasp (in "How many units high should the person be"), so it makes a lot of sense for planning. Once you ahve the data designed, it turns meaningless.

Regards

Thomas Tomiczek
THONA Consulting Ltd.
(Microsoft MVP C#/.NET)
RegardsThomas TomiczekTHONA Consulting Ltd.(Microsoft MVP C#/.NET)

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.