Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: I need help ! light intensity

  1. #1
    Member Regular Contributor
    Join Date
    Jul 2001
    Posts
    409

    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

  2. #2
    Senior Member OpenGL Pro
    Join Date
    Feb 2002
    Location
    Bonn, Germany
    Posts
    1,652

    Re: I need help ! light intensity

    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 ...

  3. #3
    Member Regular Contributor
    Join Date
    Jul 2001
    Posts
    409

    Re: I need help ! light intensity

    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 ?

  4. #4
    Senior Member OpenGL Pro
    Join Date
    Feb 2001
    Location
    Switzerland
    Posts
    1,840

    Re: I need help ! light intensity

    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..
    http://davepermen.net - if i could stay true to my heart, i would feel totally free

  5. #5
    Intern Contributor
    Join Date
    Jan 2002
    Location
    Stockholm, Sweden
    Posts
    75

    Re: I need help ! light intensity

    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!

  6. #6
    Senior Member OpenGL Guru Relic's Avatar
    Join Date
    Apr 2000
    Posts
    2,527

    Re: I need help ! light intensity

    Originally posted by Morglum:
    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 ?

    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).]

  7. #7
    Junior Member Regular Contributor
    Join Date
    Feb 2002
    Posts
    124

    Re: I need help ! light intensity

    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).]

  8. #8
    Member Regular Contributor
    Join Date
    Jul 2001
    Posts
    409

    Re: I need help ! light intensity

    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 ?

  9. #9
    Senior Member OpenGL Guru
    Join Date
    Feb 2000
    Location
    Sweden
    Posts
    3,115

    Re: I need help ! light intensity

    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].

  10. #10
    Senior Member OpenGL Guru zed's Avatar
    Join Date
    Jul 2000
    Location
    S41.16.25 E173.16.21
    Posts
    2,609

    Re: I need help ! light intensity

    >>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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •