How to avoid depth fighting

Started by
11 comments, last by mmakrzem 10 years, 8 months ago

Or you could use the stencil buffer to so something like, don't draw the part of the wall that the door cover, so there's no zfighthing at all.

With Z-Culling enabled this should solve your problem, that's what i did for something similar in my game before.

You just use the door to make the stencil "mask", before drawing the walls, then draw the walls using the stencil buffer as a mask, then turn the stenciling off and draw the door again normaly.

Advertisement

Z-buffering with Offsetting special features away (sufficiently) from the basic wall plane is probably the simplest. Those if the door opens inward then you will need to have a gap in the continuous wall

--------------------------------------------[size="1"]Ratings are Opinion, not Fact

A stencil buffer can be used to prevent you from rendering at certain locations in your buffer, thus you can create "holes". Have a look here for sample code:

http://en.wikipedia.org/wiki/Stencil_buffer

This topic is closed to new replies.

Advertisement