Archived

This topic is now archived and is closed to further replies.

johnnyBravo

What do is set the Attenuation's to for my point light?

Recommended Posts

langguy    122
try this:


LightSource.Attenuation0 = 0.0f;
LightSource.Attenuation1 = 1.0f;
LightSource.Attenuation2 = 0.0f;


You can play around with these values, but at least one of them has to be non-zero.

Share this post


Link to post
Share on other sites
Osc    122
If you dig around in the SDK docs you''ll find an equation that determines how the effect of a light falls off with distance. The three attenuation parameters are the constant, linear and quadratic coefficients in this equation.

Share this post


Link to post
Share on other sites
johnnyBravo    100
i havent really looked to much into these equations, but with
setting the attenuation1 to 1, thats what is says to do somewhere in the sdk, and by other ppl. But when i do it, the light doesn''t seem to work anymore. Ive tried moving the light, changing range , colours etc.

Share this post


Link to post
Share on other sites
don    431
This is covered in the DX9 docs in the "Mathematics of Lighting" section.

attenuation factor = 1.0f / (Attenuation0 + Attenuation1 * dist + Attenuation2 * dist * dist)

Where ''dist'' is the distance from the light position to the vertex position that is being lighted.

So if you set the three values to (0, 1, 0) then the light intensity will vary over distance linearly as the other two terms fall out of the above equation.

If you''re familiar with OpenGL, the Attenuation0, Attenuation1, and Attenuation2 values correspond to GL_CONSTANT_ATTENUATION, GL_LINEAR_ATTENUATION, and GL_QUADRATIC_ATTENUATION.

Share this post


Link to post
Share on other sites