- Home /
Dual lightmaps on prefab?
I am making a game. Levels are generated in a simple way, there are different room types / shapes, the generator place them onto a grid. So it uses a 2D array. It also determine, where the doorways has to be. It is very similar to the first Legend of Zelda game's dungeons or to The Binding of Isaac. I asked a question about this on the forum, I didn't get the right answer about it yet. I just got some ideas, but I wasn't able the use them.
The generator is done (mostly), now my problem is the lightmapping. I know, lightmaps are connected to the scenes, not to the game objects. But I need to connect lightmaps to game objects / prefabs. The generator will choose rooms to create from prefabs. All these prefabs has to be lightmapped (far and near lightmap, if it is possible).
One room is not one mesh, It is made by 4 wall meshes, 4 wall with doorways meshes, floor and ceiling (and possible extra stuffs like crates, barrels, stairs, platforms).
I wonder, how should I apply lightmaps to my prefab that I generated with Beast. I would be happy already, if I could apply only single lightmap to my game objects. I was trying with legacy lightmapped shaders, but I wasn't able to set the offset and tiling. Floor, ceiling, walls, etc had to have different values, that I can't achieve with using one material. I don't expect that the shadows will stretch into an other room, light mapping on a dynamic content shouldn't able to do this, but it works in case of real time shadows.
Anyway, more information about the generator and the rooms are *here*. I'm using the latest Unity Pro.
Answer by Darkworth · Jan 18, 2013 at 10:45 PM
Hello,
Did you ever find a solution for this? I too am working on a game where the levels are generated dynamically at run time out of pre-built section prefabs and am looking for a way to have the pieces lightmapped.