Now this is where it seems to cause the problem:
float4 PS_Directional(VSO input) : SV_TARGET
{
float4 output = float4(0.0f, 0.0f, 0.0f, 1.0f);
// Get Material ID
float materialID = tex2D(AlbedoBuffer, input.UV).a;
// Get Normals
half4 encodedNormal = tex2D(NormalBuffer, input.UV);
half3 Normal = mul(normalize(decode(encodedNormal)), inverseView);
if(materialID == 0.02f)
{
output = 1.0f;
}
return output;
}
As you can see I'm doing an if on the materialID to set a pixel color specifically for each objects material.
Now when I run this I just get a black screen, as it's (output) initialized at the beginning.
Running this in PIX I can see him going inside the if statement, setting output to the correct color and then going back to the if statement and returning 0.0f again.
What is going on here ? Why does it set the correct color and jump back afterwards to undo it ??