Advertisement Jump to content
Sign in to follow this  

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.

If you intended to correct an error in the post then please contact us.

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();
				PixelShader  = NULL;
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();
	PixelShader  = compile ps_2_0 PSDiffuseTextureShadow();
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)

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!