Home Technical Talk

Single Map Directional Lightmap. How to bake?

polycounter lvl 14
Offline / Send Message
d1ver polycounter lvl 14
Hey guys!
I'm sorry I didn't post in the thread Noors created way back, but I have a more specific issue and I wanted the thread title to reflect that.

Basically the workflow Noors described here works great:
http://www.polycount.com/forum/showthread.php?t=71538
But one texture is always better then 3, so I'm really curious if anyone has any idea on how do that.

The main difference I see is that with the 3-map approach you actually bake lighting 3 times with a bit different local normals each time, but when you go with a single map you actually have to bake an averaged light vector for that pixel. Is that the case?

Now in real-time it seems easy-peasy 'cause the light vector is passed on to the shader automatically, but I can't immediately think of an alternative with off-line rendering.

I know guys at Insomniac did that, so it can be done:
room9.jpg
I wonder how, though.

Any input would be crazy appreciated. Thank you very much in advance!

Replies

  • Kurt Russell Fan Club
    Options
    Offline / Send Message
    Kurt Russell Fan Club polycounter lvl 9
    The three map Valve approach lets you use coloured lights. Each texture stores the colour of the radiosity lighting as if the normal was in one of the three basis directions. Each image here is storing the strength and colour of lighting from a given direction.

    That version that Insomniac have used looks like it's for a single light (or maybe multiple lights using average direction), and they've stored the vector from the surface to the light. It's a normal vector but its magnitude is shortened to attenuate with distance so the light becomes duller further away from the light. Any areas completely unlit appear to be (128,128,0)

    So the first one stores total lighting colour for a given perturbed normal and the second gives a vector from the surface (assuming mesh normals) to the light, and the strength packed into the magnitude.

    You could put the Valve version into one texture if you were willing to eliminate colour and pack total lighting value into each channel, but you'd end up with a different looking map. You could go with just storing the light vector like the Insomniac example - I don't think radiosity would look too good, but you could use the light vector for accurate specularity instead of needing an additional map like Valve's version. Each would need a different custom shader for lighting the surface. And I don't think you'd be able to have colour information for either, which would be a shame.

    I hope that makes sense! :)
  • wes.sau
    Options
    Offline / Send Message
    In the past I've read about someone storing directional light intensities in R,G,B of a single texture (as KRFC mentioned) and then the averaged light color in the vertices of the world meshes.

    You would still have to bake lighting 3 times (in the HL basis vector directions) to get the directional intensities + once more to bake the averaged (flat - nondirectional) lightmap colors to the vert colors, and you couldn't have different colors of light overlapping on a surface like the HL RNM style.

    Obviously the vert color used for light color takes away that data for any material blending and also relies on enough vertex density when a lot of color changes in a small radius are desired. But it could give you more complex lighting for one texture than the approach KRFC mentioned with just one averaged light vector giving you only one light direction/intensity per pixel AND being averaged color, if I read that correct?
  • Noors
    Options
    Offline / Send Message
    Noors greentooth
    Well you need light intensity + color + maybe shadow...That's a lot for a single rgba map.

    The only way to use 1 single map is the way epic did citadel demo : baking a huuuge lightmap that could catch all the normal maps details in it. At the end, the normal maps aren't needed anymore. Bye bye to specularity.

    from another thread :
    epiclightmap.jpg

    Ofc, the more resolution you have, the better bump you get. This is more oriented for iOS stuff. If you want the bump to be as accurate as the diffuse, then, directionnal lightmaps is the way to go.

    In one thread, the guy who was responsible for the lighting in Mirror's Edge and other big titles (i don't remember his nickname sorry), said that 1 light intensity map+ 1 color map didn't give a result as good as 3 rgb maps because the color information per basis matters too. I'm pretty sure we can trust him.

    UDK still, uses 1 map for the light directions + 1 color map + 1 shadow map (to mask specularity in shadowed areas) as far as i understand it.
Sign In or Register to comment.