Multiple lights

I have a scene with multiple lights (about 40) and I want to light each object only with the one or two of them that are nearest to it.
Does anybody have some clues on how to do this in a good way?

Thank you
nICO

[hr]
[italic]How beautiful, if sorrow had not made Sorrow more beautiful than Beauty itself.[/italic]
JOHN KEATS

Comments

  • : I have a scene with multiple lights (about 40) and I want to light each object only with the one or two of them that are nearest to it.
    : Does anybody have some clues on how to do this in a good way?
    :
    : Thank you
    : nICO

    How about dynamic lightmaps ??
    http://www.flipcode.com/tutorials/tut_advlightmaps.shtml
    :
    : [hr]
    : [italic]How beautiful, if sorrow had not made Sorrow more beautiful than Beauty itself.[/italic]
    : JOHN KEATS
    :
    :

  • Thank you, I'll check that!

    nICO

    [hr]
    [italic]How beautiful, if sorrow had not made Sorrow more beautiful than Beauty itself.[/italic]
    JOHN KEATS


  • SephirothSephiroth Fayetteville, NC, USA
    : Thank you, I'll check that!
    :
    : nICO
    :
    : [hr]
    : [italic]How beautiful, if sorrow had not made Sorrow more beautiful than Beauty itself.[/italic]
    : JOHN KEATS

    Let me know what you find out. I am toying with this in OpenGL now, but the default only supports 8 hardware lights at once. I was thinking of taking four of these, lighting part of what the player can see, disabling them, setting them up elsewhere, enabling, repeat! Then unless I had a MASSIVE number of lights in any scene, it should work, but I think it'll kill the speed.

    -[italic][b][red]S[/red][purple]e[/purple][blue]p[/blue][green]h[/green][red]i[/red][purple]r[/purple][blue]o[/blue][green]t[/green][red]h[/red][/b][/italic]

  • : Let me know what you find out. I am toying with this in OpenGL now, but the default only supports 8 hardware lights at once. I was thinking of taking four of these, lighting part of what the player can see, disabling them, setting them up elsewhere, enabling, repeat! Then unless I had a MASSIVE number of lights in any scene, it should work, but I think it'll kill the speed.
    :
    If I remember well the maximum number of lights should also depend on the video card capabilities...
    Anyhow I was thinking of something like this:

    1) calculate the nearest 2 or 3 lights (or the number you want) for each object and store them in an array. This is done only at the beginning or when an object moves (just recalculate for the object) or when a light moves (recalculate all).
    2) at rendering time enable only the lights that light that object and disable the other lights.

    In theory this look good, but I'm not sure of the performances...

    nICO

    [hr]
    [italic]How beautiful, if sorrow had not made Sorrow more beautiful than Beauty itself.[/italic]
    JOHN KEATS


Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories