Light Attenuation
Windows only


So you are interested in taking advantage ON_Light::Attenuation in your render plugin, and you need to clarify how you can use it. Is the input vector supposed to represent the distance over which you want the light to attenuate to zero?


Light attenuation determines how fast the light intensity decreases with distance from objects.

The three coefficients to light attenuation are:

  1. Constant attenuation ( $$C$$)
  2. Linear attenuation ( $$L$$)
  3. Quadratic attenuation ( $$Q$$)

Thus, you could create the input vector as follows:

ON_3dVector attenuation( C, L, Q );

NOTE: Rhino’s user interface only uses constant attenuation so that adding a light reveals everything, no matter how far away the light source is from any given piece of geometry.

Types of Attenuation


If you want constant attenuation, or:

$$1 \over C$$

then both $$L$$ and $$Q$$ must be $$0$$ and $$C > 0$$ (usually $$= 1.0$$).


If you want linear attenuation:

$$1 \over C + dL$$

where $$d$$ = distance to light, then $$C$$ and $$L$$ vary and $$Q$$ must be $$0$$.


If you want quadratic attenuation:

$$1 \over C + dL + d^{2Q}$$

then all 3 coefficients can and should vary.