Lightmapping

Hey guys,

Can y’all point me to a good lightmapping tutorial? Preferably one that is reasonably recent?

I’ve come to the point where I want to lightmap my level, but I know frack-all about lightmapping :slight_smile: So I need some guidance. I probably need to have a good overview via a tutorial of some sort. I’m afraid I’m not getting very much useful information out of the Unity docs on this one.

As to my specific problem:

I’m using deferred rendering. I set my environment models and light sources to static as appropriate. I set the models to import with “Generate Lightmap UVs” (my UVs are within 0->1, but they overlap a ton [by design], so I’m letting Unity unwrap a UV2 for me). I set a very low quality baking, just so I could test the bake. I have the bake mode set to Directional Lightmaps (that may not be the setting I want, not sure what to put there, but it seems to be the default?). Even so, it still takes nearly 2 hours to bake, due to the complexity of my scene.

The bake sort of works, I get light maps (I get 207 of them, in fact). The problem is I lose all my shadows. Even when I’m close up to a wall, the shadows simply are not there (I have the shadow distance set to 65), which I don’t think is right, I should be switching over to real time lights at 65 meters, right? So I must be doing something wrong. I do get shadows if I turn off the light maps, so they do work. But with the light maps on, they are gone.

Anyway, thanks for any advice you might give me.

Yeah, I set the bake mode to Dual Lightmaps, and that brought back my shadows on the dynamic objects, so that was my issue. Also, I now have a small test scene to play with lightmapping, which goes in about 10 minutes rather than 2 hours (on high quality no less). Which will allow me to experiment with different settings.

I’d still like any tutorials you guys might know about. I don’t really know what all those settings are for, and I’d like to know what I’m doing :slight_smile:

Well, don’t everybody chime in at once :slight_smile:

The only real decent tutorial I found on lightmapping was the one over at 3DBuzz, here:

http://www.3dbuzz.com/training/view/unity-fundamentals/lightmapping

It’s a bit dated, since they use Unity3, but still chock full of some great information. What I especially liked about it was they go through every setting on the bake panel, explain what it is for, and then show you what just that setting does at a couple of different levels (without changing any other settings). I learned quite a bit, and I recommend these four videos to anyone that’s in my position (who doesn’t know anything about lightmapping). It gives you an idea of not only what each setting is for, but what the reasonable ranges for those settings are, which is really the information you need to have to use that panel.

Between that and playing around with my mini test scene, I think I have some values that will work for my main level. Before I watched those videos, I was getting a significant brightening of the entire level, and I couldn’t figure out why. Thanks to those tutorials, I now know it was because I had my bounce intensities set way too high, which was causing my near maps to be too bright. So good stuff.

One question I do have, if anyone knows: They mentioned the lightmapper has a limit of 255 pairs of textures it can produce. Now, suppose I set a resolution of 50 texels per unit. If that resolution would result in too many textures (>255), will Unity (or Beast I guess?) detect that and automagically reduce the resolution such that the maps fit into that limitation? I’m a bit worried I’m going to hit that limit. My level is quite large, and even when I did a low quality test bake (2 hours), it created over 200 texture pairs. I currently have set my resolution to 50 and am doing a high quality bake right now (working into it’s 10th hour as we speak), and I have a nasty feeling something bad is going to happen, heh. I don’t really want to have to experiment with the resolution setting to get the right value, so I’m hoping it will be fixed for me if an overrun problem is detected. Does anyone know?

Check this out: http://cgcookie.com/unity/author/wesm/

There’s a two part intro to lightmapping in Unity tutorial.

Thanks,
Chris