Advertisement
Guest User

Untitled

a guest
May 26th, 2016
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.44 KB | None | 0 0
  1. /*!
  2.     Inverse square falloff.
  3.  
  4.     \param lightDist The distance from the light source.
  5.     \param lightRadius The light source radius.
  6.  
  7.     \return The falloff factor.
  8.  */
  9. float $(float lightDistance, float lightRadius)
  10. {
  11.     float t = lightDistance / lightRadius;
  12.     float t2 = t * t;
  13.     float t4 = t2 * t2;
  14.     float r = saturate(1.0 - t4);
  15.     return ::functions::math::sqr(r) / (::functions::math::sqr(lightDistance) + 1.0);
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement