OGL:RealWorld measure ratio

Hi,

Currently I’m working on a small flight simulation (with terrain etc.) Now I know that depth buffer precision is directly dependent of distance between far and near clipping planes (correct me please if I’m wrong). Here in forums I have read an advice to have the far plane at 1000 maximum.

So lets say that I’ll use gluPerspective(45.0f, h/w, 0.1f, 1000.0f);

Now I have a fighter modeled in Max. Its characteristics are: Length 30 meters, Width 20 m and Height 10m.

If I’ll use 1:1 ratio (1m = 1 ogl unit) then near the far plane my fighter is still visible (meaning its dimensions in pixels, its not a dot). Bigger objects will be cut by the far plane, generating ugly results.

My question is: how do you visualize the real world objects. How do you store your object. I would like to know you solutions from your experiences.

I may guess that objects should be stored in their original sizes (for collision detection etc.) and use a sort of scale for rendering. Something like this:


glPushMatrix();
glScalef(…);
[Draw Fighter];
glPopMatrix();

Am I right?

Thank you in advance,
Alexandru (a.k.a. Maverick)

Hi,

I use the scale 1m = 1 opengl unit for all objects. If some object isn’t modelled in this scale, I scale it at load time. Note that if you use glScalef with opengl lighting, you will have to enable GL_NORMALIZE, which may cause a slowdown.

As for your far clipping plane issue, it’s perfectly ok to use far clipping plane further than that. What counts is the far/near ratio, so if you want to set your far plane to 5000, just move near to 0.5.

-Ilkka

Thanx for the hint.

Suppose you have a mountain about 5000m heigh. What whould be your glPerspective parameters?

BTW what FOV do you often use (for 1m = 1ogl unit)?

Regards,
Alexandru

Usually I use a 60 degree fov. A nice way for you to get decent near/far values could be to first push the far plane so far back that you can see all you want to, and then push near far enough to get rid of precision problems. Actually drawing the terrain that far in realtime is another thing, you may need to look into some level of detail algorithms.

On a sidenote, are you sure your models are in a right scale? Is a fighter really 10m high?

-Ilkka

Thanx for advice. I’ve looked into terrain LOD algorithms.

The scale is ok, it’s a SciFi fighter

Just to clarify about far/near ratio. What should I target for, in order to have some good results.

Alexandru

I’m not sure about the optimal ratio, I think it’s around 1000, but for your situation that seems too low. 5000 could be ok too, it depends on the scene somewhat.

-Ilkka