Original Post
I have written my own software rasterizer, and I have been trying in vain to create and utilize a Z buffer. I use matrices for projection and transformations, of which I get my screen coordinates as the product of a projection matrix multiply. My polygons don't draw correctly using the z values given by this operation for the buffer, and linear interpolation of the z values is obviously out. Can anyone explain to me what it is that I need to do to get the z values for my buffer, preferably from the screen coordinates I generate, and how would I linear interpolate those values to get the depth value for an arbitrary point on the polygon?