Jump to content
  • Advertisement
Sign in to follow this  

Depth Buffer question

This topic is 5154 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

16bit and 24 bit differences I have written my application on a machine using a geforce 4 mx, I specifically ask for 16 bit depth buffer always. My geforce 4 mx consistently gives it me. However my other machine ATI FireGL v3100 will only ever give me 24bit. On the 16 bit machine my overlayed polygons display fine after a little glPolygonOffsett()ing, however no combination of 24bit depth and glPolygonOffset()ing can get my other machine to display properly. I get z fighting and lots of it on the 24 bit. Should this not be the otherway round? Any ideas how i can remedy this? Thankyou Tom

Share this post

Link to post
Share on other sites
Yes I had that problem ! I my case, the solution was simple but I had to investigate a lot in order to understand what's going on.
When I am in 16 bits depth buffer, no problem, the glPolygonOffset does the job and when I use 24 bits, glPolygonOffset was not working (offset and bias has to be very large and I had allways the problem when the object is close to the observer).
The problem:
Imagine you want to draw 2 polygons that are absolutly co-planar. You want polygon 1 to be allways in front polygon 2.
When they are transformed in the world (view) coordinate, the polygon 1 came a little bit forward the polygon 2 (don't know why). Using a small value in PolygonOffset in 16 bits solve the problem, but using the same value (or bigger) in 24 bits doesn't because the 24 bits is much more precise close to the observer (exponential scale).

The solution:
Translate object 1 by a very small value in front of object 2 (let's say an invisible offset of 0.001 for example depending on what you are drawing) solves the problem for me.
Here 2 small drawings if it's clearer ?: Imagine I want to draw a traffic light with 2 polygons
What we expect (perfect world):

what we have in 24 bits when the object come closer:

[Edited by - jmaupay on September 7, 2005 8:16:59 AM]

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!