Light-source Attenuation

Thus far we have ignored the inverse square law: energy decays with the inverse square of the distance dL to the light source. Including this term we get

I = Iaka + Ipkd (L*N)/dL2

However, due to our previous assumptions of a point light source and uniform ambient light, using the dL2 term gives too rapid of a decrease in illumination intensity to look realistic. The dL2 term is usually replaced by fatt where

fatt = MIN (1/(c1 + c2dL + c3dL2), 1)

I = Iaka + Ipkd (N*L)*fatt