#### Archived

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

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

This topic is 5454 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I''ve got a point light that i just want to use to play with lighting. Im just wondering what i should set the Attenuation0, Attenuation1, Attenuation2 to?

##### Share on other sites
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 on other sites
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 on other sites
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 on other sites
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.

1. 1
2. 2
3. 3
Rutin
22
4. 4
JoeJ
16
5. 5

• 14
• 29
• 13
• 11
• 11
• ### Forum Statistics

• Total Topics
631774
• Total Posts
3002287
×