# Z Only

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

## Recommended Posts

I'm having problems with my Z Only pass in the beginning of my frame. It should ( as you all propably figured out ) render the Z Value to the Z Buffer ( thereby making it easier for me to reduce overdraw ). Now, I'm currently using shaders to do all my statechaning and my ZOnly technique looks like this :
        ZEnable          = TRUE;
ZWriteEnable     = TRUE;
StencilEnable 	 = FALSE;
ZFunc		 = LESSEQUAL;

ColorWriteEnable = 0;

CullMode         = NONE;

VertexShader = compile vs_1_1 VSSimple();

After doing that most of the pixels that I draw are not visible... Here is the normal rendering I do after the Z Only ( the renderstates that is)
        ZEnable          = TRUE;
ZWriteEnable     = FALSE;
StencilEnable 	 = FALSE;
ZFunc		= EQUAL;
AlphaBlendEnable = FALSE;
ColorWriteEnable = RED|GREEN|BLUE|ALPHA;
CullMode         = CW;

VertexShader = compile vs_2_0 VSVertexLighting2();

If I disable the Z Only pass my geometry is displayed perfecly so it should be a renderstate error, I'm curious if ColorWriteEnable dosen't work like I use it, I've tryed doing it another way, by Enabling ColorWrite (all channels) and using these renderstates instead :
      	AlphaBlendEnable = TRUE;
SrcBlend				 = ZERO;
DestBlend				 = ZERO;

But it dosen't seem to work any better ( acctually If i enable the last code and do only the ZOnly pass it acctually draws alots of pixels (even though they it was mean't not to)

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

(You must login to your GameDev.net account.)

• 11
• 15
• 11
• 11
• 9
• ### Forum Statistics

• Total Topics
634151
• Total Posts
3015825
×