Jump to content
  • Advertisement

Archived

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

GekkoCube

z-buffering VS no z-buffering - that is the question

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

This question might seem stupid, and it probably is. But I was just wondering.... right now my terrain engine uses z-buffering. is there anything that would require the disabling of z-writing? such as water, skybox,...etc? ~ I am a DirectX to OpenGL convert! ~

Share this post


Link to post
Share on other sites
Advertisement
you also disable writting to the z-buffer when you''re doing transparent effects... first you draw everything thats solid with z-buffer writing/check enabled..... then you disable z-buffer writing.... but keep z-buffer checking on .... and draw all your transparent effects... water... glass... particles ... etc.... that way... you disable z-buffer writting... so that if multiple transparent effects overlap... one doesn''t obscure the other.... but you keep z-buffer checking enabled ... so that solid objects that were previously drawn still obscure transparent objects that are behind them. Hope that helps

Share this post


Link to post
Share on other sites
Does anyone know what parts of z-buffer usage are the slowest. Obviously turning on the z-buffer is going to slow you down, but is this due mostly to z-checking or z-writing? The reason I ask is that for the main part of my scene, a cylindrical tunnel, I know that if I draw the segments in reverse I could turn off z-checking and still get the right image drawn. However, I would still need to write to the z-buffer to stop geometry drawn later from showing up where it shouldn''t. There is also the problem that from what I can see D3D doesn''t let you have z-checking off with z-writing on. I haven''t looked if GL lets you yet.

Thanks for any thoughts.

Cameron

Share this post


Link to post
Share on other sites
quote:
Original post by kamrann
Does anyone know what parts of z-buffer usage are the slowest. Obviously turning on the z-buffer is going to slow you down, but is this due mostly to z-checking or z-writing? The reason I ask is that for the main part of my scene, a cylindrical tunnel, I know that if I draw the segments in reverse I could turn off z-checking and still get the right image drawn. However, I would still need to write to the z-buffer to stop geometry drawn later from showing up where it shouldn't. There is also the problem that from what I can see D3D doesn't let you have z-checking off with z-writing on. I haven't looked if GL lets you yet.



I don't think you can turn off checking but leave writing on - that would almost certainly result in either a completely pointless Z buffer, or very weird results.

Most graphics cards will have some sort of early exit path from their Z buffering algorithms - if you can draw your scene front to back, then you will get better performance than if you draw randomly (or back to front)



Edited by - Sandman on February 27, 2002 7:44:27 AM

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Front to back sorting is in general the most effective, because of the early Z test in at least TNT GeForce cards.

Disabeling Z writes could be quite effektive, on sorted geometry. Terrains should be ok for this.

Z-Buffer writes is possible to disable in OpenGL by calling.

glDepthMask( GL_FALSE );

Use Alpha test to render totally transperant pixels (alpha == 0), in a cheap way.

Sort all geoemetry with 0.0 < alpha > 1.0. This is the only way to get things right. Sort all objects back to front.

Per object, you hvae to render two times: Render two passes to get front face and backface polygons in an object correct. This is correct

This fails when objects intersect. Cass Everitt @ NVIDIA did an demo on how this right.

--
VK

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!