I have a scene with couple hundred meshes and 9 terrains 2000x2000. Unity crashes even if I try to bake-selected 1 mesh at a time, because it exports all the other “static” meshes and terrains, before calculating lightmap. It crashes during that export phase (I have 12 GB RAM, i7, Radeon HD 6950, if it has something to do with this).
I tried to mark JUST this one single mesh “static” and uncheck on other meshes. Then it bakes fine, on that single mesh. But, if I uncheck “static” on baked mesh, and check some other mesh to bake the light, the previous mesh looses the lightmap.
In conclusion - There is NO WAY, Unity can lightmap my scene all at once, without using NASA supercomputers. Also, it seems, bake-selected function is a “scam”, since it tries to calculate all meshes and terrains in the scene anyway.
Yet, I don’t believe that Unity simply can’t handle lighting big scenes, that would be nonsense…
So, please tell me, how do I approach this and lightmap my giant scene?
P.S. Is there some way to use other computers in the network to count lighting (like in Unreal’s Lightmass for example)?
I found the way myself.
- First you bake all the meshes and ONE terrain.
- You back up/rename the lightmap for the terrain you just baked.
- Then, you UNCHECK “Lightmap Static” form the terrain you just baked (but you have the lightmap backed up)
- Next, you bake all the meshes and SECOND terrain, and you back up the lightmap for that terrain. In the meantime, you will notice that the first terrain “unbaked” (because you uncheck “lightmap static”.)
- You proceed this way with all the terrains (I have 9 in my scene).
- Then you manually add slots in Lightmapping window for that terrains, you check the “lightmap static” on them once more, manually assign the backed up lightmaps to the terrains.
Giant scene is lightmapped. A lot of work, but this is the only way, so it doesn’t crash.
You can try Bake Selected. It will bake only the selected bake-able gameobject. Bake-Selected will not change the lightmap (or parts of it) that belongs to other gameobject that you did not select.
I usually use this when I make a tiny changes to the arrangement of the props (in this example, lets say it is a barrel); By Bake Selected, I just bake the barrel, the floor, and any wall/other stuff that the barrels’ shadow will affect (If there is a tree in my scene that will affect the lightmap of my barrel but not the other way around, I don’t need to select the tree)
In your case, however, you can bake a few gameobjects at a time; and eventually you will have the whole scene baked.
- Setup all lightings and all static objects
- Select a few object (adjust the number according to mesh-size and number of object)
- Bake Selected
- Restart from Step 2
This answer is not possible anymore
Anyone Knows some solution?
If you have a prefab with a 'lightmap static` option checked inside another prefab that may cause baking problem .
(Let’s say you have quad prefab with ‘lightmap static’ checked and you are using this quad prefab inside soldier prefab ‘lightmap static’ unchecked )
So , changing the ‘lightmap static’ option from the base prefab instead where i use worked for me .