如何在Unity中动态载入unity5 烘焙lightmappping

【Unity3d】如何在Unity中动态载入Lightmapping,有需要的朋友可以参考下。用Lightmapping的好处就不用多说了(渲染速度快又出效果), 下面是解决方案一. 首先, 美术将A.Prefab放到场景中打光, 渲出Lightmapping, 假设生成的的是A_Lightmapping.exr二.然后, 在运行时载入此A.Prefab, 这时是没有Lightmapping的, A模型是花的三. 载入对应的Lightmapping并且添加进来
static public void AddLightmappingTex(string lightmappingFile, int lightmappingIndex)
{LightmapData[] lightmapArray = LightmapSettings.lightmapArray [lightmappingIndex].lightmapFar = Resources.Load(path) as Texture2D;
LightmapSettings.lightmaps = lightmapA
}四.修改A.Prefab对象的lightmapIndex
static public void SetLightmappingIndex(GameObject obj, int lightmappingIndex)
{if (obj.renderer != null && obj.renderer.lightmapIndex != -1){obj.renderer.lightmapIndex = lightmappingI}int count = obj.transform.childCfor (int i=0; i& ++i){SetLightmappingIndex(obj.transform.GetChild(i).gameObject, lightmappingIndex);}
最新教程周点击榜
微信扫一扫Unity 5 Lightmapping - Unity Answers
Navigation
Unity account
You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio.
Unity 5 Lightmapping
Hi, I have an 3D mobile game project. I want to use lightmapping (baked light?). I couldn't do the exact thing with Unity 5.x versions. Here, some images about my problem:
Without lightmapping:
With lightmapping:
Do you have any ideas?
Hint: You can notify a user about this post by typing @username
Attachments: Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.
23 People are following this question.

我要回帖

更多关于 unity lightmap 的文章

 

随机推荐