fixed point lights range issue
This commit is contained in:
parent
7cafed3e67
commit
24611e0e56
@ -117,13 +117,14 @@ void main(void) {
|
|||||||
float att = 1;
|
float att = 1;
|
||||||
#ifdef POINT_LIGHT
|
#ifdef POINT_LIGHT
|
||||||
vec3 dirLight = pointLight - fragPos.xyz;
|
vec3 dirLight = pointLight - fragPos.xyz;
|
||||||
vec4 pointShadowParam = vec4(inverseViewMatrix * dirLight, length(dirLight));
|
//vec4 pointShadowParam = vec4(inverseViewMatrix * dirLight, length(dirLight));
|
||||||
//att = texture(shadowMap, pointShadowParam);
|
//att = texture(shadowMap, pointShadowParam);
|
||||||
//outColor = vec4(vec3(texture(shadowMap, vec4(inverseViewMatrix * dirLight, length(dirLight)/range))), 1);
|
//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(texture(shadowMap, vec3(inverseViewMatrix * dirLight)).r), 1);
|
||||||
//outColor = vec4(vec3(length(dirLight)/range), 1);
|
//outColor = vec4(vec3(length(dirLight)/range), 1);
|
||||||
//return;
|
//return;
|
||||||
att = clamp(att, 0, 1);
|
float dist = length(dirLight);
|
||||||
|
att = clamp(1 - dist/range, 0, 1);
|
||||||
dirLight = normalize(dirLight);
|
dirLight = normalize(dirLight);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user