Sign in to follow this  
Arkan123

Zbuffer Test

Recommended Posts

Usually, you would let Direct3D or OpenGL take care of the Z-buffer aspects. You would enable Z-buffering with Direct3D with IDirect3DDevice9::SetRenderState and glEnable with OpenGL.

Z-buffering is the term for when two Z values are compared. The Z-buffer function is the condition that is used to accept or reject a value. Z-buffering can help with rendering. If an object is behind another object and it is drawn last; it will obviously overlap the first object. With Z-buffering, you can use the z value to help determine the proper pixel to be drawn. Hence, the object is back will lot overlap the object in front.

Technically, how the pixel is determined is based of the Z-function, or z-func for short. Some of these z-functions are: less-then, equal to, and greater then. The names of the functions give away there use with the Z-buffer.

You would not use Z-buffering to find if an object is behind a wall or not. You have to find another way of doing this. Try using the objects position relative to the walls position. I hope that helped. Look up on Google for collision detection algorithms, clicky! Or look here on GameDev

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