|
Subject says it all I guess. My entire game project runs in a single scene, levels are made up of prefab objects which are instantiated and destroyed at runtime as the player goes in and out of levels - I need each level prefab to be lightmapped, but I've got no idea how to do this.
(comments are locked)
|
|
The active lightmaps are a simple function of what lightmaps are in the lightmap list, and what lightmap index and lightmap atlas properties the objects in the scene have. So you could actually do a bunch of different bakes with your different prefabs active, and then "merge" them all together by putting all the produced lightmaps in the lightmap array, and setting the correct lightmap indexes and atlases on all the different objects. I actually use custom scripts for doing that (still has problems which is why I haven't shared it), but there is a script called "Beast Helper" that can help with this (it also has problems, especially with identically named objects in the hierarchy) but it's a great starting point for merging bakes Another option that probably won't actually work for you (because it's probably too much to bake at once) is to put all your prefabs in the world at once, and bake them all, and save the baked stuff back out to the prefab. Thanks for your response, is there any information anywhere on how to use the lightmap array and how to set Indexes on objects? Another alternative solution I think may work, is to place each individually light mapped piece of geometry in its own scene and load them into the game when needed at run-time using additive load.
Nov 25 '11 at 08:26 AM
Alkan
Yeah, unity provides interfaces for all this - for getting how objects map into lightmaps it's: Renderer.lightmapIndex Renderer.lightmapTilingOffset and to get at the lightmap array it's: LightmapSettings.lightmaps
May 01 at 09:19 PM
thorbrian
(comments are locked)
|
|
You could also delete the model and instantiate in it's place an identical model that has different lightmaps.
(comments are locked)
|
