Hello!大家好,我是小洋。
1.最近我遇到了unity里烘焙的问题,错误提示灯光烘焙UV(UV2)有重叠问题。导致了烘焙的光影图是模糊和布满脏斑等缺陷的。
 重叠部分为红色: 
2.UV1是控制纹理贴图的,UV2是控制光影图的。
3.VR和游戏引擎的烘焙,其本质是将所有面所接受的光影渲染到与其对应的展平UV区块上,多个UV区排列成一个光照UV,将光照按照光照UV的排列渲染之后,生成一个光照贴图,最后将光照贴图按照光照UV的关系回贴到对应的模型面上。
进入正题:
1.如果UV重叠会在渲染物体的Inspector面板出现 This GameObject has overlapping UVs. Please ena ble ‘Generate Lightmap UVs’ on the Asset or fix in your modelling pac kage. 的黄色警告:  2.可以在Lighting面板的Baked Lightmaps里可以查看烘焙的灯光贴图(也可以点击警告上边的烘焙图进行打开):  3.选择Baked UV Overlap可以查看UV重叠的情况,重叠部分为红色。  4.选中UV Overlap可以在scene中查看。  
5.勾选启用 Generate Lightmap UVs 自动为模型生成光照贴图 UV,如果有重叠可以加大uv之间的间距,使用 Pack Margin 设置可确保几何体的 UV 图表之间有足够的边距。 基本就可以解决了。:  6.系统自动展的UV2,是有缺陷的,自动展的做集中在左下角,上边一半的位置都浪费了。如果有条件,自己在建模软件里做会更好。 
Unity官网,UV重叠:https://docs.unity3d.com/cn/current/Manual/ProgressiveLightmapper-UVOverlap.html Unity官网,自动为模型生成光照贴图 UV:https://docs.unity3d.com/cn/current/Manual/LightingGiUvs-GeneratingLightmappingUVs.html 参考了这个小姐姐,写的文章挺好的,可以去看看(有收费内容谨慎购买,看看免费的就挺好): Unity3d办公场景灯光布设与光影烘焙及后处理【2020】
|