Permalink
Browse files

fix attenuation shader with spot lights

  • Loading branch information...
1 parent ec359e0 commit 53a2ee5d49b8451455932b4f563ddab76a482895 @sinisterchipmunk committed Sep 22, 2012
Showing with 2 additions and 0 deletions.
  1. +2 −0 lib/assets/javascripts/shaders/attenuation/fragment.glsl
@@ -8,6 +8,7 @@ shared uniform float QuadraticAttenuation;
void main(void) {
if (PASS != 0) {
cache(float, LightDistanceFromSurface) { LightDistanceFromSurface = 1.0; }
+ cache(float, SpotAttenuation) { SpotAttenuation = 1.0; }
float multiplier = 1.0;
import(AttenuationMultiplier, multiplier *= AttenuationMultiplier);
@@ -18,6 +19,7 @@ void main(void) {
import(SkipAttenuation, skipAttenuation += SkipAttenuation);
if (skipAttenuation == 0)
+ multiplier *= SpotAttenuation;
gl_FragColor.rgb *= multiplier / (ConstantAttenuation +
LinearAttenuation * LightDistanceFromSurface +
QuadraticAttenuation * pow(LightDistanceFromSurface, 2.0));

0 comments on commit 53a2ee5

Please sign in to comment.