灯光探测器的目的,抄手册上的话就是:
Although lightmapping adds greatly to the realism of a scene, it has the disadvantage that non-static objects in the scene are less realistically rendered and can look disconnected as a result. It isn‘t possible to calculate lightmapping for moving objects in real time but it is possible to get a similar effect using light probes. The idea is that the lighting is sampled at strategic points in the scene, denoted by the positions of the probes. The lighting at any position can then be approximated by interpolating between the samples taken by the nearest probes. The interpolation is fast enough to be used during gameplay and helps avoid the disconnection between the lighting of moving objects and static lightmapped objects in the scene.
尽管使用光照贴图可以大大提升场景的真实程度,但是它有一个缺点,那就是场景中非静态物体缺少真实的渲染,看上去就好像和场景格格不入。实时为移动物体计算光照贴图是不可能的,但是通过使用灯光探测器我们可以模拟达到类似的效果。大概原理是这样的,在场景中的标记为探测器的静态点的位置采样光照,然后对相邻的几个光照探测器位置所采样的灯光照明进行差值,在游戏进行的过程中计算差值的速度很快,玩家察觉不到。这样就可以帮助我们避免移动物体的光照和烘培场景格格不入的感觉。
Adding Light probes 添加灯光探测器
The Light Probe Group component (menu: Component -> Rendering -> Light Probe Group) can be added to any available object in the scene. The inspector can be used to add new probes to the group. The probes appear in the scene as yellow spheres which can be positioned in the same manner as GameObjects. Selected probes can also be duplicated with the usual keyboard shortcut (ctrl+d/cmd+d).
灯光探测器组 组件(菜单:Component -> Rendering -> Light Probe Group)可以被添加到场景中任何可利用的物体。可以通过检视面板为探测器组中添加新的探测器。探测器在场景中用黄色的球体表示,并且可以像其他游戏物体那样编辑移动它的位置,被选择的探测器可以通过键盘快捷键进行复制。(ctrl+d/cmd+d).
Using Light Probes 使用灯光探测器
To allow a mesh to receive lighting from the probe system, you should enable the Use Light Probes option on its MeshRenderer:
如果想要使一个网格接受来自探测器系统的光照,只需要将MeshRenderer组件上个LightProbes选项勾选就可以。
The probe interpolation requires a point in space to represent the position of the mesh that is receiving light. By default, the centre of the mesh‘s bounding box is used but it is possible to override this by dragging a Transform to the MeshRenderer‘s Light Probe Anchor property (this Transform‘s position will be used as the interpolation point instead). This may be useful when an object contains two separate adjoining meshes; if both meshes are lit individually according to their bounding box positions then the lighting will be discontinuous at the place where they join. This can be prevented by using the same Transform (for example the parent or a child object) as the interpolation point for both MeshRenderers.
探测器差值需要使用空间中的一点来表示接受灯光的网格的位置。通常情况下使用包围盒的中心来表示。我们也可以使用自定义的位置覆盖默认的位置只需要将一个Transform(变换)拖拽到MeshRenderer组件的 LightProbeAnchor(光照探测器锚点)插槽上。(这个Transform的位置将被用来表示计算差值的物体中心点)。当我们的游戏物体是由两个分离的相邻网格组成的时候,这个功能非常有用,如果这个这些网格都按照各自独立的包围盒中心作为光照差值点的时候,光照会在他们结合的位置断开。这也能使由多个MeshRenderer组件的组成的游戏物体公用一个Transform(比如使用一个父物体或者子物体)。
When an object using light probes is the active selected object in the Light Probes Scene View mode, its interpolated probe will be rendered on top of it for preview. The interpolated probe is the one used for rendering the object and is connected with 4 thin blue lines (3 when outside of the probe volume) to the probes it is being interpolated between:
当一个使用了光照探测器的物体在Light Probes Scene View(在场景中查看光照探测器)。模式下被高亮选择以后,它的差值探测器将被渲染到物体的前面这样用户就能够预览到探测器的位置。差值探测器通常被渲染为一个物体,并在探测器的差值范围内显示四条蓝色的线(当物体超出探测器的覆 的范围后将显示三条)。
Dual Lightmaps vs. Single Lightmaps mode
双重光照贴图VS单光照贴图模式
In Single Lightmaps mode all static lighting (including lights set to ‘Auto‘ lightmapping mode) is baked into the light probes.
在单光照贴图模式下所有的静态光照(包括被设置为"Auto"(自动)光照贴图模式的灯光)都将烘培到光照探测器中。
In Dual Lightmaps mode light probes will store lighting in the same configuration as ‘Near‘ lightmaps, i.e. full illumination from sky lights, emissive materials, area lights and ‘Baked Only‘ lights, but only indirect illumination from ‘Auto‘ lights. Thanks to that the object can be lit in real-time with the ‘Auto‘ lights and take advantage of dynamic elements such as real-time shadows, but at the same time receive indirect lighting added to the scene by these lights.
使用双重光照贴图模式的,灯光探测器只存贮了"Near"(近端)光照贴图配置。例如:天光产生的全局光照,自发光材质,面积光和被是设置为"Baked Only"(仅烘培)模式的灯光。和被设置为"Auto"模式的间接照明。我们要感谢物体可以被设置为"Auto"模式的灯光实时照明。并且产生一些高级的动态成分。例如实时阴影,同时接受探测器存贮的这些灯光的间接光照信息并叠加到场景中。