粒子系统性能指南
粒子系统的性能与所维持粒子的数量成比例。在制作出所需效果的原型后,可通过减少粒子数来提高性能。反之,如果性能在可接受的范围内,则可以增加粒子数,直到达到可接受的程度(如果能改善效果)。
需要注意的是,粒子数量通常是由粒子系统估算的,在某些情况下,明确提示所需的粒子数量可以提高性能。您可以通过在发射器上设置最大发射量(maximumEmitted)来做到这一点,它通常适用于不会持续发射粒子的发射器。
与ShaderEffect 一样,粒子系统的性能在很大程度上取决于它所运行的图形硬件。但 Affectors 是个例外。对于不包括 Affectors 的系统,粒子的大部分性能成本将由 GPU 承担。由于 GPU 更擅长并行处理大量操作,因此在不使用 Affectors 的情况下,可以以 60FPS 的速度绘制更多粒子。
效应器(尤其是在 javascript 中修改粒子时)可能会相对较慢,并且会增加使用粒子时的 CPU 成本。请尽可能避免在大容量系统中使用它们。可以避免使用效果器的一些简单情况是:使用定时ParticleGroup 过渡而不是时间触发效果器,或者在发射器的加速度属性中设置重力加速度而不是重力效果器。
© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.