英文:
Can't find "clear flags" option in the camera's inspector
问题
我有两个Unity项目打开,我刚注意到两者之间相机对象的检查器不同。
下面的图片显示了两个项目的检查器。我习惯了左边的检查器,因为它在教程中出现。另一个项目的检查器看起来不同的原因是什么?
我想将“清除标志”更改为“仅深度”,但我在另一个项目的检查器中找不到这个选项(在“背景类型”下也没有“仅深度”选项)。有没有其他方法在第二个检查器上获得与“仅深度”相同的效果?
英文:
I have two unity projects open and I just noticed that the inspector for the camera object is different between the two.
The Picture below shows inspector of both projects. I am used to the inspector on the left from tutorials. Is there a reason why the inspector on other project looks different ?
I want to change "clear flag" to depth only but I am not finding this option in the inspector of the other project (also under "Background Type" there is no depth only option). Is there another way to get the same effect as depth only on the second inspector?
答案1
得分: 1
第二张图中没有国旗的原因是该项目使用Universal Render Pipeline (URP),而不是内置渲染管线。
根据相机文档,背景类型现在包含以下功能选项:
- 天空盒
- 纯色
- 未初始化
请注意,“仅深度”在这里不是一个选项。根据URP的常见问题解答,提供了以下原因:
> 在LWRP中,我们已经弃用了相机清除标志。相反,您可以在相机检查器中设置背景类型。我们这样做是因为内置渲染管线中的清除标志“仅深度”和“不关心”存在固有的性能问题。清除标志用于相机叠加,其中一个相机依赖于前一个相机的结果。这对性能来说是不利的,因为它执行多次剔除并增加带宽。带宽成本对移动游戏尤为重要。
>
> 出于这些原因,我们正在研究一种解决方案,您可以通过自定义相机矩阵和视场添加渲染通道。这样,我们可以提供一个优化的工作流,而不是创建相机对象。我们计划在未来的LWRP包中公开此自定义渲染通道。
听起来,这个功能在URP中无法轻松复制,尽管他们正在努力寻找一个未来的解决方案以再次实现这一功能。
英文:
The reason why the flag is missing in the second image is because that project is using the Universal Render Pipeline (URP) instead of the Built-in Render Pipeline.
Based on the Camera documentation, Background Type contains the functionality now, with the options:
- Skybox
- Solid Color
- Uninitialized
You'll note that "Depth only" isn't an option here. According to the FAQs for the URP, the following reason was given for why this is the case:
> We’ve deprecated camera clear flags in LWRP. Instead, you can set the
> Background Type in the Camera Inspector. We’ve done this because the
> clear flags Depth Only and Don’t Care from the Built-in render
> pipeline has inherent performance pitfalls. The clear flags were used
> for camera stacking, where one camera depends on the results of a
> previous camera. This is bad for performance, as it executes culling
> multiple times and increases bandwidth. Bandwidth cost is especially
> important for mobile games.
>
> For these reasons, we're working on a solution where you can add a
> render pass with custom camera matrices and FOV. This way, we can
> provide an optimized workflow instead of creating a Camera object. We
> plan to expose this custom render pass in a future LWRP package.
From the sounds of it, this functionality can't be readily reproduced in the URP, though they're working on a future solution to make it possible again.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论