yeah, I'm out for tonight. but I'm still not sure why the shader isn't working. It is a strange result, and hard to explain without showing. it worked in the normal mapping shader I posted, but not in this one. With a model terrain too! why?
Code:
{
Vertex Shader:
float3x3 worldToTangentSpace;
worldToTangentSpace[0] = mul(inTangent, matWorld);
worldToTangentSpace[1] = mul(cross(inTangent, inNormal), matWorld);
worldToTangentSpace[2] = mul(inNormal, matWorld);
Out.Sun = mul(worldToTangentSpace, -vecSunDir);
Pixel Shader:
float4 output = saturate(dot(bumpNormal, In.Sun))l
return output;
}
I'm out for the night. Sorry. Too much "Russian mineral water"...