diff --git a/shaders/lighting.frag.glsl b/shaders/lighting.frag.glsl index 3879b77..6cf27d3 100644 --- a/shaders/lighting.frag.glsl +++ b/shaders/lighting.frag.glsl @@ -117,13 +117,14 @@ void main(void) { float att = 1; #ifdef POINT_LIGHT vec3 dirLight = pointLight - fragPos.xyz; - vec4 pointShadowParam = vec4(inverseViewMatrix * dirLight, length(dirLight)); + //vec4 pointShadowParam = vec4(inverseViewMatrix * dirLight, length(dirLight)); //att = texture(shadowMap, pointShadowParam); //outColor = vec4(vec3(texture(shadowMap, vec4(inverseViewMatrix * dirLight, length(dirLight)/range))), 1); //outColor = vec4(vec3(texture(shadowMap, vec3(inverseViewMatrix * dirLight)).r), 1); //outColor = vec4(vec3(length(dirLight)/range), 1); //return; - att = clamp(att, 0, 1); + float dist = length(dirLight); + att = clamp(1 - dist/range, 0, 1); dirLight = normalize(dirLight); #endif