Lightmapping In Unity 3D

Hello everyone. I’m a member of a small two man team thinking about using Unity to develop our game, and I’m overseeing the art.

This will be our first time using Unity to make a full game, but we both have experience with other engines and also Javascript, and so far Unity has been great to work with. However, today both of us ran into a problem.

The levels in our game will be medium sized, think something like Standoff from Halo 3. They maps will be primarily outdoors similar to Bad Company 2. We’ll be using Unity Indie, so obviously we cannot take advantage of real-time soft shadows, and will be using lightmaps. However, as of now, I cannot figure out how to bake terrain lightmaps that include shadows from other objects in the map. For example, we have a prefab building object placed on the terrain. When we bake the lightmaps, I’d like for the building to cast a shadow. I’ve fiddled with the settings and I’ve not been able to figure out exactly how to do this, if this is possible.

Can someone please point me in the right direction to how I would go about accomplishing this?

Thanks in advance,

Aaron

Welcome to Unity,

So for meshes to cast shadows onto the Terrain while baking a lightmap the meshes need to have mesh colliders. If you don’t need mesh colliders for these objects at runtime then just add them for the bake and remove them afterwards.

It is also possible, with a little work, to export your scene to your preferred 3d app and bake the lighting there. I’ve done it manually before with obj export utilities, but there is also this Unity Extension:

http://unity3d.com/support/resources/unity-extensions/external-lightmapping-tool

It is for Max, but people have made it work for Maya (myself included) and I’m sure it could work for any 3d app if you put a little elbow grease into it.

Thanks aNTeNNa trEE, I’ve gotten that to work. I’ve looked at exporting the scene out, I use Blender and I’m sure I could figure it out as long as it’s exported in a file format Blender can import. This seems like it could end up being a better option, as I’d like to bake lightmaps for all meshes in the scene, and it appears that that’s not possible with Unity at the moment?

If I ended up exporting my map, can I have multiple UV layers? So I can bake all my lightmaps in Blender onto one image for use in Unity? Sorry I’m asking so many questions, Unity handles lightmaps a tad differently than Hammer or Unreal Ed which I’ve used in the past.

Thanks for the advice.

Aaron

EDIT: I feel like a fool now, shortly after typing that I remembered the Lightmap type shaders. Silly me. So it looks like I’ll simply use Unity to bake terrain lightmaps and bake everything else in Blender, assuming I can figure out how to export the meshes from Unity.