Jump to content
  • entries
    941
  • comments
    5,894
  • views
    867,690

Ambient Lighting Research


Josh

2,117 views

 Share

Previously I talked about the idea of implementing a new "Ambient Point Light" into the engine. This would work by rendering the surrounding environment to a cubemap, just like a regular point light does. However, this type of light would render to a color buffer instead of just a depth buffer.

 

The light could then be rendered to display ambient reflections and soft lighting on the surrounding environment. While it would not provide perfect real-time reflections, it would give an extra boost to the appearance of scenes that make heavy use of reflective surfaces.

 

One of the problems in this type of system is how to handle overlapping lights. It would look weird to have an area where two lights are combining to make the ambient light or reflections brighter.

 

I found a could create a new "lighten" blend mode with the following code:

glBlendFunc(GL_ONE, GL_ONE);
glBlendEquation(GL_MAX);

 

This ensures that a light will only brighten a pixel up to its own value, and never beyond. If the pixel is already brighter than the light color it will have no effect. Below you can see two spotlights using this new blend mode. Notice that the area where the two lights both illuminate is never any brighter than either one.

 

blogentry-1-0-85065300-1462486810_thumb.jpg

 

This also means soft ambient lighting will only appear in dark areas, and will have no effect on brightly lit surfaces, as it should.

  • Upvote 5
 Share

4 Comments


Recommended Comments

Blend::Lighten confirmed? I mean I get that this is for the probes, but that screen shot of the spots looks way better how spotlights are handled now. Really great!

Link to comment

But we're making video games, not real life! :P

 

As in, yes, the default settings is correct, but there may be cases where we'd need to cheat realism to get a desired look or effect. It's really case by case of what looks best for what you're going after.

 

But glad to see a new blend mode will be coming soon. (If I've read right.)

  • Upvote 1
Link to comment
Guest
Add a comment...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...