   CG shader
  hy , i have this fragment of a shader , the problem is that it enter in all the section where i calculate the diffuse per light , also if the light direction vector is 0,0,0,0like:if( length(Light1ModelDirection.xyz)>0){i'm set the value of Light1ModelDirection at 0,0,0,0 in c++ with opengl, why it enter?this is the shader:float4 GetDirectionalLightFactors(    float3 kModelPosition,    float3 kModelNormal,    float3 kCameraPosition,    float3 kLightDirection,    float  fSpecularExponent){    float fNDotLDir = dot(kModelNormal, -kLightDirection);    float3 kViewVector = normalize(kCameraPosition - kModelPosition);    float3 kHalfVector = normalize(kViewVector - kLightDirection);    float fNDotHDir = dot(kModelNormal, kHalfVector);   return lit(fNDotLDir, fNDotHDir, fSpecularExponent);}struct appin{    float4 Position : POSITION;    float4 Normal : NORMAL;};struct vertout{    float4 HPosition : POSITION;    float3 texCoord : TEXCOORD;float4 Color : COLOR;};#if 1uniform float4x4 WVPMatrix;uniform float4x4 WVMatrix;uniform float4 Light0ModelDirection;uniform float4 Light1ModelDirection;uniform float4 Light2ModelDirection;uniform float4 Light3ModelDirection;vertout v_Ferrari(appin IN){    vertout OUT;    // Transform vertex position into homogenous clip-space.    //OUT.HPosition = mul(WVPMatrix, IN.Position);    OUT.HPosition = mul(IN.Position, WVPMatrix);float3 eyeVec = -normalize(mul(IN.Position, WVMatrix).xyz);    // Transform normal from model-space to view-space.    //float3 normalVec = normalize(mul(VMatrixIT, IN.Normal).xyz);    float3 normalVec = normalize(mul(IN.Normal, WVMatrix).xyz);    // Store normalized light vector.    //float3 LIGHT0_MODEL_DIRECTION_N = normalize(Light0ModelDirection.xyz);    float3 halfVec = float3( 0, 0, 0 );float diffuse = 0;float specular =0 ;float4 lighting ; if( length(Light0ModelDirection.xyz) >0 ) {float3 LIGHT0_VIEW_DIRECTION_N = -normalize(mul(Light0ModelDirection, WVMatrix).xyz);halfVec = normalize(LIGHT0_VIEW_DIRECTION_N + eyeVec);diffuse+= dot(normalVec, LIGHT0_VIEW_DIRECTION_N);specular+= dot(normalVec, halfVec);}if( length(Light1ModelDirection.xyz)>0){float3 LIGHT1_VIEW_DIRECTION_N = -normalize(mul(Light1ModelDirection, WVMatrix).xyz);halfVec = normalize(LIGHT1_VIEW_DIRECTION_N + eyeVec);diffuse += dot(normalVec, LIGHT1_VIEW_DIRECTION_N);specular+= dot(normalVec, halfVec);//lighting += lit(diffuse, specular, 32);}   if(length(Light2ModelDirection) > 0 ){float3 LIGHT2_VIEW_DIRECTION_N = -normalize(mul(Light2ModelDirection, WVMatrix).xyz);halfVec = normalize(LIGHT2_VIEW_DIRECTION_N + eyeVec);diffuse += dot(normalVec, LIGHT2_VIEW_DIRECTION_N);specular+= dot(normalVec, halfVec);//lighting += lit(diffuse, specular, 32);}if(length(Light3ModelDirection) > 0 ){float3 LIGHT3_VIEW_DIRECTION_N = -normalize(mul(Light3ModelDirection, WVMatrix).xyz);halfVec = normalize(LIGHT3_VIEW_DIRECTION_N + eyeVec);diffuse += dot(normalVec, LIGHT3_VIEW_DIRECTION_N);specular+= dot(normalVec, halfVec);//lighting += lit(diffuse, specular, 32);}lighting = lit(diffuse, specular, 32);    // Blue diffuse material    float3 diffuseMaterial = float3(0.0, 0.0, 1.0);    // White specular material    float3 specularMaterial = float3(1.0, 1.0, 1.0);    // Combine diffuse and specular contributions and    // output final vertex color.    OUT.Color.rgb = lighting.y * diffuseMaterial + lighting.z * specularMaterial;    OUT.Color.a = 1.0;    return OUT;}#elsevertout v_Ferrari(    appin IN,    uniform float4x4 WVPMatrix,    uniform float3 CameraModelPosition,    uniform float4 Light0ModelDirection){    vertout OUT;    // Transform vertex position into homogenous clip-space.    OUT.HPosition = mul(IN.Position, WVPMatrix);   // Store normalized normal vector.    float3 normalVec = normalize(IN.Normal.xyz);    // Store normalized light vector.    float3 LIGHT0_MODEL_DIRECTION_N = -normalize(Light0ModelDirection.xyz);    // Calculate half angle vector.    float3 eyeVec = normalize(CameraModelPosition - IN.Position.xyz);    float3 halfVec = normalize(LIGHT0_MODEL_DIRECTION_N + eyeVec);    // Calculate diffuse component.    float diffuse = dot(normalVec, LIGHT0_MODEL_DIRECTION_N);    // Calculate specular component.    float specular = dot(normalVec, halfVec);    // diffuse and specular values.    float4 lighting = lit(diffuse, specular, 32);    // Blue diffuse material    float3 diffuseMaterial = float3(0.0, 0.0, 1.0);    // White specular material    float3 specularMaterial = float3(1.0, 1.0, 1.0);    // Combine diffuse and specular contributions and    // output final vertex color.    OUT.Color.rgb = lighting.y * diffuseMaterial + lighting.z * specularMaterial;    OUT.Color.a = 1.0;    return OUT;}#endif// Pixel Shader Functionstruct PS_OUT{   float4 Color : COLOR;};texture texTexture ;sampler sampTexture = sampler_state {Texture = (texTexture);};PS_OUT p_Ferrari(vertout input){   PS_OUT output;   float3 texCoord = input.texCoord;   // Sample the texture   float4 texColor = tex2D(sampTexture, texCoord);   output.Color =  input.Color + texColor;    return output;}technique AmbientDiffuseLight{pass Pass0{VertexShader = compile arbvp1 v_Ferrari();PixelShader = compile arbfp1 p_Ferrari();}}thanks.   