   XNA Shaders
  I'm getting some odd behaviour from a shader in XNA, even though the shader works fine in both ATI's RenderMonkey and NVIDIAs FX Composer.Part of my Vertex shader reads...    OUT.WorldNormal = mul(IN.Normal,WorldITXf).xyz;    OUT.WorldTangent = mul(IN.Tangent,WorldITXf).xyz;    OUT.WorldBinormal = mul(IN.Binormal,WorldITXf).xyz;These get passed to the pixel shader.  The following snippet is from the Pixel Shader...    float3 WN = normalize(IN.WorldNormal);    float3 WT = normalize(IN.WorldTangent);    float3 WB = normalize(IN.WorldBinormal);    WN += (bumpmap.x * WT) + (bumpmap.y * WB);Yes, I know the parenthesis is redundant, it's a readability habit I'm into.Problem is that the WT and WB (WorldTangent and WorldBinormal) are both zero which kills the bumpmapping by zeroing its .x and .y.  So, I amend to the following...    WN += bumpmap.x + bumpmap.y; ...and, by removing the tangent and binormal scaling, my bumpmap appears perfectly fine.  This makes me wonder exactly what the Tangent and Binormal calculation is needed for, and what am  losing by omitting them.Now, I'm happy to save some operations and permanently omit the Tangent and Binormal scaling of my bumps components even if it means I'm losing some accuracy - but I WOULD like to know exactly what I'm losing as I really can't tell.  But mainly, I'm wondering how I would handle this WITHOUT dropping the requirement for a Binormal and Tangent.  Is there some reason XNA isn't sending them, can I force XNA to send them?, Do I have to calculate them seperately ?How would I fix this without altering the shader ?Just in case it is relevant, here is where I supply the Matrices to the shader... seems pretty typical as far as I can tell. effect.Parameters["WorldITXf"].SetValue(Matrix.Transpose(world)); effect.Parameters["WvpXf"].SetValue(world * view * projection); effect.Parameters["WorldXf"].SetValue(world); effect.Parameters["ViewIXf"].SetValue(Matrix.Transpose(view));Any clues for me ?Many thanks,-GaryCh   
  You need your normal, tangent, and binormal (known as a tangent frame) for each vertex in order to transform normal maps from tangent-space to world or view-space. See when you make a normal map, you don't know the orientation of the geometry that it will be placed on. For instance you could put it on the top of a cube, or the bottom of a cube. So you use the tangent frame to transform the normal map values so that they're "correct" for the geometry that it's mapped to.Anyway when you load a Model in XNA, you can have the content pipeline generate a tangent frame for you. If you go to the properties of your model file in the Content project, there should be a option named "Generate Tangent Frame" or something similar.   ;Quote:Anyway when you load a Model in XNA, you can have the content pipeline generate a tangent frame for you. If you go to the properties of your model file in the Content project, there should be a option named "Generate Tangent Frame" or something similar.MJP, I owe you a cold beer or several!I was so interested in the Phong Specular and Cubemapped skybox reflections that I completely missed that my bumps were lit incongruently with the scene.  I guess I was just so happy I'd found the code that was preventing them and could finally see all my long texturing hours paying off instead of shiny smooth surfaces.I split my FX into two techniques, one bypassing the Tangent and Binormal and one using it.  I set the objects content processing parameters as you said and WOW.  Two bumped objects, one tracking the light and one looking great but not tracking the light source correctly.It also explains why I was having problems lining up my shaders lightsources with my sun sprites... I had assumed my vector math was wrong, not the reflections.  Spent a whole day headscratching about that one : )But that collapsed group of settings was the last place I would have looked!Cannot thank you enough M8.-GaryCh