环境探针
Environment Probe represents a reflection volume that stores a cubemap texture (pre-baked or dynamically changing each frame) to be rendered on reflective surfaces.Environment Probe表示一个反射体积,该体积存储要渲染在反射表面上的立方体贴图纹理(预烘焙或动态更改每个帧)。
See Also也可以看看#
- Light baking is available via code by using the BakeLighting Class.使用BakeLighting类可通过代码进行轻度烘烤。
- Video Tutorial: Global Illumination.视频教程:全局照明。
- Quick video guide: How To Bake Reflections to Environment Probes.快速视频指南:如何将反射烘焙到Environment Probes 。
Cubemap Reflections立方体贴图反射#
The primary application of Environment Probes is providing cube-mapped reflections.Environment Probes的主要应用是提供立方映射的反射。
The Projection Shape defines the type of projection to be used by the Environment Probe:Projection Shape定义了Environment Probe使用的投影类型:
- Box projection - the cubemap is projected onto a box shape defined by the Box Projection Size parameter of the probe.Box projection-将立方体贴图投影到由探针的Box Projection Size参数定义的盒子形状上。
- Spherical projection - the cubemap is projected onto a spherical shape.Spherical projection-立方体贴图投影到球形上。
Spherical Environment Probes can be subject to Parallax effect controlled by the corresponding parameter. With the value of 0 the reflection shall be projected onto an infinitesimally far sphere, the value of 1 corresponds to the actual probe's bounding sphere defined by the Attenuation Distance parameter taking into account the viewer's perspective.球形Environment Probes可以受到Parallax效果的控制,该效果由相应的参数控制。 值为0时,反射应投影到无限远的球体上,值为1时应考虑到观察者的视角,由Attenuation Distance参数定义的实际探针的边界球体。
The Baking Settings of the probe determine the type of reflections.探针的烘焙设置确定反射的类型。
Static Reflections静态思考#
An Environment Probe with the Dynamic option disabled provides static reflections — the same cubemap is used until it is re-baked or replaced.禁用Dynamic选项的Environment Probe提供静态反射-使用相同的立方体贴图,直到重新烘焙或替换它为止。
You can specify a custom cubemap texture for the probe or bake it from the environment by using the Bake Lighting tool. For this purpose, a set of preparations is needed:您可以使用Bake Lighting工具为探针指定自定义立方体贴图纹理或将其从环境中烘焙。为此,需要进行一系列准备工作:
- Select the Static Lighting Mode for surfaces that should be visible in baked reflections or enable the Bake to Environment Probe option for surfaces in Advanced Lighting Mode. Disable it for dynamic objects.
For selective group-based visibility of objects, adjust the Viewport Masks. A surface will be visible in reflections only if its Viewport Mask matches the Reflection Viewport Masks of the Environment Probe.启用Bake to Environment Probe选项,以使表面在烘焙反射中可见。禁用动态对象。
对于对象的基于组的选择性可见性,请调整Viewport Masks。仅当曲面的Viewport Mask与Reflection Viewport Masks of the Environment Probe. - For light sources that should be reflected, select the Static mode. Dynamic lights will be ignored.对于应反射的光源,选择Static模式。 Dynamic灯将被忽略。
- Check Grab by Bake Lighting in the probe's Baking Settings. Adjust other settings, such as the desired cubemap resolution and the supersampling multiplier.在探针的“烘焙设置”中选中通过烘焙照明抓取。调整其他设置,例如所需的立方体贴图分辨率和超采样乘数。
- Open the Bake Lighting window.打开Bake Lighting窗口。
- Enable Bake Environment Probes.
Enable Automatic Rebake option to make cubemaps for static Environment Probes be automatically rebaked every time you make changes to their settings and transformation.启用Bake Environment Probes。Enable Automatic Rebake option to make cubemaps for static Environment Probes be automatically rebaked every time you make changes to their settings and transformation.Enable Automatic Rebake option to make cubemaps for static Environment Probes be automatically rebaked every time you make changes to their settings and transformation.
- Select the Number of Bounces, i.e. the reflection depth. 选择Number of Bounces,即反射深度。
- Start baking process by clicking Bake All Lighting and wait for it to finish.单击Bake All Lighting开始烘焙过程,然后等待其完成。
- Upon completion, the generated cubemap will be saved in the bake_lighting/env_probes folder and assigned to the Environment Probe.完成后,生成的立方体贴图将保存在bake_lighting/env_probes文件夹中并分配给Environment Probe。
Dynamic Reflections动态思考#
Dynamic reflections imply the cubemap of an Environment Probe is grabbed each frame. This mode may make a massive load on the processing unit, so accurate adjustment of the Baking Settings is recommended.动态反射意味着每个帧都会抓取Environment Probe的立方体贴图。此模式可能会对处理单元造成很大的负担,因此建议精确调整烘焙设置。
To make an Environment Probe cast dynamic reflections, perform the following:要使Environment Probe投射动态反射,请执行以下操作:
- Check the Dynamic option for the probe.检查探针的Dynamic选项。
- Adjust the desired Resolution of the cubemap, supersampling and other Baking Settings.调整立方体贴图,超级采样和其他烘焙设置的所需分辨率。
- Pay attention to the Faces Per Frame parameter defining the number of faces of the cubemap rendered each frame. Rendering six faces each frame may significantly affect the performance, so you can spread this number over several frames in a row.注意Faces Per Frame参数,该参数定义每帧渲染的立方体贴图的面数。每帧渲染六个面可能会严重影响性能,因此您可以将此数字连续分布在几帧中。
- Enable the Dynamic Reflections option: Rendering -> Features -> Dynamic Reflections启用Dynamic Reflections选项:Rendering -> Features -> Dynamic Reflections
Additional Features附加的功能#
Ambient Lighting环境照明#
By default, Environment Probes are used for reflections only, as for lighting, it is recommended to simulate it using Voxel Probes and lightmaps. However, cube-mapped ambient lighting by environment probes is available as well.默认情况下,Environment Probes仅用于反射,对于照明,建议使用Voxel Probes和光照贴图对其进行仿真。但是,也可以使用环境探测器提供的立方体映射的环境照明。
You can benefit from this approach by enabling the Dynamic option for the Environment Probes to get simple real-time global illumination.您可以通过为Environment Probe启用Dynamic选项来获得简单的实时全局照明,从而从中受益。
Additive BlendingAdditive Blending#
More flexibility in lighting control is available with the Additive Blending mode. You can use it to blend reflections of several Environment Probes together and control them separately.Additive Blending模式可提供更大的照明控制灵活性。您可以使用它将多个Environment Probes的反射混合在一起,并分别控制它们。
Use Sun ColorUse Sun Color#
An Environment Probe is subject to multiplication by the sun light color if the Use Sun Color option is enabled for it.如果为Environment Probe启用了Use Sun Color选项,则将其乘以太阳光的颜色。
Cutout By ShadowCutout By Shadow#
In certain cases reflections baked into environment probes might be clearly seen in areas where they actually shouldn't, resulting in various artefacts that ruin the total look of your scene. This can be especially noticeable when you place environment probes in irregular shaped (non-squared) rooms. By using the Cutout By Shadow feature you can enable clipping of reflections occluded by obstacles.在某些情况下,在环境探测器中实际不应反射的区域可能会清晰可见反射,从而导致各种伪像破坏场景的整体外观。当您将环境探头放置在不规则形状(非正方形)的房间中时,这一点尤其明显。通过使用Cutout By Shadow功能,可以启用对由障碍物遮挡的反射的修剪。
To use the feature, perform the following steps:要使用此功能,请执行以下步骤:
- Create meshes that will serve as obstacles for reflections propagation (doorways, windows, etc.).创建将成为反射传播障碍的网格物体(门,窗等)。
- Enable the Cast Environment Probe Shadows flag for surfaces of obstacles.为障碍物表面启用Cast Environment Probe Shadows标志。
- Enable the Cutout By Shadow flag for the Environment Probe.为Environment Probe启用Cutout By Shadow标志。
- Bake the Environment Probe by using the Bake Lighting window. This will create a depth texture that will be assigned to the probe and define clipping of reflections.通过使用Bake Lighting窗口来烘烤Environment Probe。 这将创建一个深度纹理,该纹理将分配给探针并定义反射的修剪。
- Disable or delete the obstacles.禁用或删除障碍物。