Wow, this shader is great, it does everything I needed and runs fast. Here are a couple of quick changes for further usability.
Currently, the ambient set thru your material doesn't work properly. Here is the change in your shader code:
Code:
/*
return (
(color * 0.05f) + outSun +
((shadow1 * (color * diff1 + (spec1*gloss.w)) * (1 -Attenuation1))*vecLightColor[0])
);*/
return (
(color *vecAmbient) + outSun +
((shadow1 * (color * diff1 + (spec1*gloss.w)) * (1 -Attenuation1))*vecLightColor[0])
);
I hope that's changed right? But it works...
Also, fog doesn't work, if it's enabled your model will be all white. Change the technique in the shader code:
Code:
technique SpecularNormalMapping_20
{
pass P0
{
alphaBlendEnable = false;
srcBlend = zero;
//FogEnable=false;
//
VertexShader = compile vs_2_0 VS_PASS0();
PixelShader = compile ps_2_0 PS_PASS0();
}
//
pass P1
{
alphaBlendEnable = true;
srcBlend = One;
destBlend = One;
FogEnable=false;
VertexShader = compile vs_2_0 VS_PASS1();
PixelShader = compile ps_2_0 PS_PASS1();
}
}
Make sure the "fogenable = false" line isn't in your first pass or fog wont work at all. This is a common problem with A6 and fog.
Thanks alot for your work on this shader!