• Create Account

### #ActualKhatharr

Posted 31 January 2013 - 05:07 AM

If you have a zbuffer (aka depth buffer) then whenever you render something the following steps are taken on a per-pixel basis:

new_z = //z value for this pixel based on what you're rendering
depth_z = //z value for that pixel in the zbuffer
if(depth_z > new_z) { //this test is configurable - it's called the 'depth test' (see MSDN)
depth_z = new_z
pixel_color = new_pixel_color
}
else {
}

Unless you're doing some special effects with the buffer you typically want to clear it every frame before drawing. The common use is simply to make sure that if you draw something and then draw another thing that overlaps the same pixels the correct pixel colors will be 'on top'.

http://en.wikipedia.org/wiki/Z-buffering

### #2Khatharr

Posted 31 January 2013 - 05:03 AM

If you have a zbuffer (aka depth buffer) then whenever you render something the following steps are taken on a per-pixel basis:

new_z = //z value for this pixel based on what you're rendering
depth_z = //z value for that pixel in the zbuffer
if(depth_z < new_z) { //this test is configurable - it's called the 'depth test' (see MSDN)
depth_z = new_z
pixel_color = new_pixel_color
}
else {
}

### #1Khatharr

Posted 31 January 2013 - 05:03 AM

If you have a zbuffer (aka depth buffer) then whenever you render something the following steps are taken on a per-pixel basis:

new_z = z value for this pixel based on what you're rendering
depth_z = z value for that pixel in the zbuffer
if(depth_z < new_z) { //this test is configurable - it's called the 'depth test' (see MSDN)
depth_z = new_z
pixel_color = new_pixel_color
}
else {
}