Outdoor lighting for next-gen

Started by
13 comments, last by JD 18 years, 6 months ago
I'm trying to compile some information on interesting outdoor lighting systems that look great and run well on next-gen hardware (SM 2.X and up). I have done a few hours googling and basically come up with very little (though perhaps I'm not looking hard enough or smart enough). I'm approaching this problem from the art side of the fence, though I know enough about the tech to be annoying to the programmers :) So I wonder what other people are doing for outdoor lighting? Specifically: 1.) Dynamic objects and characters * Self-shadowing (real-time AO? Dynamic PRT?) * Shadows from the environment (Shadow maps? Shadow volumes? Light attenuation volumes?) * Outdoor illumination (IBL? SH?) * Normal mapping outdoors in a non-N.L lighting environment? 2.) Static objects and world geometry/terrain * Self-shadowing (Precomputed Shadow Masks? PRT?) * Shadows from dynamic objects (Texture projections? Precomputed shadow fields?) * Lighting and normal mapping? I would really love some feedback/links on this from those of you who are really up on the latest techniques and are actually using them in production. Thanks for any help you can give! Jesse
Advertisement
I'll try to add some suggestions.
But first, just want to say that simple diffuse + tons of geometry can create significant difference all alone (ok, maybe with AO/light map). Just see HL2, You are Empty, or some other shooter - the visual detail at mid-to-far distances is great, and looks even greater when there is more geometry.
Near the camera, things obviously aren't so simple...

Quote:Original post by jrapczak
1.) Dynamic objects and characters
* Self-shadowing (real-time AO? Dynamic PRT?)

[link="http://www.tml.tkk.fi/~janne/aofields/aofields.pdf"]AO fields.[/link]
It is static objects only.
For dynamic object, first one should try to investigate, is it worth the efford (like prerendring a character in MAX, using close to ingame lighting and view the visual differences with and w/o AO).
Rendering from many directions in shadowmap, then render with depth-comparison into some AO mapping of the character's surface (adding light every pass) will give some rought AO map.

Quote:
....

All of the above, starting from all-around normalmaps (for indoor, rich of detail environments), to SH and PRT.
But, it very depends on the game and vision.
Trading normalmaps, for geometry for example or going all deffered.
Visual richness as I said, can be archieved just by the number of objects - and here, don't forget particles. They can make huge difference.
Just see latest 3d Mark for an idea, what a future game can looks like (the fight in the ship), and how much particles add to the visuals.
Maybe smooth particles, for stunning volumetric fog and fire would be natural choice also.
Oh - volumetric fog! :)
Skinned geometry all around.
Various lighting schemes, for surfaces, like faked subsurface scattering for vegetation, and other, different from standart Ambient+Diffuse+Specular lighting formulas.

[Edited by - Zemedelec on September 26, 2005 7:06:38 AM]
Our engine already has full support for dynamic PRT for outdoor environments. The problem is that dynamic PRT is memory-prohibitive and completely impractical for anything other than small scenes in production. Instead we are thinking about implementing some sort of per-object texture-based shadow masking for PP lights.

I guess my biggest question is how to get normal maps looking good outdoors, where the lighting is softer and diffuse compared to indoors?

Jesse
Pixel lights are only good for night or indoor scenes where you actually get direct illumination from light sources. For outdoor day scenes I think lightmaps for static + proj.texture shadows for dynamics seem to work well. Both are kind of soft rather than hard stencil shadows or the impractical depth maps. Combining pixel lit indoors with lightmapped outdoors might be ok. Baking specular into lightmaps like HL2 does it is visually incorrect because specular depends on the player's movement. Though it probably looks good fudged like that. God knows, I've seen many fudged games and they look good so going not with totally realistic gfx is a good way to go. Kind of reminds me the fact that playing FPS you move so fast as not to notice the fine scene details. Mind is on the action so lots of pretty special gfx effects help there :)
Original post by JD
...Baking specular into lightmaps like HL2 does it is visually incorrect because specular depends on the player's movement...


Sorry to hijack the thread, but JD could you explain the part in my quote? Thanks.

Sure. Specular is simply light that is reflected off a surface. The light's reflection changes strength depending on where in relation to the surface you're standing. If you stand right behind the light and face the surface head on then the reflection off the surface is the strongest. However, as you begin moving to the side the more you move off side the less intense the reflection is. The surface that the light bounces off of changes the angle in relation to you as you move to the side so you see less light or less reflected light is hitting your eyes.

To calculate light's reflection intensity you take the surface's normal and light's vector to the surface. Then you reflect light's vector around the surface's normal vector. Then you take a vector from you to the point on the surface light hits. If that vector is parallel to the reflected light's vector then you get maximum reflected light strength. You go blind :) However, as you move off to the side the two vector's yours and reflected light's vector will diverge and the larger divergance the less you go blind until reflected light is muted. You take a dot product between your and reflected light's vector and it's one ie. strongest when they're parallel. At 90 deg. the dot is zero or no reflected light.

Half-life 2, puts specular light intensity into their textures but neglects the player's vector during play. So as you move to the side of the wall the light stays the same strength. They would have to recompute your vector each time you moved and alter the specular light and that takes time. I haven't played the game so I don't know if they do this with lightmaps or not but it would include walking over the patches each frame or as soon as you move in world. The patches would have to be small for specular to look good and walking over zillion patches like that is unlikely in realtime. Actually, they could treat many specular patches as one and update them at once. Still not perfect but you would get a falloff in specular if they did that and that might be more realistic than have them static.
Forgot to say that when the light moves and player doesn't the specular has to be recalculated again, not just when player moves. But HL2 lights are static I think so it didn't occur to me to talk about lights that move in HL2 context. Valve put up a paper of their lighting/shadowing algo and in it they talk about how they combine the various lighting texture layers to create their effects. Has been a long time since I read that so some of my ideas might be off.
Um, JD, you DO realize that HL2's "specular" light, is all just a series of cubemaps placed around the map, with all of the specularity being done by just finding the reflection vector and doing a direct envmap lookup, right? You seem to be talking about it as if it's supposed to be Phong's gloss mapping.

Quote:To calculate light's reflection intensity you take the surface's normal and light's vector to the surface. Then you reflect light's vector around the surface's normal vector. Then you take a vector from you to the point on the surface light hits. If that vector is parallel to the reflected light's vector then you get maximum reflected light strength. You go blind :) However, as you move off to the side the two vector's yours and reflected light's vector will diverge and the larger divergance the less you go blind until reflected light is muted. You take a dot product between your and reflected light's vector and it's one ie. strongest when they're parallel. At 90 deg. the dot is zero or no reflected light.


That's the Fresnel effect, which CAN use the effects you describe (where the reflection intensity is basically (1 - V dot N), effectively 1-cos(@)) it's not always that way, in fact it's almost never that way. The minimum and maximum values of the Fresnel approximation do not have to be zero and one.

Half Life 2 does not use the Fresnel effect for its cubemaps either, only for the water.

Quote:Half-life 2, puts specular light intensity into their textures but neglects the player's vector during play. So as you move to the side of the wall the light stays the same strength. They would have to recompute your vector each time you moved and alter the specular light and that takes time. I haven't played the game so I don't know if they do this with lightmaps or not but it would include walking over the patches each frame or as soon as you move in world. The patches would have to be small for specular to look good and walking over zillion patches like that is unlikely in realtime. Actually, they could treat many specular patches as one and update them at once. Still not perfect but you would get a falloff in specular if they did that and that might be more realistic than have them static.


...wow, um, hm...Well, from the very beginning, as I said earlier, HL2 uses precomputed cubemaps in areas of the environment. They do take the player's location into account when calculating the reflection vector, but when finding the vector they ignore the boundaries of the cubemap, creating the bug that I _THINK_ you're talking about.



Anyways, getting back on topic...
Quote:I guess my biggest question is how to get normal maps looking good outdoors, where the lighting is softer and diffuse compared to indoors?


Are you sure the lighting isn't softer because of the PRT you're doing? I've seen plenty of games (Far Cry comes to mind, Half Life 2 as well) where normal maps still look good in an outdoor environment.

To directly answer your question, I'll go with what I plan on doing in the future with my renderer (if I ever get around to doing outdoor lighting)

-Both dynamic and static objects will be using directional shadow maps together. I like the softness that SMs can provide when done right, and the fact that everything shadows everything else will provide the consistency and accuracy that I want.
-Lighting will be dynamic inside a pixel shader for both static and dynamic objects, using normal maps, Phong specularity with Fresnel effect for most objects (obviously if the artist doesn't want, say dirt that reflects, (s)he'll turn it off).
Now that you mentioned the cubemaps it's all coming back to me. Been a while since I read that paper of theirs. Anyways, the specular I talked about is not fresnel effect, it's just basic specular talked about in gfx books. That's how I do my specular. I'm not talking about refraction which I think you got confused with reflection. Still, no matter how HL2 gets its light from whether from cubemaps,etc. the fact remains that they still have to calculate the specular the way I outlined otherwise it's not specular. I think I remember from that paper that they pre-baked specular into the maps as well. The cubemaps were for dynamic lights I think. So in effect if what I say is true then I was partly right for static lights. I think you had in mind dynamic lights/environmental effects done with cubemaps. I do my projection shadows with them as well so they're nice trick :)
Quote:Original post by JD
Anyways, the specular I talked about is not fresnel effect, it's just basic specular talked about in gfx books.

The Fresnel effect that I was referring to is the idea that reflectance of a surface increases as the angle between the surface and eye increases, which is exactly what you described above.

Quote:Still, no matter how HL2 gets its light from whether from cubemaps,etc. the fact remains that they still have to calculate the specular the way I outlined otherwise it's not specular.


Could you explicitly detail what formulae/algorithm you're referring to the way you were describing specular light? e.g. gloss reflections, (R dot V)^n.

Quote:I think I remember from that paper that they pre-baked specular into the maps as well.


The artist adds in a reflection coefficient as a texture onto surfaces.

Quote:The cubemaps were for dynamic lights I think. So in effect if what I say is true then I was partly right for static lights.


The cubemaps are entirely static, precomputed, and are NOT just for lights. Because they use cubemaps, they same the entire environment.

Btw, since your memory has been leaving you, I'd recommend re-reading the presentation: http://www2.ati.com/developer/gdc/D3DTutorial10_Half-Life2_Shading.pdf

This topic is closed to new replies.

Advertisement