Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 3 of 3

Thread: problem with multiple lights

  1. #1
    Junior Member Newbie
    Join Date
    Sep 2002
    Location
    Australia
    Posts
    12

    problem with multiple lights

    Hello! I have implemented a lighting pass and a shadow pass(shadow maps)...and i can combine them fine (using DST_COLOR,ZERO) but ive been tinkering and I cant seem to get them to combine in a way that would allow multiple lights! Ive tried using a combination of the alpha buffer and stencil buffer but i cant get the settings right. Any suggestions?

    (btw....the lighting pass has no room left in it, hence the multi pass method).

  2. #2
    Advanced Member Frequent Contributor
    Join Date
    Oct 2000
    Location
    Belgium
    Posts
    807

    Re: problem with multiple lights

    For each light source:
    - Disable RGB writes; render shadowing to destination alpha without blending.
    - Enable RGB writes; render lighting with (GL_DST_ALPHA, GL_ONE) blending.

    Also, for everything except the very first pass (the shadow pass of the first light, or possibly an ambient pass), use a GL_EQUAL depthfunc.

    -- Tom

  3. #3
    Junior Member Newbie
    Join Date
    Sep 2002
    Location
    Australia
    Posts
    12

    Re: problem with multiple lights

    dude, i love u!!
    ...hehe. I think I should sleep more, then I wont have to ask such stupid questions at this time of night...cheers!

Posting Permissions

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