This page has been translated automatically.
视频教程
界面
要领
高级
实用建议
基础
专业(SIM)
UnigineEditor
界面概述
资源工作流程
Version Control
设置和首选项
项目开发
调整节点参数
Setting Up Materials
设置属性
Sandworm
使用编辑器工具执行特定任务
如何擴展編輯器功能
嵌入式节点类型
Nodes
Objects
Effects
Decals
光源
Geodetics
World Nodes
Sound Objects
Pathfinding Objects
Players
编程
基本原理
搭建开发环境
使用范例
C++
C#
UnigineScript
统一的Unigine着色器语言 UUSL (Unified UNIGINE Shader Language)
Plugins
File Formats
材质和着色器
Rebuilding the Engine Tools
GUI
双精度坐标
应用程序接口
Animations-Related Classes
Containers
Common Functionality
Controls-Related Classes
Engine-Related Classes
Filesystem Functionality
GUI-Related Classes
Math Functionality
Node-Related Classes
Objects-Related Classes
Networking Functionality
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
IG Plugin
CIGIConnector Plugin
Rendering-Related Classes
VR-Related Classes
创建内容
内容优化
材质
Material Nodes Library
Miscellaneous
Input
Math
Matrix
Textures
Art Samples
Tutorials

光照贴图

Lightmapping is a static global illumination technique using precalculated textures that store brightness and reflected color of lit surfaces. By using lightmapping you can avoid heavy computations of lighting in primarily static scenes.光照贴图是一种静态的全局照明技术,它使用预先计算的纹理来存储光照表面的亮度和反射颜色。通过使用光照贴图,可以避免在繁琐的静态场景中进行大量的光照计算。

Lightmapping is the most efficient solution enabling to achieve realistic diffuse lighting and keep the high performance. It is capable of giving high-detailed global illumination combined with simulation of many light bounces. The number of bounces is the key aspect of creating realistic lighting in bright scenes. When you use lightmapping it doesn’t matter how many rays, bounces, or light sources are there, as everything is calculated once and then baked in textures.光照贴图是最有效的解决方案,能够实现逼真的漫射照明并保持高性能。它能够提供高细节的全局照明,并结合许多光反弹的模拟。跳动次数是在明亮的场景中创建逼真的照明的关键方面。使用光照贴图时,无论有多少光线,反射或光源都无所谓,因为所有内容都会计算一次,然后烘焙为纹理。

UNIGINE provides an integrated GPU-accelerated Lightmapper tool available in the Bake Lighting window.UNIGINE在Bake Lighting窗口中提供了集成的GPU加速的Lightmapper工具。

Current limitations:当前限制:

  • Lightmapping is available only for surfaces of Static Mesh objects.光照贴图仅适用于Static Mesh对象的曲面。
  • Only Non-Directional lightmaps are supported at the moment (normal maps are not taken into account).目前仅支持非定向光照贴图(不考虑普通贴图)。
  • Only global illumination is baked, direct lighting is to be provided by light sources.仅烘烤全局照明,光源应提供直接照明。

See Also
也可以看看#

  • Lightmaps baking is also available via code by using the BakeLighting Class.也可以使用BakeLighting类通过代码来进行光照贴图烘焙。

Preparing The Content
准备内容#

Proper and non-overlapping UV-coordinates of scenery are required for correct lightmapping. In the case your assets do not have these, automatic UV unwrapping on import is provided. The overall workflow is the following:正确且不重叠的景观UV坐标是正确进行灯光映射所必需的。如果您的资源没有它们,则会在导入时提供自动UV解包功能。

In the Import Settings for FBX, CAD models and UNIGINE .mesh assets, select the UV Channel and Target Resolution to be used for lightmaps and, if needed, check UV channels to unwrap. Traditionally, the 0 UV channel is used for texturing and the 1 channel is for lightmapping.在FBX,CAD模型和UNIGINE.mesh资源的导入设置中,选择要用于光照贴图的UV ChannelTarget Resolution,如果需要,请选择。 切换UV通道以展开。 传统上,0 UV通道用于纹理化,而1通道用于光照贴图。

The Lightmap Target Resolution parameter has the direct influence on the baking time and the final quality.Lightmap Target Resolution参数直接影响烘烤时间和最终质量。

注意
Unwrapping thin polygon meshes intended to be used with double-sided materials applied, such as pieces of paper, banners or fabrics, may lead to visual artifacts when lightmapping. It is recommended to consider re-modeling such meshes by adding polygons for the other side of the model.打算与双面材质一起使用的未折叠的薄多边形网格(例如纸片,条幅或织物)的展开可能会在进行光照贴图时导致视觉伪影。建议考虑通过为模型的另一侧添加多边形来重新建模此类网格。

For all surfaces intended to be lightmapped, the Lightmaps Parameters are needed to be adjusted:对于所有打算进行光照贴图的表面,需要调整光照贴图参数

  1. Check Enabled to enable the feature.选中Enabled以启用该功能。
  2. Select the Bake Unique Texture, if you intend to use the integrated lightmapper.如果要使用Bake Unique Texture, 如果您打算使用集成的光照贴图器
  3. Also, you can specify the lightmap Texture generated in a third-party software. Select the Use Custom Texture mode for this purpose.另外,您可以指定在第三方软件中生成的光照图纹理。为此选择Use Custom Texture模式。

For a surface to contribute to static GI, it must have the Lighting Mode set to Static or have the Cast Global Illumination option enabled in the Advanced Lighting Mode.为了使表面有助于静态GI烘焙,必须启用Cast Global Illumination选项。

For selective group-based shading when baking lightmaps, adjust the Viewport Masks. A surface will be visible for the lightmapper only if its Viewport Mask matches the Baking Viewport Masks of the Bake Lighting window.对于烘焙光照贴图时基于组的选择性底纹,请调整Viewport Masks。仅当光照贴图的Viewport MaskBake LightingBaking Viewport Masks窗口的匹配时,该表面才可见。

Finally, set up light sources in the scene:最后,在场景中设置光源:

  • For light sources that should contribute to lightmapping, select the Static mode, Dynamic lights will be ignored. Only indirect lighting from lights is baked into lightmaps, so light sources are to be kept enabled to provide direct lighting and specular highlights.对于应该有助于光线映射的光源,请选择Static模式。 Dynamic灯将被忽略。仅将来自光源的间接照明烘焙到光照贴图中,因此应保持启用光源以提供直接照明和镜面高光。
  • For emissive surfaces (having Emission state in the material parameters enabled) also enable the Emission Bake GI option. Both direct and indirect (bounced) lighting from emissive materials is baked into lightmaps.对于发光曲面(在启用的材质参数中具有Emission状态),还要启用Emission Bake GI选项。来自发光材质的直接和间接(反射)照明都被烘焙到光照贴图中。
  • Lighting from Voxel and Environment Probes is not considered.不考虑来自Voxel和Environment Probes的照明。

Baking
烘培#

  1. Enable the Lightmap buffer: Rendering -> Buffers -> Lightmap.启用Lightmap缓冲区:Rendering -> Buffers -> Lightmap
  2. Open the Bake Lighting window.打开Bake Lighting窗口。
  3. Enable Bake Lightmaps for Surfaces. Adjust the baking settings:
    • Set up the Baking Viewport Masks.Set up the Baking Viewport Masks.
    • Select the desired baking Quality. The Draft option provides the shortest baking time and is suitable for development iterations, while the Ultra quality engages the biggest possible number of light rays to be simulated and the best sampling resolution.Select the desired baking Quality. The Draft option provides the shortest baking time and is suitable for development iterations, while the Ultra quality engages the biggest possible number of light rays to be simulated and the best sampling resolution.
    • Adjust the Far Clipping Distance for simulated light rays.Adjust the Far Clipping Distance for simulated light rays.
    Set up the Baking Viewport Masks.Select the desired baking Quality. The Draft option provides the shortest baking time and is suitable for development iterations, while the Ultra quality engages the biggest possible number of light rays to be simulated and the best sampling resolution.Adjust the Far Clipping Distance for simulated light rays.
    启用Bake Lightmaps for Surfaces。调整烘焙设置:
    • Set up the Baking Viewport Masks.设置Baking Viewport Masks
    • Select the desired baking Quality. The Draft option provides the shortest baking time and is suitable for development iterations, while the Ultra quality engages the biggest possible number of light rays to be simulated and the best sampling resolution.选择所需的烘焙QualityDraft选项提供了最短的烘焙时间,并且适合于开发迭代,而Ultra的质量则吸引了尽可能多的要模拟的光线和最佳的采样分辨率。
    • Adjust the Far Clipping Distance for simulated light rays.调整Far Clipping Distance以模拟光线。
  4. Adjust the Common Settings:
    • Select the number of light ray bounces. Higher values will result in a brighter lighting since each surface receives more photons.Select the number of light ray bounces. Higher values will result in a brighter lighting since each surface receives more photons.
    • Set the number of samples calculated per frame. This parameter is available for adjustment during baking process.Set the number of samples calculated per frame. This parameter is available for adjustment during baking process.
    Select the number of light ray bounces. Higher values will result in a brighter lighting since each surface receives more photons.Set the number of samples calculated per frame. This parameter is available for adjustment during baking process.
    调整通用设置:
    • Select the number of light ray bounces. Higher values will result in a brighter lighting since each surface receives more photons.选择光线反射的次数。更高的值将导致更亮的照明,因为每个表面接收更多的光子。
    • Set the number of samples calculated per frame. This parameter is available for adjustment during baking process.设置每帧计算的样本数。此参数可在烘焙过程中进行调整。
  5. Start baking process by clicking Bake All Lighting and wait for it to finish. Live preview is available. Several iterations (one per bounce) will be simulated for each affected surface.

    You can stop the process at any moment by using the Stop button and you will be prompted to keep the achieved result or restore the previous textures.You can stop the process at any moment by using the Stop button and you will be prompted to keep the achieved result or restore the previous textures.

    You can stop the process at any moment by using the Stop button and you will be prompted to keep the achieved result or restore the previous textures.
    单击Bake All Lighting开始烘焙过程,然后等待其完成。实时预览可用。对于每个受影响的表面,将模拟几次迭代(每反弹一次)。
    注意
    您可以随时使用Stop按钮停止该过程,并且系统会提示您保留所获得的结果或恢复以前的纹理。
  6. Upon completion, generated lightmaps will be saved in the bake_lighting/lightmaps folder and applied to the corresponding surfaces.完成后,生成的光照贴图将保存在bake_lighting/lightmaps文件夹中,并应用于相应的曲面。
  7. In the materials settings of lightmapped surfaces, consider enabling the Lightmap Cubic Filtering option for better quality.在光照贴图表面的材质设置中,请考虑启用Lightmap Cubic Filtering选项以获得更好的质量。

You can check the result by selecting the Baked Lightmap mode in the Rendering Debug.您可以通过在Rendering Debug中选择Indirect Lighting模式来检查结果。

If you are not satisfied with results on certain objects, you can select surfaces and/or nodes and perform partial re-bake using different settings by clicking Bake Selected in the Bake Lighting window.如果您对某些对象的结果不满意,可以选择表面和/或节点,并通过单击Bake Selected使用不同的设置执行部分重新烘焙。

The lightmap texture of a single object was re-baked to get proper color reflection from floor.重新烘焙单个对象的光照贴图纹理,以从地板获得正确的颜色反射。

Levels of Detail
详细程度#

There is no need to bake a separate lightmap for each level of detail. You can save space and time by sharing already baked lightmaps between different LODs (works for LODs having the same UV maps):无需为每个LOD烘焙单独的光照贴图。您可以通过在不同的LOD之间共享已经烘焙的光照贴图来节省空间和时间(适用于具有相同UV贴图的LOD):

  1. Select the Bake Unique Texture mode for LOD 0.选择LOD0的Bake Unique Texture选项。
  2. Select the Reuse Texture From Other Surface mode for all other LODs that will share its lightmap. Specify the LOD 0 in their Surface parameter.

    为共享其光照贴图的所有其他LOD选择Reuse Texture From Other Surfaces选项。在其Surface参数中指定LOD0。

  3. Proceed to light baking to bake the lightmap for the LOD 0.烘焙LOD0的光照贴图。
  4. The lightmap texture baked for LOD 0 will be automatically used for the other LODs.为LOD0烘焙的光照贴图纹理将自动分配给其他LOD的Texture字段。
最新更新: 2024-12-13
Build: ()