I need help ! light intensity

Hi !

I have to write a building illumination simulation : So I’ve got a building, and I must write an application which lets the user position lights (ie, floodlights…) around it to visualize the result. It’s very important for the user to test different light intensities. Here’s my problem : I’m not an opengl guru, and I don’t know how you specify a light’s intensity in opengl : you specify some parameters like colors, but I haven’t seen anything about light intensity.
Please, can you help me ? Is there any way to specify a light’s intensity ? Or, do you know any way of working around this problem ?

Any help would be highly appreciated !
Morglum

you specify some parameters like colors

Trivia:
What’s the difference between the following two colors:
1.0f; 0.5f; 0.0f

0.5f; 0.25f; 0.0f

Answer this riddle and wisdom ye shall receive …

Ok I see what you mean, but the problem with this approach is that you can’t get anything brighter than 1.0, 1.0, 1.0. In the real world, there’s no upper bound to a light’s intensity.

Anyone ?

no way in gl directly…
looks like you have to generate the lighting yourself, some “dynamic lightmaps”… or something… i dunno

if it needs to be placed in realtime, stick with 0 to 1 values…
if they place it in some editor and then watch after the placing (possibly after a second, who knows) a final result, generate lightmaps… you can generate the maps at start, and then simply draw the lightings onto it when needed… needs some texture-updates and some processing before you see the lights but like that you get full freedom on what you wanna do…

Yes, tecnically the dynamic range is not
very real-world. But many things contribute to how you percieve intensity. The peak is 1,1,1 but your brain may still percieve an image as much more over-exposed, burned-out, glowing etc. Use register combiners to enhance your output!

Originally posted by Morglum:
[b]Ok I see what you mean, but the problem with this approach is that you can’t get anything brighter than 1.0, 1.0, 1.0. In the real world, there’s no upper bound to a light’s intensity.

Anyone ?[/b]

Note this from the OpenGL specs:
“Lighting Operation
A lighting parameter is of one of five types: color, position, direction, real,
or boolean. A color parameter consists of four floating-point values, one
for each of R, G, B, and A, in that order. There are no restrictions on the
allowable values for these parameters.

That means lights can be brighter than white, though resulting colors on the screen can only be max. RGB (1,1,1).
Interestingly you can even specify negative lighting colors (black hole style of lights)

[This message has been edited by Relic (edited 03-06-2002).]

I have to agree completely that opengl has really fake light. But to be honest its not an opengl problem its just a problem with computers in general. RGB colorspace is far from the way light interacts with our eyes in the real world. YUV colorspace which is what divx movies and the like use is much closer to the way we percieve light. I really don’t feel like explaining what the difference is. Of course there are the other colorspaces such as CYMK and all that jazz. There really are an infinite number of frequecies of light within the visible light spectrum so there theoretically should be an infinite number of different colorspaces. All right enough already. The question was answered a while ago. The color intensity is the light intensity. Its that simple.

You really don’t need anything brighter that 1. The reason color is clamped between 0 and 1 is because at 1 saturation occurs (not in the real world) but in a computer it does. Or at least the 1 is interpreted as such. Also its just nice to have things such as colors be 1 clamped floats. They then scale nicely for framebuffer output. Very convenient.

Happy Coding.

[This message has been edited by Devulon (edited 03-06-2002).]

Wait a minute, Relic !
Are you saying that all that I have to do, to get a very bright light, is to set its color to 100,100,100 ??? That would be marvellous !

Davepermen, thanks for the idea of lightmaps, but there’s one problem : my model is loaded from a 3dsmax file, so it might have a large number of faces, say more that 1000. Should I really build more that 1000 textures ? (If I’ve well understood, a lightmap is a texture) Is this reasonnable ?

Yes you can set the light color to RGB = (100, 100, 100) (I assume you mean floats), but the result after the lighting equations will be clamped to [1, 0].

>>Yes you can set the light color to RGB = (100, 100, 100) (I assume you mean floats), but the result after the lighting equations will be clamped to [1, 0].<<

that is no problem because 1.0 is the maximum value ie 1,1,1 is white + u cant have brighter than white on the computer screen

I thought the light’s intensity was clamped before being used in colour calculations. Are you saying they are clamped after calculations (reflection, etc)?

Yes, only the resulting color values are clamped to [0,1] after all lighting calculations have been performed.

Originally posted by Morglum:
[b]Wait a minute, Relic !
Are you saying that all that I have to do, to get a very bright light, is to set its color to 100,100,100 ??? That would be marvellous !

Davepermen, thanks for the idea of lightmaps, but there’s one problem : my model is loaded from a 3dsmax file, so it might have a large number of faces, say more that 1000. Should I really build more that 1000 textures ? (If I’ve well understood, a lightmap is a texture) Is this reasonnable ?[/b]

hm… you can have one texture over several faces… like you can have a standart texture over the whole mesh… why should you need to texture each triangle with an own texture!!!