Better Ambient Lighting

Member
Posts: 269
Joined: 2005.04
Post: #1
I'm in search of a better lighting technique. I recently discovered that Blender gained some nifty texture baking capabilities in recent versions (I should really update more often and actually read the release notes), so I've been playing around with lightmaps and normal mapping. Adding them to shadow mapping code and what not.

The problem I'm having is with how to light dynamic objects so that they match the lightmapped environment. When lit with dynamic lights they look great, but if there's no light on them they're too flat and don't match the surrounding area. The flatness bugs me more than the improper colors actually.

An image

I obviously can't lightmap the characters so I've been googling for a better alternative. Screen space ambient occlusion looks interesting, but it doesn't look like it would solve any color matching issues. I keep hearing about image based lighting (like from TomorrowPlusX and Overgrowth), but I'm having a hard time finding any articles/papers/tutorials on it. Any other techniques I'm missing?
Quote this message in a reply
Moderator
Posts: 3,579
Joined: 2003.06
Post: #2
Wow, that looks pretty good! Is the baddie animated?
Quote this message in a reply
Member
Posts: 269
Joined: 2005.04
Post: #3
AnotherJake Wrote:Wow, that looks pretty good! Is the baddie animated?

Nah. It's just a static zombie model from Doom 3. He's got normal and specular maps though, so it's a good test model.

The environment is actually a simple scale model of my house that I'm slowly making to test out the lightmaps. It's kinda creepy to walk around it with zombies everywhere.
Quote this message in a reply
Member
Posts: 446
Joined: 2002.09
Post: #4
Bachus Wrote:The problem I'm having is with how to light dynamic objects so that they match the lightmapped environment.

IIRC, the old Quake 3 engine way is to save a grid of lightmap samples in empty space, then light models based on nearby samples. It's never perfect, but if yer after perfect lighting you're pretty much stuck doing it all in realtime.
Quote this message in a reply
Moderator
Posts: 3,579
Joined: 2003.06
Post: #5
Bachus Wrote:Nah. It's just a static zombie model from Doom 3. He's got normal and specular maps though, so it's a good test model.

The environment is actually a simple scale model of my house that I'm slowly making to test out the lightmaps. It's kinda creepy to walk around it with zombies everywhere.

Well, it sure looks great man, keep rollin' with it!
Quote this message in a reply
Sage
Posts: 1,199
Joined: 2004.10
Post: #6
A SUPER SIMPLE ambient trick I did a while back -- before implementing environment maps -- was to pretend there was a tiny bit of light coming from above during the ambient pass.

Basically, the ambient shader was really a directionally lit shader with a small amount of light coming from some direction, by default (0,0,1). This made for much richer ambient lighting, and was very cheap to implement and execute. Zero observable performance hit. And objects in shadow didn't look completely flat any more.

I don't know if there are any good papers on environment map lighting, but it was very easy to implement once I got the math working to transform normal map vectors to world space. If you're interested, email me ( shamyl at google's mail service ).
Quote this message in a reply
Member
Posts: 269
Joined: 2005.04
Post: #7
It looks like combining SSAO with mixed ambient colors will work fine. Set up ambient light areas in Blender, and mix the colors to get one ambient color for the area. Let SSAO handle the flatness and call it a day. I'll try out different fake ambient diffuse lights as well. Tabula Rasa does a neat trick where they invert the direction of the diffuse light to light the opposite side (bidirectional lighting they call it). Nifty, but not exactly what I'm looking for.

I think I may be overthinking a lot of it. I loaded up Mass Effect and studied it since it's generally a gorgeous game and uses Unreal Engine 3. It's amazing how low-tech the lighting is. Characters are basically lit with a single directional light that rarely changes. The entire Presidium no matter where you walk or whether you're indoors or outside has the exact same lighting. Characters have exactly one shadow that rarely changes directions or shape. If you can actually manage to extend the shadow you can see that they're clipped short. They rapidly fade to nothing so your character loses their head. They're also basic shadow maps with a bit of PCF, nothing fancy to em. Environments seem to be almost entirely lightmapped. There's basically no dynamic lights at all and environment lights and shadows rarely have an affect on character lighting. In fact, I can't seem to find a dynamic light effect period. Nothing from weapons/grenades/biotics. No strobing/moving/changing lights in the environment. Amazing what you can get away with technology wise if you have great artists.
Quote this message in a reply
DoG
Moderator
Posts: 869
Joined: 2003.01
Post: #8
Why can't you just lightmap the characters? Surely it involves a bit of runtime sorting to figure out which to apply currently, but I just don't see the big difficulty, at least with shader-based rendering.
Quote this message in a reply
Member
Posts: 269
Joined: 2005.04
Post: #9
DoG Wrote:Why can't you just lightmap the characters? Surely it involves a bit of runtime sorting to figure out which to apply currently, but I just don't see the big difficulty, at least with shader-based rendering.

Unless you do something like this, then you can't use lightmaps with dynamic lights or dynamic geometry. The lighting and shadows would be off as soon as the model animated or moved position. And Humus' technique isn't suited to characters that could be anywhere on the map, just things like moving fan blades.

Dead Space was another interesting study. It seems that each area has an ambient color that's used for both the environment and characters. Blue in the medical center, green in the baby lab, etc. And it looks like only one ambient color can be used at a time. If you open the door from the baby lab to the med center then the blue overpowers the green and the entire lab changes colors until the door closes.

One interesting technique they use is that Isaac is always lit by two diffuse lights even in the darkest areas. One from the left and slightly below, and one from the right and slightly above. And the lights aren't connected to Isaac, they're connected to the camera. As you rotate around him you can see the lights move, always highlighting his silhouette. Keeps you from losing your character in dark areas and makes him pop out from the environment. Very smart.

For the diffuse lighting I can't tell if the environment is using lightmaps or not because every light affects Isaac. Even tiny little floor lights will cast a glow on your leg. It balances this by having very few lights cast shadows. Only the biggest, most important light in the scene, plus your flashlight will cast shadows. Shadows are standard shadow maps with *no* blurring or softness. They have some pretty ridiculous aliasing depending on the size of the light.
Quote this message in a reply
Member
Posts: 269
Joined: 2005.04
Post: #10
Getting closer to finding a good technique. This page is super awesome. I never knew about alternative lighting models.

Another image

Those are all lit by a single diffuse light with a bluish color (with a reddish second color for hemispherical and bi-directional lighting). No ambient lighting and texturing turned off to better see the different models. Seams are caused by the crummy model, not poor code. Wink

Half-Life 2 apparently uses the wrapped-lighting model some, along with precomputed ambient cube maps. The artists place points along the map which precomputes a cubemap of the ambient lighting in an area. Then at runtime when drawing models it picks the best map to use for lighting a model. Sounds similar to image based lighting, but more static. See this PDF.

EDIT: Ooh. Here we go: http://www.valvesoftware.com/publications.html

"Shading in Valve’s Source Engine" Much better information than just the slides in the other PDF. I shall have to study this tomorrow when I'm not half asleep.
Quote this message in a reply
Post Reply