Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

z-buffers explained

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

We''re having a little discussion at a VB game programming forum about z-buffers. Can anyone give me a correct and somewhat short explanation of what they do? Thanks in advance ============================ Daniel Netz, Sentinel Design "I'm not stupid, I'm from Sweden" - Unknown

Share this post


Link to post
Share on other sites
Advertisement
The very short explanation is that a z-buffer keeps track of what ''depth'' each pixel on the screen has been drawn at so far in the rendering process. For example, suppose you drew a polygon to the screen, and at one particular pixel, the z-value was 50. Then, if you draw another polygon, you check each pixel to see if it''s z-value is ''behind'' the old one. If it is, you don''t draw the pixel, but if not, you draw the pixel and update the z-buffer.

I hope this makes sense. You are pretty much keeping a running total of which colors should be on ''top'' in each pixel location. This way, you prevent a little overdraw, but you also mainly keep from overlapping parts of polygons that shouldn''t be visible from the perspective of your 3d viewpoint.

(Sorry, if that''s confusing. I''m tired )

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!