Original Post
Hey Everyone, well I'm not sure about this...maybe I'm just not seeing it...but it just seems like a wierd problem this. Just passing a normal from the vertex shader to the pixel shader. If I set the normal to a constant in vertex shader fx file like this: OUT.normal = float4(0 , 0, -1.0f , 0); And in my pixel shader function, I do this: float4 FinalColour = float4(1,0,0,1); float4 light = float4( 0.0f, 0.0f, -1.0f, 0.0f ); FinalColour = FinalColour * dot(IN.normal, light); It should produce a FinalColour output of red!...as the dot product of the light and normal should produce 1! But it doesn't. Its black! This is the problem, if I set the normal to (0,0,1,0) in the vertex function and set the light direction to (0,0,1,0) in the pixel shader the dot product seems to work okay. Also if I do a small variable in the pixel shader function like so: float4 norm = float4( 0.0f, 0.0f, -1.0f, 0.0f ); And do the dot product of the two, dot(light,norm) where there both negative, this works as well....just when the value in the vertex shader is negative. I'm only doing a z value, as I'm testing for a simple light direction, which is into the screen. Hope I've explained it okay...just not right? I mean maybe I'm missing something...maybe theres a maths thing...or a thing with shaders on passing negative values? Any ideas on this? Or how to maybe fix it? What to try next? Thanks, Ben Little details on the structurs I use to pass the data // This isn't really needed as we are just setting it to constant for debugging struct vertexInput { float3 position : POSITION; float3 normal : NORMAL; float2 texCoordDiffuse : TEXCOORD0; float2 texCoord2 : TEXCOORD1; }; // Set to float4 for a normal!...should be okay. struct vertexOutput { float4 HPOS : POSITION; float4 normal : TEXCOORD0; float4 T0 : TEXCOORD1; // fur alpha float4 T1 : TEXCOORD2; // fur offset / interfur shadowing };