   Vertex shader lighting - math help
  I think I need a refresher on my 3D math.  Could anyone tell me what I'm doing wrong with this vertex shader code?  I'm just trying to do basic lighting, but its not comming out right.  This could also be correct, and maybe I'm just not calculating the ViewMatrix variable correctly.output.uv.x = input.uv.x;output.uv.y = input.uv.y;input.position.w = 1.0f;output.position = mul(input.position, ViewProjMatrix);// Transform positions.LightPosition.w = 1.0f;LightPosition = mul(LightPosition, ViewMatrix);input.position = mul(input.position, ViewMatrix);// Use LightPosition as vector TO the light.LightPosition = LightPosition - input.position;// Transform normal with ViewMatrix.input.normal.w = 0.0f;input.normal = mul(input.normal, ViewMatrix);// Calculate light exposure.float s = dot(LightPosition, input.normal);if( s < 0.0f )s = 0.0f;output.diffuse =(AmbientMtrl * AmbientLightIntensity) +(s * (DiffuseLightIntensity * DiffuseMtrl));return output;   
  You never said what the problem that you are having is!  Even so, it looks like you are using float4 variables which could cause problems when you do a normalization or dot product.  If you intend to use a float3, then suffix your vector variables with *.xyz to only get the part that you want.If that doesn't solve it, you'll have to describe what it is or isn't doing to get more help!   ;  The problem is just that the lighting isnt comming from the  right direction or something.  I was just hoping someone could see a problem from the way im doing the math.  Are the normals being transformed correctly etc....  My matrix and vector math isnt as good as I would like it to be.   