Skip to main content
GameDev.net gamedev.net
🔒 Locked

z-buffers explained

Started by Spiff Mar 7, 2000 at 12:46 AM 1 replies 650+ views
Original Post
Spiff
Spiff
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
============================Daniel Netz, Sentinel Design"I'm not stupid, I'm from Sweden" - Unknown
jaxson
jaxson
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 )
Spiff
Spiff
Ok, thanks, that''s just what I needed.

============================
Daniel Netz, Sentinel Design

"I'm not stupid, I'm from Sweden" - Unknown
============================Daniel Netz, Sentinel Design"I'm not stupid, I'm from Sweden" - Unknown

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.