Problem with the depth buffer and lighting

I am programming a space shooter and I am having a probleme with my planets and lighting.

When I am close to them, they appear correctly see image 1.

Image 1

But when I move far away from the planets the surface loses its lighting. See image 2

Image 2

I uspect settings of the depth buffer is to blame.

Thanks for any answers.

[This message has been edited by Handkor (edited 03-22-2001).]

For those who want to try my program here is a link.

The arrow keys turns the ship, + and - changes the speed and F1-F6 keys changes the camera position.

The models are .ASE files and you can edit demo.sol in the data subdirectory to change the environment.

[This message has been edited by Handkor (edited 03-22-2001).]

Yes, perhaps is it because of the far setting of the depth buffer this happens. Just setting a bigger value should fix it but probably leads to new problems since the precision gets worse. You see far object suddenly disappering in many games.

It’s Z-buffer artifacts that appear when the near to far ratio is too big. Move the near clipping plane as far away as possible. Because the bigger the near to far ratio (value of far divided by the value of near) is, the more precision you loose in your depthbuffer.

If you have z-buffer problems on spheres, than enable back face culling.
Another reason could be wrong mipmaps. Far away objects use minification with lower levels of detail textures. Maybe some are broken.

Thank you all ,ajusting my near far ratio of the depth buffer seems to have worked and I will try backface culling.

By the way I did not use MipMaps.

[This message has been edited by Handkor (edited 03-23-2001).]

Originally posted by Relic:
…Far away objects use minification with lower levels of detail textures. Maybe some are broken.

Is the use of mipmaps determinated by the mag filtering mode (Only when the value is GL_LINEAR_MIPMAP_LINEAR, GL_MIPMAP,…) ?

Enabling Backface Culling was the answer, I increased my far/near ratio and no artifacts appear.

This isn’t an image of the day forum but I felt like commenting. The first pic looks good but you have stars appearing infront of the planet which is wrong.

Actually Tim, it’s not a star, if you download the program and move around, you will notice that those are little dust particles that fade in and out around the ship. In a still picture it looks like a star since the dust particles are simply points but it’s not an error. To remove the dust particles simply set the dustfield to 0 in the demo.sol file.

Sorry, I have downloaded it and it looks good.