flight sim and the distant objects

Hello all,

I am coding a little sim ( by now just a 3ds planes viewer in a very simple flat aerodrome,
with replay, stars, etc…).
I am using OpenGL for rendering because it´s easier to learn.

However, I have a strange problem with this API :

When I take a look at the planes closer they are not so bad, however, as soon as
I look at them in the distance, the problems begins. The parts that are closer to the observer (we) are hidden (overwritten) by the distant ones most of the times.

The parts keeps floating one over the other.

I thought that my modifications in the 3ds loading routine were doing something
wrong but then I changed the Gametutorial code that loads 3ds files to take a look
at the models in the distance and the same problem appeared :frowning: ((((

I don´t know what to do.

My 3ds model is not attached: It is a multi objects model.
I thought that the problem could be here and then I changed the 3ds model in
3dMAX attaching all the parts but this didn´t fix teh rendering bug.

I think that this problem is related to the OpenGL initializing code.
I remember that some time ago I was using a simple initialization code I´ve found in the net ,and the 3ds loading routine couln´t deal with 3ds files with multi objects. All
the rendering was a horrible mess, then I start to study the Gametutorial
initialization code and most of the problem disappear but this one.

I am using glEnable(GL_CULL_FACE) and glEnable(GL_DEPTH_TEST);
( just in case someone is in doubt about it)

I am trying to fix this for some time and this morning I noticed
that I am slowly quitting when I start to read Frank Luna´s Directx 9.0
book that I buyed two months ago :slight_smile: )

Is this the solution ??

Diving into Directx and .X files ???

If so, it will be sad because OpenGl is great.

Well, Thanks in advance to this great community.

14-bis

It has to do with the depth buffer. I assume that depth testing is enabled. The problem is that the depth buffer is only 24 bit and its precision is based on the near and far clip planes. The smaller the near clip plane the less precise and same for the far. A small near clip plane causes greater reduction in precision of depth buffer. You can search the archives for more info on this or read about it in the red book.

yeah, for something like a flight SIM, you may want to push the near clipping volume as far out as possible …which should improve precision on the far plane.

Also, and I’m sure you’ve checked this, but, if you’re culling, are you using the right function according to how the polygons of your models are wound ?

Maybe on some of your 3ds models, some of the polygons are wound counterclockwise and on others, some are wound clockwise.

Might be worth it to check your models, one by one.