打开 Occlusion Culling 窗口的方法是导航到顶部菜单,然后选择 Window > Rendering > Occlusion Culling。
Occlusion Culling 窗口有 3 个选项卡:__Object、Bake__ 和 Visualization。除此之外,当 Occlusion Culling 窗口和 Scene 视图均可见时,Scene 视图中将显示 Occlusion Culling 弹出窗口。
在 Object 选项卡中,可以单击 All、Renderers 和 Occlusion Areas 按钮以筛选 Hierarchy 窗口的内容。
当 Renderers 筛选条件激活时,在 Hierarchy 窗口或 Scene 视图中选择一个渲染器,即可在 Occlusion Culling 窗口中查看和更改渲染器的遮挡剔除设置。
当 Occlusion Areas 筛选条件激活时,可以在 Hierarchy 窗口或 Scene 视图中选择一个遮挡区域,然后在 Occlusion Culling 窗口中查看和更改遮挡区域的 Is View Volume 设置。也可以单击 Create New Occlusion Area 以便在场景中创建新的遮挡区域。
在 Bake 选项卡中,可以微调遮挡剔除烘焙过程的参数。请通过配置这些设置在烘焙时间、运行时数据大小和可视化结果之间找到平衡。
Set Default Parameters 按钮可将参数重置为默认值。
设置 | 描述 |
---|---|
Smallest Occluder | 可以遮挡其他游戏对象的最小游戏对象的大小(以米为单位)。通常,要使文件最小且烘焙时间最短,应选择在场景中产生良好结果的最大值。 |
Smallest Hole | 摄像机可以看到的最小间隙的直径(以米为单位)。通常,要使文件最小且烘焙时间最短,应选择在场景中产生良好结果的最大值。 |
Backface Threshold | 如果需要减小烘焙数据的大小,Unity 可以在烘焙时对场景进行采样,并排除场景中可见遮挡物几何体所含背面超过给定百分比的部分。背面百分比很高的区域可能在几何体的下方或内部,因此不太可能是在运行时摄像机所在的某个位置。默认值 100 表示绝不会从数据中删除区域。值越小,产生的文件就越小,但可能会导致视觉失真。 |
有关配置这些值的详细技巧,请参阅“其他资源”页面上链接的文章。
Bake 选项卡的底部是 Bake 和 Clear 按钮。单击 Bake 按钮可烘焙遮挡剔除数据。单击 Clear 按钮可删除之前烘焙的数据。
当 Visualization 选项卡可见时,如果在 Scene 视图或 Hierarchy 窗口选择一个摄像机,则 Unity 将更新 Scene 视图,从所选摄像机的视角显示遮挡剔除的效果。可以使用 Scene 视图中的 Occlusion Culling 弹出窗口来配置可视化设置。
Occlusion Culling 弹出窗口有两种模式:__Edit__ 和 Visualization。可以使用下拉菜单在两者之间切换。
设置 | 描述 |
---|---|
View Volumes | 启用此选项后,Scene 视图将包含蓝线,这些蓝线显示遮挡剔除数据中的单元格。单元格大小受 Smallest Occluder 设置的影响:值越小,产生的单元格越多且越小,从而使精度提高并且文件增大。 |
Visualize 模式可让您从给定摄像机的视角预览遮挡剔除的结果。如果选择了某个摄像机,则预览与该摄像机相关。否则,预览与您在 Visualize 模式下选择的最后一个摄像机相关。
设置 | 描述 |
---|---|
Camera Volumes | 启用此选项后,您会看到黄线,这些黄线指示 Unity 为其生成遮挡剔除数据的场景区域。这取决于场景几何体以及在场景中使用 Occlusion Areas 选项定义的任何视图体积 (View Volumes)。当摄像机在黄线之外时,Unity 不会执行遮挡剔除。 您还可以看到灰线,这些灰线指示摄像机当前位置所对应的遮挡剔除数据中的单元格以及当前单元格中的细分。Smallest Hole 设置定义了单元格内细分的最小大小:值越小,每个单元格产生的细分越多且越小,从而使精度提高并且文件增大。 |
Visibility Lines | 启用此选项后,您会看到绿线,这些绿线指示当前选择的摄像机可以看到的内容。 |
Portals | 启用此选项后,您可以看到一些线代表遮挡数据中单元格之间的连接。当前可见的入口是当前所选摄像机可以看到的入口。 |
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.