Hey
Im having a bit of trouble when writting two shaders ( two materials ) in FX composer. I have one object that is partly occluded by another transparent object. I have set up my Z-Buffers so that the transparent object should write to the Z Buffer (thereby occluding the object behind it). My problem is that it dosent work, it looks like I have disabled the Z Buffer. I will post a picture and some code to clarify.
Is it so that FX Composer resets the buffer in between objects so I get a new Z Buffer in every material?
Here is a picture of my problem, parts of the sphere should not be seen.
A note about the picture, I dont use the spotlight visible in the picture.
Here is the material for the sphere ( the VS and PS just do standard transformation and texture lookup)
technique t0
{
pass p0
{
ZEnable = TRUE;
ZWriteEnable = TRUE;
AlphaBlendEnable = FALSE;
CullMode = NONE;
Ambient = 0xFFFFFF;
VertexShader = compile vs_1_1 VSpassthrough();
PixelShader = compile ps_1_1 PSpassthrough();
}
}
Here is the materual for the transparent surface, the vertex does some standard transformation and the PS just writes a color ( White ).
technique t0
{
pass p0
{
ZEnable = TRUE;
ZWriteEnable = TRUE;
AlphaBlendEnable = TRUE;
DestBlend = srcalpha;
SrcBlend = invsrcColor;
CullMode = NONE;
StencilEnable = FALSE;
VertexShader = compile vs_1_1 VSlighting();
PixelShader = compile ps_2_0 test();
}
}