Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


Question about ZBuffers...

This topic is 6442 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

Ive created a ZBuffer in my direct x application, and set the render state to use z buffering but am running into a bit of a problem. I am using transformed and lit vertexes, and if the z value is anything greater then .0000001 or something the object will not draw on the screen, even if there is nothing else on the screen. Is there a minimum and maximum z value applied to the zbuffer? How is precision determined, becuase if I blit 2 triangles (tranformed and lit) to the surface it doesnt seem to apply a ver precisice calculation. I want to use 3d sprites in Direct 3d and use the z buffer to determin which overlap which. Any suggestions? Lep

Share this post

Link to post
Share on other sites
just some ideas out of many possibilities...

1) make sure you clear the z buffer every frame
2) (fyi, z buffers have a floating point precision problem, but it should be good enough for most needs) that small number may be written as a zero value because when the triangle is rasterized, the calculations reduce the precision even more and produce a depth value of 0.
3) the z buffer comparison function may be messed up, or writing things the "wrong" way (perhaps it''s taking 0 as closest, larger values as farther, or even perhaps negative values as farther). im not totally sure about the specifics of directx settings.

hope this helps.

Share this post

Link to post
Share on other sites

  • 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!