View Full Version : faraway lights

hi, i have a question about spotlights...my spotlights work well when they are positioned close to the objects that are being illuminated. but if i move the light to a realistic position in relation to the objects, they are barely illuminated. the lights are turned up to maxium strength. so if i am drawing a scene that is "to scale", is there a mulitplier or material setting that will brighten up these lights?

Michael Steinberg

02-24-2001, 12:50 PM

You can set the damp-coefficients.

d = 1/ (kc + kl*r + kq*r^2)

r is the distance

kc is the constant weight

kl is the linear weight

kq is the quadratic weight

If d gets one, you've got full brightness, if its 0, you've serious darkness, since:

Illum(lit surface) ~ d*Illum(light)

The coefficients get defined like this:

kc -> glLightf( GL_LIGHTx GL_CONSTANT_ATTENUATION, kc );

kl and kq respecitvely with GL_LINEAR_ATTENUATION and GL_QUADRATIC_ATTENUTATION

michael,

thank you for your important reply. but i'm not an optics engineer... http://www.opengl.org/discussion_boards/ubb/confused.gif ummm, could you please explain what the quadratic weight, the linear weight, and the constant weight are (or at least how they affect a light). thanks a lot!

The constants is used to calculate how the light is fading when you get far away from the lightsource.

The default in OpenGL is kc=1, kl=0 and kq=0

r is the distance from the lightsource.

Stuffing these values into the forula Michael mentioned, you will see that only kl and kq is multiplied with r, and since these two constants is zero, the distance has no affect to the light.

The constant weight is a constant damping factor, which affects the whole scene. If kc=2, then d=1/2=0.5, which means that the light will be half as bright over the entire scene. As kc grows bigger, d grows smaller.

kl is a linear damping factor. It is multiplied by the distance to the vertex being lit. As the distance grows, the total dampingfactor will grow, and d will be less and less the further away you get from the light. And the lower d is, the less light will reach the vertex.

kq is the same as kl, but is affected by the squared distance. The further away you get from the light, the damping factor will grow even more.

thanks for explaining this, bob, your explanation is helpful

Powered by vBulletin® Version 4.2.3 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.