比例对象时FPS掉落。如何修复? Unity Android
有一个空的场景,其中一个标准立方体。如果将其比例更改为(5; 5; 1),则FPS不会下降。 但是,如果我将其更改为(5; 10; 1)我的FPS降至〜30。
如果我用比例(5; 10; 1)将相机从立方体移开,则FPS再次为60。 也许我有错误的相机设置或其他方式。
如何在不移开相机的情况下实现高FPS?
PS FPS不会落入编辑器中。只有在Android上发射之后。 Unity版本2020.3.18F1。尝试了另一个版本相同的问题。
=“ nofollow noreferrer”>具有比例(5; 10; 1)和相机遥远的立方体
There is an empty scene with one standard cube. If you change its scale to (5;5;1), then the fps does not drop.
But if I change it to (5; 10; 1) my fps drops to ~30.
If I move the camera away from the cube with the scale (5;10;1), then the fps is again 60.
Maybe I have wrong camera settings or something else.
How to achieve high fps without moving the camera away?
p.s. The fps does not drop in the editor. Only after launching on android.
Unity version 2020.3.18f1. Tried on another version same problem.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
问题可能是由于呈现对象扩展时渲染更多像素(每次执行片段着色器)的事实。另一个暗示是,当您将摄像机移开远离对象时,帧速率随着渲染对象的产生较少的像素而增加。
正如您提到的那样,该程序在Android上运行,将常规着色器更改为移动着色器可能会提高性能。
The problem may be due to the fact that more pixels is rendered (fragment shader is executed for every one) when the object is scaled up. The other hint is that when you move the camera far from the object the frame rate is increased as the rendered object generates fewer pixels.
As you mentioned that the program runs on Android, changing a regular shader to mobile shader may improve the performance.
从unity上的某些统一文档
在这种情况下,我不确定您的Z量表是否重要,因为您只是渲染XY平面。当您增加相机距离时,我无法确定为什么降低性能命中率。我怀疑Unity具有一些智能的顶点操纵,以简化遥远对象的渲染,从而节省了CPU成本。
话虽如此,请尽量避免缩放。原语通常仅应用作占位符。
From some of Unity's documentation on transforms
I'm not certain if your Z's scale matters in this case, because you're only rendering the x-y plane. I can't comment for certain on why the performance hit is reduced as you increase your camera distance. I suspect Unity has some intelligent vertex manipulation going on to simplify rendering of distant objects, saving you on CPU cost.
That being said, try to avoid non-uniform scaling. Primitives should typically only be used as placeholders.