Skip to content

Instantly share code, notes, and snippets.

@tobspr
Created June 27, 2014 13:17
Show Gist options
  • Save tobspr/e93111989e00d2ed6fff to your computer and use it in GitHub Desktop.
Save tobspr/e93111989e00d2ed6fff to your computer and use it in GitHub Desktop.
// Cut light transition starting at 80%. Otherwise it's exponential and never gets really 0
float cutoff = light.radius * 0.8;
float cutoffFactor = 0.25;
attenuation *= 1.0 - smoothstep(0.0, 1.0, ((distanceToLight / cutoff) - 1.0) * 4.0 );
attenuation = max(0.0, attenuation);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment