PDA

View Full Version : calculate effective light range

supagu
01-12-2005, 01:20 AM
i wanna put a bounding sphere around my lights as im implementing an alogarithm to select the 8 closest in range lights to my meshes.

so ive got the OGL formula:
1.0f / (kc + kld + kqd2);

i'm using the default kc, kl, kq, but when i try to get them i get like invalid numbers:

float kc, kl, kq;
glGetLightfv(0, GL_CONSTANT_ATTENUATION, &amp;kc);
glGetLightfv(0, GL_LINEAR_ATTENUATION, &amp;kl);
just wondering what the defaults are.

then with all that, how do i calculate some point it which its not worth using the light to light a mesh?

im assuming something like this:
0.1f = 1.0f / (kc + kld + kqd2);

rearanging:
(kc + kld + kqd2) = 10

then i have to solve a quadratic, /me has done this since high school.

but then im gonna get 2 solutions. which to use (the largest)?

but mainly, i need to know what the defaults are?
kc = 0, kl = 1, kq = 0 ?

supagu
01-13-2005, 01:00 AM
should i post in the advance section maybe :-/

ZbuffeR
01-13-2005, 08:06 AM
From
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/opengl/stavar01_8cs3.asp
and
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/opengl/glfunc03_88z8.asp

GL_CONSTANT_ATTENUATION = 1.0

GL_LINEAR_ATTENUATION = 0.0