Jump to content
  • Advertisement
Sign in to follow this  
Arkan123

Zbuffer Test

This topic is 5021 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

How do you perferm a zbuffer test for a specific crc in C++. And is that how you check if a player is behind a wall or not?

Share this post


Link to post
Share on other sites
Advertisement
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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!