Sign in to follow this  

implementing a z-buffer

Recommended Posts

hi, I was wondering how to approach implementing a z buffer in my software renderer. I thought maybe I could use my perspective correct texture mapping function as this interpolates the reciprocal of z anyway and then save the reciprocal in the z buffer at the specific x, y location, then if this value is greater than the last - copy the pixel to an adjacent array(surface in direct draw) which stores the pixels, then simply blit the image after all triangles are draw, but as this is the first time Ive tried this im not sure this is the way to do it? also, what would usally be required of a software renderer in terms of hidden surface removal, If im creating large (static) environments etc. I know the best thing to use would be BSP trees but this (im sure) has nothing to do with the renderer. would I have to create separate functionality for rendering using the z-buffer and without(when using bsp trees)?

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this