全局光照
In addition to lightmaps, UNIGINE has a static GI method — voxel-based global illumination. Essentially, it projects a precalculated 3D lightmap onto parts of surfaces into a box-shaped voxel volume. This approach uses spatial modulation, so UV coordinates are not required. Voxel GI is based on the use of multiple Voxel Probe sources, which opens up many possibilities. You can combine low-detail voxels with high-detail voxels (insets), you can turn them on and off one by one, mix them as you see fit in order to achieve the desired result. Voxel Probe is mainly applied in ambient lighting. When baked, Voxel Probe illuminates everything inside its volume with ambient light, providing a pretty good simulation of global illumination, including ambient occlusion, light bounces, and diffuse reflections. Of course, voxels will never be as realistic as lightmaps, nor can they provide the same density due to a number of factors, but voxel-based GI is suitable for any high-polygon and low-polygon geometry, does not require UV maps, and can be used for dynamic objects (which is clearly beyond lightmapping). The great thing is that these two techniques can be combined, and you can choose any of them depending on the requirements of a particular project (for example, lightmaps are the best option for high-quality lighting in a static scene, but if you need dynamics, you can just add voxels where needed).除了光照贴图外,UNIGINE还提供静态GI方法:基于体素的全局光照。本质上,它将预计算的3D光照贴图投射到表面部分区域,形成盒状体素体积。这种方法采用空间调制,因此不需要UV坐标。体素GI基于多个体素探针(Voxel Probe)光源的使用,这带来了许多可能性。你可以混合使用低精度体素与高精度体素(嵌入体),可以逐个启用/禁用它们,按需混合以达到预期效果。体素探针主要应用于环境光照。烘焙后,体素探针会用环境光照亮其体积内所有物体,提供相当不错的全局光照模拟,包括环境光遮蔽、光线反弹和漫反射。当然,由于多种因素,体素永远不会像光照贴图那样真实,也无法提供相同的密度,但基于体素的GI适用于任何高多边形和低多边形几何体,不需要UV贴图,并且可用于动态物体(这明显超出了光照贴图的能力范围)。最棒的是这两种技术可以结合使用,你可以根据特定项目需求选择其中任何一种(例如,光照贴图是静态场景高质量光照的最佳选择,但如果需要动态效果,只需在需要的地方添加体素)。
Global Illumination is baked using the same Bake Lighting tool. Before baking, you need to pre-configure objects and lighting sources as we did for lightmaps: turn on Cast Global Illumination for static surfaces (turn it off for dynamic ones).全局光照使用相同的Bake Lighting(烘焙光照)工具进行烘焙。在烘焙前,需要像处理光照贴图那样预先配置物体和光源:为静态表面启用Cast Global Illumination(投射全局光照),为动态物体关闭该选项。
Select the Static mode for the sources to be baked, and enable the Emission Bake GI option for surfaces with emission.为需要烘焙的光源选择Static(静态)模式,并为具有自发光(Emission)的表面启用Emission Bake GI(自发光烘焙GI)选项。
Create and place one or more Voxel Probes in areas where illumination is relatively static (e.g. interiors, street buildings, immovable objects).在光照相对静态的区域(例如室内、街道建筑、固定物体)创建并放置一个或多个体素探针(Voxel Probe)。
Set the general Voxel Probe settings, such as Box Size and Voxel Size, which define the resolution of the voxel grid and the video memory consumed.设置常规体素探针参数,如定义体素网格分辨率和显存占用的Box Size(盒体大小)和Voxel Size(体素大小)。
Baking Process烘焙流程#
- Enable the Lightmap buffer (Rendering → Buffers → Lightmap).启用光照贴图缓冲区(Rendering → Buffers → Lightmap)。
- Open the Bake Lighting window.打开Bake Lighting(烘焙光照)窗口。
-
Enable Bake Voxel Probes and adjust Voxel Size Multiplier, if necessary:启用 Bake Voxel Probes(烘焙体素探针)选项,必要时调整 Voxel Size Multiplier(体素尺寸倍增器):
- Configure Baking Viewport Masks to select the light sources and surfaces that should be baked.配置 Baking Viewport Masks(烘焙视口遮罩)以选择需要烘焙的光源和表面
- Set the baking Quality: Draft is suitable for quick iterations, and Ultra provides the maximum quality.设置烘焙质量 (Quality):Draft(草稿)模式适合快速迭代,Ultra(极致)模式提供最高质量。
- Adjust Far Clipping Distance for clipping the light rays.调整 Far Clipping Distance(远裁剪距离)以控制光线裁剪范围
- Set the number of light ray bounces (higher values will result in a brighter lighting).设置光线反弹次数(数值越高光照越亮)。
-
Start baking process for all objects by clicking Bake All Lighting and wait for it to finish. Live preview of the process is available (the number of samples counted per frame can be adjusted during the baking process).点击Bake All Lighting(烘焙全部光照)开始全场景烘焙,等待完成(可实时预览烘焙进度,烘焙过程中可调整每帧采样数)。
- The generated lightmaps are saved to the bake_lighting/voxel_probes folder and applied to the corresponding Voxel Probes.生成的光照贴图将保存至bake_lighting/voxel_probes文件夹,并应用到对应的体素探针。
- To improve the quality, you can also enable Lightmap Cubic Filtering in the material settings of the surfaces with the light map.如需提升质量,可在材质设置中为光照贴图表面启用Lightmap Cubic Filtering(立方体贴图过滤)。
- The result can be checked by selecting the Indirect Lighting mode in the Rendering Debug menu.通过Rendering Debug(渲染调试)菜单选择Indirect Lighting(间接光照)模式查看效果。
Additive Blending叠加混合模式#
More flexibility in lighting control is available with the Additive Blending mode. You can use it to blend lighting of several Voxel Probes together and control them separately (e.g. make a separate Voxel Probe for an indoor lamp and blend it with another Voxel Probe with lighting baked from the sky, having the ability to enable and disable them separately).通过Additive Blending(叠加混合)模式可获得更灵活的光照控制。你可以用它混合多个体素探针的光照效果并分别控制(例如为室内灯具创建单独的体素探针,并将其与从天空烘焙光照的另一个体素探针混合,同时保留单独启用/禁用它们的能力)。
本页面上的信息适用于 UNIGINE 2.20 SDK.