/Madcat in
Ye, what exactly does a Z buffer do? I think we`ve had the topic covered serveral times, but i didnt get the major point. Waiting for BFG or someone else with tech insight regarding the matter to chime in!
Zbuffer is the depth buffer. If there is a scene, all pixels are stored in the Zbuffer (in most software) and it indicates the range of the pixel from the camera. It's typicall 24 bits (16.7 million). For example: You have a camera which sees betwen depth of 1 to 1000 (if you notice in some games as you get close to a polygon you can see through it as if its being clipped) and a "foggy" polygon in the distance at 1000, each pixel gets mapped in that range to the zbuffer, a range from 0 to 16.7 million. So at the distance of 1000, it writes 16.7 million into the depth buffer. If you write something into the pixel at 500 distance from the camera, it checks the zbuffer. See's that its value is 8.5 million distance from the camera, and decides that the pixel is in front, and overlays the existing pixel in the zbuffer. If it then draws another polygon at location 750, it would go into the zbuffer in the 12 million location notices that the other pixel is at the closer distance would obscure the pixel and does not write it (saving pixel shader time, etc since it doesn't have to render the pixel).
This allows the developer to not worry about sorting the scene and draw from back to front to make sure things far away don't overwrite objects closer to the camera. It's also used to increase performance because lets say you have something immediately in front of the camera in zbuffer position 0 (like a wall blocking the entire view), and want to write out an object at the back, it can discard the entire rendering step because it already knows your view is blocked and throws away the rendering call.
So, the zbuffer is used 2 fold. Makes sure objects draw at a distance doesnt draw ontop of objects close, and if the developer chooses to sort, and does so front to back, it will increase performance.
If you don't use a zbuffer you have to sort back to front and you have to draw every object (hitting the same pixel potentially, calling its pixel shader multiple times, and that slows things down.)
You may have heard the term "zfighting" before. That's usually caused by multiple objects in the distance that have a similar if not the same zbuffer location, and one time it draws from the first object, other times the 2nd object, which cause rendering artifacts.