So you’ve built a wonderful terrain with lots of trees and other models on it, and now you’d like to bake a lightmap onto it? You’ve probably found that in Unity Free, realtime lighting (hard and soft shadows) is unfortunately not supported. But the option to bake a static lighting onto your terrain exists (and […]

This article was posted by Independent Software, a website and database application development company based in Maputo, Mozambique. Our website offers regular write-ups on technical and design issues, ranging from details at code level to 3D Studio Max rendering. Read more about Independent Software's philosophy, or get in touch with Independent Software.

So you’ve built a wonderful terrain with lots of trees and other models on it, and now you’d like to bake a lightmap onto it? You’ve probably found that in Unity Free, realtime lighting (hard and soft shadows) is unfortunately not supported. But the option to bake a static lighting onto your terrain exists (and definitely works), and it adds a huge chuck or realism to your game. However, there are some caveats that you should bear in mind, or your baked lightmap will not appear.

A Unity terrain with a baked lightmap

A Unity terrain with a baked lightmap

First of all, you’ll need a light source. A directional light will probably give you the results you are looking for, and you can align it with the sun in your skybox, if you have one.

Second, your light source must cast shadows. This is where you might say, “But Unity tells me it doesn’t support shadows!” It does in fact seem that way:

A Unity directional light with soft shadows

A Unity directional light with soft shadows

Unity warns us that “Realtime shadows require Unity Pro”, for both soft and hard shadows. You’ll be tempted to turn it off then, since shadows are not supported. However, this is a very misleading message. Realtime shadows are in fact not supported, but the Shadow Type is, for baked lightmaps. Either pick soft or hard shadows, and your lightmap will be baked just fine. No shadows means no lightmap.

Finally, baking a lightmap takes some time (could be 10 minutes or so for a reasonably detailed terrain). Even though Unity’s baking progress bar disappears after a short while, it’s actually delegated the baking to a subprocess called “Beast”. You won’t get feedback for a while, but it will be churning out the lightmaps and eventually the lightmap previews will appear in the baking window. Just don’t touch it.

Leave a Reply

Your email address will not be published. Required fields are marked *