diff options
-rw-r--r-- | data/shaders/lighting.frag | 6 | ||||
-rw-r--r-- | data/shaders/lighting.vert | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/data/shaders/lighting.frag b/data/shaders/lighting.frag index d4cb035..6e3fe65 100644 --- a/data/shaders/lighting.frag +++ b/data/shaders/lighting.frag @@ -63,9 +63,9 @@ void main() { float falloff, spot; float diff_fac, spec_fac; - falloff = 1/ ( gl_LightSource[0].constantAttenuation - + gl_LightSource[0].linearAttenuation * light0dist - + gl_LightSource[0].quadraticAttenuation * light0dist * light0dist ); + falloff = 1.0 / ( gl_LightSource[0].constantAttenuation + + gl_LightSource[0].linearAttenuation * light0dist + + gl_LightSource[0].quadraticAttenuation * light0dist * light0dist ); spot = max(dot(normalize(-light0vc), gl_LightSource[0].spotDirection), 0.0); spot = pow(spot, gl_LightSource[0].spotExponent); diff --git a/data/shaders/lighting.vert b/data/shaders/lighting.vert index 99e9b37..af80574 100644 --- a/data/shaders/lighting.vert +++ b/data/shaders/lighting.vert @@ -39,7 +39,7 @@ void main() { light0dist = length(vert_to_light); light0vc = normalize(vert_to_light); vert_to_eye = v4conv3(-vert); - light0half = normalize(vert_to_eye + vert_to_light); + light0half = normalize(normalize(vert_to_eye) + light0vc); /* Diffuse "background glow" - this can be normalised only once, here, since 'position' * is really 'direction' and is the same for all vertices. */ |