遮挡区域
Occlusion Area 遮挡区域
To apply occlusion culling to moving objects you have to create an Occlusion Area and then modify its size to fit the space where the moving objects will be located (of course the moving objects cannot be marked as static). You can create Occlusion Areas is by adding the Occlusion Area component to an empty game object (Component->Rendering->Occlusion Area in the menus)
如 果想在运动物体应用遮挡剔除,你必须创建一个Occlusion Area(遮挡区域)然后修改其大小来适应运动物体的活动空间(注意:运动物体不能被标示为静态)。 您可以创建遮挡区域,把遮挡区域组件添加到一个空的游戏物体(菜单Component->Rendering->Occlusion Area )
After creating the Occlusion Area, just check the Is Target Volume checkbox to occlude moving objects.
创建遮挡区域( Occlusion Area)后, Is Target Volume 复选框打勾, 来遮挡剔除运动物体。
Occlusion Area properties for moving objects.移动物体的遮挡区域属性
- Size 大小 Defines the size of the Occlusion Area. 定义遮挡区域大小
- Center 中心 Sets the center of the Occlusion Area. By default this is 0,0,0 and is located in the center of the box.
设定遮挡区域的中心。默认0,0,0 并位于盒子的中心 - Is View Volume 是否视图体 Defines where the camera can be. Check this in order to occlude static objects that are inside this Occlusion Area.
定义摄像机能到哪里。选中这个选项,来遮挡遮挡区域内的静态物体 - Is Target Volume 是否目标体 Select this when you want to occlude moving objects.
当你想遮挡剔除运动物体时选上。 - Target Resolution 目标分辨率 Determines how accurate the occlusion culling inside the area will be. This affects the size of the cells in an Occlusion Area. NOTE: This only affects Target Areas.
确定区域内的遮挡剔除的精度。这影响遮挡区域的单元格大小。注意: 这个选项只对 Target Areas(移动物体)起作用 - Low 低 This takes less time to calculate but is less accurate.
这花费较少的时间来计算,但是不够准确。 - Medium 中 This gives a balance between accuracy and time taken to process the occlusion culling data.
平衡准确性和花费时间处理遮挡剔除数据。 - High 高 This takes longer to calculate but has better accuracy.
计算时间长但精度高 - Very High 非常高 Use this value when you want to have more accuracy than high resolutions, be aware it takes more time.
当你想要比高分辨率(high resolutions)更高的精度,使用这个值。注意这会花费更多时间。 - Extremely High 极高 Use this value when you want to have almost exact occlusion culling on your moveable objects. Note: This setting takes a lot of time to calculate.
使用这个值,当你想在可移动的物体上得到几乎确切的遮挡剔除。 注意:这个设定需要大量的时间来计算。
After you have added the Occlusion Area, you need to see how it divides the box into cells. To see how the occlusion area will be calculated, Select Edit and toggle the View button in the Occlusion Culling Preview Panel.
添加完遮挡区域后, 你需要了解盒子是如何划分成单元格。要查看遮挡区域如何被计算,在遮挡剔除预览面板,选择"编辑Edit "和勾上"视图View "按钮。
Testing the generated occlusion测试生成的遮挡
After your occlusion is set up, you can test it by enabling the Occlusion Culling (in the Occlusion Culling Preview Panel in Visualize mode) and moving the Main Camera around in the scene view.
遮挡设置完毕后, 启用遮挡剔除(在遮挡剔除预览面板Occlusion Culling Preview Panel,可视化模式) 并在场景视窗移动主摄像机Main Camera进行测试。
The Occlusion View mode in Scene View场景视图 中的遮挡 View 模式
As you move the Main Camera around (whether or not you are in Play mode), you'll see various objects disable themselves. The thing you are looking for here is any error in the occlusion data. You'll recognize an error if you see objects suddenly popping into view as you move around. If this happens, your options for fixing the error are either to change the resolution (if you are playing with target volumes) or to move objects around to cover up the error. To debug problems with occlusion, you can move the Main Camera to the problematic position for spot-checking.
当你在左右移动主相机 (无论是否在播放模式下), 你将会看到各种物体禁用自己,你在这里需要找出的是遮挡数据中的任何错误。当你移动摄像机时你可能会发现会有物体突然出现在视野当中,如果这种情况发生, 通过修改分辨率来修复错误(如果是在target volumes模式播放)或左右移动物体左右掩饰错误。要调试遮挡的问题,你可以移动主相机来检查问题的位置。
When the processing is done, you should see some colorful cubes in the View Area. The blue cubes represent the cell divisions for Target Volumes. The white cubes represent cell divisions for View Volumes. If the parameters were set correctly you should see some objects not being rendered. This will be because they are either outside of the view frustum of the camera or else occluded from view by other objects.
运算处理结束后,你会在View Area看到一些不同颜色的cube, 蓝色 cubes表示的是Target Volumes 的单元划分, 白色 cubes表示的是 View Volumes的单元划分,如果参数设置正确你会看到一些物体不被渲染,这表示要么这些物体不在摄像机视角范围内要么被其他物体遮挡住了。
After occlusion is completed, if you don't see anything being occluded in your scene then try breaking your objects into smaller pieces so they can be completely contained inside the cells.
如果遮挡完成后,场景内任何物体也没有被遮挡,拆分物体至更小的块,以便它们能被完整地包含在一个单元格中。