Site Tools


This shows you the differences between two versions of the page.

Link to this comparison view

developer:sdksamples:lightattenuation [2015/09/14] (current)
Line 1: Line 1:
 +====== Light Attenuation ======
 +====== C++ ======
 +> **Summary:​** //Discusses light attenuation in Rhino.//
 +I am interested in taking advantage **ON_Light::​Attenuation** in my render plug-in, and I need to clarify how I can use it. Is the input vector supposed to represent the distance over which I want the light to attenuate to zero? I have a feeling I'm not understanding the intent.
 +Light attenuation determines how fast the light intensity decreases with distance from objects.
 +The three coefficients to light attenuation are:
 +  - Constant attenuation (**C**)
 +  - Linear attenuation (**L**)
 +  - Quadratic attenuation (**Q**)
 +Thus, you could create the input vector as follows:
 +<code c++>
 +ON_3dVector attenuation( C, L, Q );
 +=====More Information=====
 +  * If you want constant attenuation,​ or (1 / C), then both L and Q must be 0 and C > 0 (usually = 1.0).
 +  * If you want linear attenuation,​ or (1 / (C + d*L)) where d = distance to light, then C and L vary and Q must be 0.
 +  * If you want quadratic attenuation,​ or (1 / (C + d**L + d^2**Q)), then all 3 coefficients can and should vary.
 +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.
 +{{tag>​Developer cplusplus}}
developer/sdksamples/lightattenuation.txt ยท Last modified: 2015/09/14 (external edit)