光照贴图接缝缝合技术可在使用烘焙光照贴图渲染的游戏对象中平滑不需要的硬边缘。
接缝缝合与渐进光照贴图 (Progressive Lightmapper) 配合来实现光照贴图烘焙。接缝缝合仅对单个游戏对象有效;多个游戏对象无法平滑地缝合在一起。
Lightmapping involves Unity unwrapping 3D GameObjects onto a flat lightmap. Unfortunately, some mesh faces that are close together separate in the Lightmapping process. The edges of the mesh that Unity separates in lightmap space are called “seams”. Seams are ideally invisible but they can sometimes appear to have hard edges depending on the light. This is because the GPU cannot blend texel values between charts that are separated in the lightmap.
接缝缝合方法便可以解决这些问题。启用接缝缝合后,Unity 会执行额外计算来修改光照贴图,从而改善每个接缝的外观。缝合方法并不完美,但通常会极大改善最终结果。默认情况下,Unity 会禁用接缝缝合,这是因为 Unity 需要进行额外计算,导致烘焙期间接缝缝合要花费额外时间。您可以在游戏对象的网格渲染器 (MeshRenderer) 上启用缝合。
要在游戏对象上启用接缝缝合,请找到游戏对象的网格渲染器 (Mesh Renderer) 组件,打开 Lightmap Settings 部分(仅当使用渐进光照贴图时才能访问),然后勾选 Stitch Seams。