Tekkaman

导航

 

lightmapping

  Window -> Lightmapping,即可打开Lightmaping窗口。

  生成lightmap的GameObject的对象必须将Lightmap Static钩上。此举告诉Beast,此GameObject可以被Baked。

  

  

 

  Make sure any mesh you want to be lightmapped has proper UVs for lightmapping. The easiest way is to choose the Generate Lightmap UVsoption in mesh import settings. Use this to create the second UV channel to be used for Lightmapping.

  

  勾选上Lightmap Static。This will tell Unity, that those objects won’t move nor change and they can be lightmapped.

  

  点击Bake后,会生成lightmap目录,内含下图2个.exr文件:

  

实现原理

  每一个Render有一个lightmapIndex属性,以及一个lightmapTilingOffset。参考:

  1、http://docs.unity3d.com/ScriptReference/Renderer-lightmapIndex.html

  2、http://docs.unity3d.com/ScriptReference/Renderer-lightmapTilingOffset.html

  lightmapIndex指定LightMapSettings.lightmap数组的索引。而lightmapTilingOffset是uv信息。

  

  而lightmapData有lightmapFar、lightmapNear2个Texture2D。

  参考:

  1、http://docs.unity3d.com/ScriptReference/LightmapSettings-lightmaps.html

  2、http://docs.unity3d.com/ScriptReference/LightmapData.html

 

参考:

1、file://localhost/Applications/Unity/Unity.app/Contents/Documentation/Documentation/Manual/Lightmapping.html

 

posted on 2014-07-26 16:16  Tekkaman  阅读(1387)  评论(0编辑  收藏  举报