- Vec3f dir = (ray.origin() + ray.direction() * (ray.t()-Epsilon)) - m_pos;
- float dist = dir.norm();
+ // distance to light source
+ Vec3f dir = m_pos-shadow_ray.origin();
+ float r = dir.norm()-Epsilon;
+ float falloff = 1.0f/(r*r);
+
+
+ intensity = m_intensity * falloff;
+
+ // modify ray for shadow computation
+ shadow_ray.setHit(0);
+ // for shadow calculation
+ shadow_ray.setT(r);
+ // set direction to light source