Jump to content
  • Advertisement
Sign in to follow this  
spek

"Next-gen" lighting systems

This topic is 4009 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, It's been a while since I did graphics programming, so I wonder if I'm still up-to-date. I want to pickup my hobby game-project again, but I wonder if I should stick with my current lighting system, "radiosity normalMapping". Which is a lightmapping technique that allows (fake) normalMapping by calculating 3 lightmaps (each "pixel" on the lightmap is measured from 3 directions, instead 1). Or in other words, the technique Halflife2 uses as well. However, adding anything dynamic is a well known problem for lightMaps. The normalMapping itself isn't always very impressive either(also no support for specular like you can do with Phong or something), and I have some problems with the detail. It takes a 6(!) hours to create a 1024x682 (3 together is 1024x2048) HDR lightMap, and I still don't have that much detail. I know, it can be done faster and better. But maybe its time to switch over to a dynamic approach. I've seen some "next-gen" games like Bioshock. I don't know what kind of lighting system they use, but it looks damn good. I think its dynamic, but it also has soft shadows, not those sharp-edged shadows from Quake4 or F.E.A.R. (which did soft-shadows, but still looked too sharp). The shadows in Bioshock are way more smooth or "smudged", which looks great: http://media.insidegamer.nl/screenshots/public/8201/75701.jpg So, what kind of techniques do these games use to get that? Like I said, I've been living under a rock for almost a year, so I might missed some "hot new technologies" :) Greetings, Rick

Share this post


Link to post
Share on other sites
Advertisement
From what I've seen of BioShock, the shadows are shadowmaps with some nice filtering to give a softer feel along with some low-res static lightmaps for general background/ambient lighting. Quite how they manage to do all that plus their insane amount of post processing amazes me though.

Share this post


Link to post
Share on other sites
Ok, but how do games like these perform normalMapping? The same way like HL2, or something else? Or would they use both, something like:
- basic lightMapping / decal texture pass
- normal / specular mapping pass for nearby light 1
- normal / specular mapping pass for nearby light 2
- normal / specular mapping pass for nearby light n

? I don't know if its a good idea to mix realtime lighting with pre-calculated lighting though... But the normalMapping effect is obviosly there. In HL2 you see much less of it, because its "fake". As far as I know you need to do realtime lighting for the normalMapping effect, since you need to know light positions/colors/ranges.

As for the shadows...
http://www.sme.sk/cdata/1780250/bioshock_02_s_b.jpg
Maybe its me, but I can't get these detailed shadows in a lightMap. Or would all objects (like that glass tube) use shadow maps like you mentioned?

-edit
It seems Bioshock is using the Unreal 3 engine:
http://www.unrealtechnology.com/html/technology/ue30.shtml
What exactly does this means:

Ultra high quality and high performance pre-computed shadow masks allow
offline processing of static light interactions, while retaining fully dynamic
specular lighting and reflections.

Directional Light Mapping enables the static shadowing and diffuse
normal-mapped lighting of an unlimited number of lights to be precomputed
and stored into a single set of texture maps, enabling very large light
counts in high-performance scenes.

Im especially interested in the way how they combine dynamic with pre-calculated lighting in a proper way. Simply doing a lightmap pass and add or multiply that with a pass that used realtime lighting, is not going to give good results I think... I assume a "directional map" is somewhat the same as they use in HL2 (where teach lightMap pixel has been measured from 3 directions in that case, so that "fake" normalMapping can be used). But how to combine that with realtime lighting?

Greetings,
Rick

[Edited by - spek on September 18, 2007 4:30:45 PM]

Share this post


Link to post
Share on other sites
I would imagine how they handle the lighting would depend on the shader model being used. I know some games like Far Cry would do multiple lights in one pass when in SM3.0, which allows for some pretty lengthy uber-shaders.

As for Bioshock, it doesn't sound like they're doing anything too fancy there. I may be missing something, but it sounds like they're just describing static lightmaps in a way that makes it sounds like they're something else. Being that the game is SM3.0 only, its likely they're doing what FarCry does and blending together both the lightmaps and the dynamic lights in one pass (I don't remember there ever being a large amount of dynamic lights effecting any single surface).

I don't see why you couldn't do something similar, and probably ditch the old bump-mapping technique. You could just do it right in the shader before performing your lighting.



Share this post


Link to post
Share on other sites
Well, one of the problems might be the (HDR) coloring. Imagine a room with a blue light. It will produce a blue-ish lightmap. In pass 1, I would apply that lightmap. After that, I perform dot3 lighting with attenuation in a second pass. This pass will also deliver a blue-ish result. So far so good, but can I just multiply these 2 results?

- How to deal with HDR? Now I'm using HDR with the help of the lightMap. A pixel from the lightmap might exceed the {1,1,1}(white) value by far. If the realtime lighting is also HDR, I could get enormous values.

- The result in the lightMap is not the same as in the realtime pass. Some area's might be way to dark with realtime lighting, while it's relative light in the lightMap because indirect lighting via radiosity. In the worst case black pixels from the realtime pass will "black-out" the inderectly litten pixel as well. The same might also happen with the attenuation. Lights in the lightMap might shine further/less far than in the realtime pass.

- How to deal with shadowcasting? If I have a pillar in that example room, the lightMap will have a shadow somewhere from that pillow. With realtime lighting, the blue light will shine right through that pillar, so blue pixels from the realtime pass are multiplied with dark pixels from the lightMap, while there shouldn't be blue there at all. Unless I use stencil shadows or something to black-out that part behind the pillar maybe?

- Dynamic lighting: Its easy to enable/disable lights in realtime lighting. But the lightmap doesn't change of course. I could switch to another lightmap (for a part), but it still is not very dynamic of course (although Bioshock isn't that dynamic either with the lighting).

The result doesn't have to be 100% accurate of course. But I worry about strange bugs, since a radiosity lightMap produces another result than a realtime litten scene (without stencil shadows). Multiplying these 2 might give a nice average between the two, but mauybe it might also cause some weird lighting...


Funny that you mention good old Farcry, I was thinking about that as well. But as far as I know, their lightMaps aren't 100% normal either. I believe they used some sort of technique as well to tell from what direction the light comes from per pixel. But I'm not sure though, maybe it really is just basic lightMapping like Quake2 did as well. Maybe someone gots more information about that?

Maybe it's not really true what I'm all saying though, like I said, I'm not really up-to-date with lighting techniques anymore :)

Greetings,
Rick

[Edited by - spek on September 18, 2007 6:59:24 PM]

Share this post


Link to post
Share on other sites
Hmmm...are you saying that for any 1 surface, you might have a lightmap and a dynamic light for the same light source? I'd assume that the lightmap would contain the contribution for 1 more static light source, and then any dynamic light sources would calculated and the result summed with the lightmap values. I'm not very familiar with light maps, perhaps I'm misunderstanding something?

Share this post


Link to post
Share on other sites
I'm neither familiar with the combination between the two, so maybe its not making sense what I say. But yes, I think that is what I want, the lightsources are used twice (in the lightMap and dynamically), and that's why I worry about mixing 2 different things.

I could tell via an editor which lights are static (=lightMap) and which are dynamic (=realtime). But how to do that exactly? Again, imagine a room with 1 single light, and a pillar in the center. If I mark that light as dynamic, I get my normalMapping / specular lighting working, but the lightMap would be completely black there(=no effect). In that case the pillar won't cast a shadow, and there is no indirect (radiosity) lighting either.

If I mark that light as static, which it basically is since 99% of my lights won't move or change, I get a nice lightMap for that room. But no normalMapping or specular lighting, since the normalMapping shader won't get any dynamic lights (position/color/strength).

My game will be pretty dark for most parts (weak lights), most surfaces are only lit by 1 or 2 lights directly. So I really need that lightMap (or another realistic way) to do the shadows and the indirect lighting. But I also like to have the normalMapping working.

Greetings,
Rick

Share this post


Link to post
Share on other sites
I think basically you split up your lighting into a diffuse component, a specular component and dynamic shadows. You get the diffuse component from your (directional) lightmap(s) and calculate the specular part of the phong shading in the pixelshader. Now for dynamic shadows I guess you will get lots of harsh seams between the soft shadows encoded in the lightmaps and the hard shadowmapped shadows, so some clever trickery will be needed to integrate this and hide the artifacts.

There's also a paper on HL2's shading, I think on ATI's developer sites, that probably explains some details.

Share this post


Link to post
Share on other sites
Hmmm... Doing the diffuse by the directional Lightmap (what I already do now) combined with realtime specular lighting... Not a bad idea I think. However, the normalMapping effect for non-shining materials is still not much, since its done by a static lightMap. If I move a light over a non-shiny concrete wall for example, the light will barely have any effect on that surface.

I never seen dynamic shadows mixed with lightMap shadows though (I think), except for dynamic objects such as characters, lockers, barrels, and so on. Halflife2 for example isn't doing any dynamic lighting on the static environment (except for your flashLight), only the objects are using realtime lighting from 2 nearby sources (according to that paper you mentioned).

Dynamic objects are not the problem for now. Basically I want a realtime lighting solution for a static environment, but with soft shadows/indirect lighting. I know realtime radiosity and that kind of stuff is not really possible yet for games, but I suppose there are some tricks and combinations between the two techniques, like Farcry did, and Bioshock probably as well.

Thanks for helping,
Rick

Share this post


Link to post
Share on other sites
you called this thread " "Next-gen" lighting systems" so I have to wonder why the discussion is about Halflife2 style lighting.. which looked out-of-date even when it was released.

I reccomend abandoning lightmapping altogether and going with realtime shadow maps.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!