     const in float lightSpotBlend)
 {
     // compute dist
-    vec3 lightVector = lightSpotPosition - eyeVector;
+    vec3 lightVector = eyeVector - lightSpotPosition;
     float dist = length(lightVector);
     // compute attenuation
     float attenuation = getLightAttenuation(dist, lightAttenuation.x, lightAttenuation.y, lightAttenuation.z);
-    if (attenuation <= 0.0)
+    if (attenuation > 0.0)
     {
         // compute direction
         vec3 lightDirection = dist > 0.0 ? lightVector / dist :  vec3( 0.0, 1.0, 0.0 );

{
    lv = -lampvec;
}

void computeLightPoint(const in vec3 vertexPosition, const in vec3 lampPosition, out vec3 lightVector, out float dist)
{
    lightVector = lampPosition-vertexPosition;
    dist = length(lightVector);
    lightVector = dist > 0.0 ? lightVector / dist :  vec3( 0.0, 1.0, 1.0 );
}

////////////////////////
/// Main func
///////////////////////

          lambert(NdotL, materialDiffuse.rgb, lightDiffuse.rgb, diffuseContrib);
          vec3 specularContrib;
          specularCookTorrance(normal, lightDirection, eyeVector, materialShininess, materialSpecular.rgb, lightSpecular.rgb, specularContrib.rgb);
          return vec4(lightAmbient.rgb*materialAmbient.rgb + shadowContrib*(diffuseContrib.rgb+specularContrib.rgb), 1.0);
        }
    }
    return vec4(lightAmbient.rgb*materialAmbient.rgb, 1.0);
}

vec4 computePointLightShading(
