How on earth do I lightmap a terrain now?

Hi,

This is a total noob question, but my DAYS of searching so far have been totally fruitless, and no-one has answered my pleas in UnityAnswers, so here goes…

How on earth is lightmapping a terrain meant to work now?

This is patently wrong: http://unity3d.com/support/documentation/Components/terrain-Lightmaps.html - the menu options used here don’t even exist any more. This is the #1 result for Unity lightmaps in Google, so the fact that it is so so wrong is extremely worrying.

I have built an island terrain myself, with no importing of meshes from anywhere else, and now I would like to lightmap it. I remember doing this in the past, and everything used to look great when I clicked a simple, easy button. Now I have tried to use the new Window > Lightmapping area that I found after a good deal of searching, but absolutely nothing comes up in the Preview pane; it’s totally black. And nothing works. No lightmapping action I try changes anything in my scene, no matter what I do.

I have a directional lightsource, I have ticked the Static checkbox for the terrain, and it is certainly the object I appear to be lightmapping, but nothing works. Baking it takes about 8 minutes but looks identical to the unbaked version when I play the scene.

I did find this other doco, but it certainly doesn’t work for me: Unity - Manual: Lightmapping: Getting started Again, I see nothing in Preview.

I’m using the free version of Unity. Does it even support lightmapping any more? I’m finding that although the Unity platform itself seems to have progressed heaps since I last used it, the documentation is pretty much a train wreck.

Please help!

is the terrain large?

that would be bad cause the lightmap is stretched over the terrain, the larger it is, the less sense it makes to lightmap it at the time (I forsee that we will see an enhancement there with 1 lightmap per chunk object on the terrain as it is right now basically useless to lightmap anything but mountains to the lightmap)

The terrain is fairly large, but I have had no trouble at all with a terrain this size in previous versions of Unity. (I’m not at home right now, so I can’t give the actual dimensions.) Surely all that should mean is that the baking would take a while, anyway?

On Unity 2 you had to switch the mode to be lightmapped and then it worked. but it didn’t lightmap trees.

U3 lightmap trees and you don’t need to change anything but the terrain size at which you see more than nothing or a pixel blob is very small (the default 2000x2000x??? is already much too large for trees from what I recall)

I think my terrain is 1000x1000. From what you are telling me, this simple feature is just no longer supported by Unity, which is more than disappointing. Does anyone know where I can get a copy of Unity 2?

At 1000x1000 it should work normally.
Question is for what kind of lightmap you need it and if you have a light in the scene thats set to auto or bake. Also question is what you awnt to be lightmapped (as mentioned, in U2 trees were not lightmapped at all)

It hasn’t been removed, it’s simplified. You don’t have to do anything, other than click “bake”.

–Eric

Hi Eric,

It just doesn’t work for me. That’s the whole point of this thread! If you can shed some light on how to get it to work, I’d love to hear it please.

Nello

Dreamora, I have a directional light in the scene set to ‘auto’ (I have also tried ‘bake’). I don’t understand what you mean by what kind of lightmap I need. A simple one?

I would like the ground (and trees, if possible) to be lightmapped just like it used to be here: http://unity3d.com/support/documentation/Components/terrain-Lightmaps.html

Again, this used to work simply and easily. Now, not so much.

if thats all you need you really only need to drop the terrain in, drop a directional light in, orient it, setup the lightmap config as you want and press bake on the bake dialog (not selective bake in case you are on that tab by error)

I’m pretty sure that’s what I’ve been doing. I’ll be home in a few hours, so I can check on the size of my terrain then, but would you expect a too-large terrain to just break the preview function?

It’s more simple and easy now, actually. Here’s a video of me making a 5-second terrain in a new project, then baking the lighting. (Might want to download that instead of viewing in a browser window, depending on your screen resolution.) I toggle the light a few times before baking to show that it’s realtime lighting, then click “bake” (feel free to skip ahead about 45 seconds here :wink: ), then I toggle the light a few times afterward to show that it’s lightmapped now, not realtime. Really, you just click “bake”. Of course you can fiddle with stuff as desired, but the defaults work. With the default terrain size of 2000x2000 and the default 1024 resolution lightmap, tree shadows are pretty blobby, but you can of course increase the lightmap resolution and/or decrease the terrain size.

–Eric

Thanks! I’ll check it out when I get home, but I suspect there’s something really simple I’m doing wrong.

Make sure your light is marked as static as well.

That’s not necessary.

–Eric

Sorry for that outdated doc page, I must’ve missed it when I was purging the old docs, but nothing links to it anymore: Unity - Manual: Terrain (apart from google).

So Eric5h5 is as usual right about how you go about things:

  1. Open the lightmapping window.
  2. Make sure static is selected on the terrain (it will probably be static already) and choose terrain lightmap resolution from the drop down.
  3. Add a light to the scene, make sure Bake Mode is set to Auto (the default) or Bake Only.
  4. If you want the light to cast shadows in the lightmap, you have to enable shadows on the light - otherwise it won’t cast any.
  5. If you’re using Pro, for outdoor scenes it’s nice to use a blue-ish sky light, you can set it up in the Bake pane of the lightmapping window.

Now what I think is happening is that you’re hitting a bug in Beast, where Beast just cancels a bake half way through - it usually happens on OSX with dual lightmaps and with lightmap sizes at 4096. To work around this bug try one of those:

  • Set a lower lightmap resolution on the terrain, like 2048 or 1024.
  • Set lightmaps Mode to Single Lightmaps in the Bake pane of the Lightmapping window.
  • Try the same bake on Windows.

This bug has been fixed already and the fix is included in the next Unity release, which should come really soon.

:slight_smile:

May I emphasize how important that little step is??? LOL! I spent many hours trying to figure out why my lightmapping wasn’t working on a rather high-end pc with a small terrain. I set everything to static, I even tried setting mesh colliders, and several other tips I found on the forums.

The kicker: I’m currently using the free version of Unity. When you select the shadow type under the light’s settings, it’ll warn you that shadows are supported only in the Pro version (I’m at another location so can’t tell you the exact message, but that’s close). I thought I was messing with a setting I shouldn’t have since there was a warning color associated with it and other impressions that had me feeling that I was doing something bad and needed to back off and behave, and so I turned the shadows off. Shadows off = no scary message. :wink:

And there’s was the root of my problem. Don’t be steered away by the warning. Select either the soft or hard shadows and try your lightmapping. Hey, it works!

Just a “duh” moment I hope someone gets to avoid. :wink:

We should probably make this step smoother :wink:

In any case don’t forget that even in Unity free you can bake nice soft shadows, like in the second image from the bottom here: Unity - Manual: Lightmapping: Getting started

Hi,

Firstly, thanks to everyone for trying to help. It’s very kind, and I appreciate it. Unfortunately, it’s still nowhere near working for me.

Robert, your note was very confusing to me in a couple of places. I have no idea where “Bake Mode” should be set - is that the same as “Render Mode”? And I can’t see any dropdown where I could possibly choose “terrain lightmap resolution”. I’m running on Windows, and have only even been trying to use a lightmap size of 1024. I’m really not sure if that’s what you mean by resolution…

The clearest indications I have that nothing is working correctly is that a) I get no Preview at all, and b) even though Unity (or Beast) goes off and spends time rendering, I see no changes to any view and if I untick the light everything still goes black.

(Aliakey, thanks for the note. I realized quite early that I don’t get shadows on the free version of Unity, but that’s not my problem right now!)

I’m adding some screenshots in the (probably vain) hope that someone will be able to tell what is wrong by looking at them. I really miss how easy this used to be in earlier versions!

http://nelloadsl.homeip.net:20583/tiles/public

Thanks,

Nello

One more thing, my Bake pane in the Lightmapping window looks NOTHING like this: Unity - Manual: Lightmapping: Getting started

Huh???