Skip to main content

Distance consideration in intensity

Short answer

For m light sources, the intensity is I = ka·Ia + Σ f(d_l)·IL_l·[kd(N·L_l) + ks(N·H_l)^n]. Distance attenuation f(d)=min(1/(a0+a1·d+a2·d²),1) multiplies both diffuse and specular terms for each source; the ambient term is not attenuated.

Write the expression for multiple light sources. How do you consider the distance (intensity attenuation) to calculate the intensity for specular and diffuse reflection?

Multiple light sources

When a surface is lit by m point sources, the contributions of all sources are added to the ambient term:

I = ka·Ia + Σ (l = 1 to m) f(d_l) · IL_l · [ kd (N·L_l) + ks (N·H_l)^n ]

(N = unit normal, L_l = unit vector towards source l, H_l = (L_l + V)/|L_l + V|, and (R·V)^n can replace (N·H)^n.) If the sum exceeds the maximum intensity, it is clamped to 1.

Distance (intensity attenuation)

Light from a point source gets weaker with distance d from the source. In theory the intensity falls as 1/d², but this changes too fast for a small scene, so a general function is used:

f(d) = min( 1 / (a0 + a1·d + a2·d²), 1 )

  • a0, a1, a2 are constants chosen to give the best effect (a0 prevents division by a very small number when d is small).
  • Taking f(d) = 1 means no attenuation (source at infinity).

Attenuation multiplies both the diffuse and specular terms, since they depend on the light source. The ambient term has no distance factor:

I = ka·Ia + f(d) · IL · [ kd (N·L) + ks (N·H)^n ]

For a source at infinity, d is not defined and f(d) = 1.

✓ Answer checked by Claude Opus 5.5 (high effort)

All Computer Graphics chapter 8 questions →