shade29450

I was to mark a pixel for early-z culling, I have 2 shaders running consequitive. In the first pass I have disabled writting to the z-buffer and enabled z-test. The second pass the alpha value of the first passes results if this alpha value is above a threshold I wish to mark the fragment/pixel for early-z culling. I have pasted my effect setting just below. Somehow it does not seem to work, are there any documentation on how to invoke early-z

technique tEarlyZ
{
pass P1
{
CULLMODE = CCW;
ZEnable = TRUE;
ZWriteEnable = FALSE;
ZFUNC = GREATEREQUAL; // accept pixel if geq to depth value
AlphaTestEnable = FALSE;
AlphaBlendEnable = FALSE;

VertexShader = compile vs_3_0 vsPassthrough();
PixelShader = compile ps_3_0 psMark();
}

pass P2
{
CULLMODE = CCW;
ZWriteEnable = TRUE;
ZFUNC = ALWAYS;
VertexShader = compile vs_3_0 vsPassthrough();
PixelShader = compile ps_3_0 psEarlyZ();
}
}




Re: Game Technologies: Graphics early-z

shade

Cant be rigth that there is no documentation in the SDK on earl-z
It should be in hardware even on early geforce cards so some one must have tried it out




Re: Game Technologies: Graphics early-z

Ralf Kornmann

Early-Z is a transparent technique of modern GPUs. As it doesn¡¯t have an impact on the visual result there is no need to document it as part of the DirectX SDK. The only difference you may notice is in performance but there are multiple rules when it comes to Early-Z and they differ from one GPU to another.






Re: Game Technologies: Graphics early-z

shade

Transparent technique... Okay ;-) I think its more along the linie of at z culling unit which does not have the sligthest to do with transparency.

You can read up on early-z here (http://www.gpgpu.org/w/index.php/Code_Examples#Early-z)








Re: Game Technologies: Graphics early-z

Ralf Kornmann

I don¡¯t talk about the visual transparency that you can get with alpha blending. ¡°Transparent technique¡± was meant in the context that Early:Z is a GPU feature that works without special API calls or other additional code. That¡¯s the reason why you can¡¯t find anything about it in the DirectX SDK documentation. Sorry for this confusion.

As there are multiple different Early-Z implementations there a different rules for everyone. If you break one Early-Z will not work. As example a common reason for the deactivation of Early Z is the alpha test when combined with Z write. Another reason are pixel shaders that change the depth value. You can find more details in the developer documentation from the IHVs.






Re: Game Technologies: Graphics early-z

shade

Fair enough.

Could you point my out to where NVIDIA talks about early-z specifically for their platforms like the NV40






Re: Game Technologies: Graphics early-z

Ralf Kornmann

The programming guide should be a good starting point.