What do is set the Attenuation's to for my point light?
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?
try this:
You can play around with these values, but at least one of them has to be non-zero.
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.
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.
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.
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.
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.
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.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement