Sign in to follow this  

A little problem with Z writing and culling

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

I am making a simple mesh viewer. I made an option to see the mesh with solid fill but to also see edged faces, I implemented this by rendering the mesh twice: first time is a normal render (solid) but with Z writing disabled, and second time with wireframe fill and with Z write enabled (and shader to change the color, but that doesn't matter). I disable the Z writing in the first time so that direct3d won't have to guess which one is first to be shown (BTW: why isn't just in the same order I draw them? without the Z disabled, just parts of the edged face lines were shown). The problem is this: when I disable backface culling, the first (solid) render will apear terrible because the back faces will be shown. How to solve this? Would disabling the z buffer at the 2nd render instead of disabling the Z writing in the first one help?

Share this post


Link to post
Share on other sites
Why are you even disabling z-writes? With the Z-Test set to LessEqual (which is also the default, I think), the wireframe should show "over" the solid, just like I assume you want.

If you want the wireframe to show also for backfacing triangles, you could try clearing the z-buffer after the first draw.

Hope this helps.

Share this post


Link to post
Share on other sites

This topic is 4075 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.

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