Zh/Dota 2 Workshop Tools/Particles/Particle Performance: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
No edit summary
 
(4 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{otherlang2
{{lang|title=粒子性能|Dota 2 Workshop Tools/Particles/Particle Performance}}
|title = 粒子表现
 
|en= Dota 2 Workshop Tools/Particles/Particle Performance
}}
== 最大粒子数 ==
== 最大粒子数 ==
: By default each system is set to 1004 max particles. This much memory is allocated for the system regardless of whether it's used or not. So after setting up your system, you'll want to take a look at the counter to see how many particles you're using and set the max particles to this number. This will help to keep the memory usage to a sane amount.
: 默认情况下每个系统的最大粒子数设为1004。无论系统使用与否都会被分配到这么大的内存。所以在你设定完系统之后,你应该看看计数器来观察你有多少粒子被使用,并将最大粒子数设为这个值。这将有利于将内存占用量保持在一个理智的数量。


== Threading ==
== 线程 ==
: Particles are multithreaded by system. So if you have multiple systems, they'll be distributed over as many threads as are available. So on its face, it's good to split complex systems up into multiple systems to take advantage of this feature. That said, there's overhead to each system, so there's a limited benefit to the usefulness of this approach, especially on simpler systems. Splitting up a system that only has a few dozen particles will almost certainly be a net loss. However, if you system has in the thousand+ range of particles, it's worth treating it as multiple lower count particle systems which can be multi-threaded. A system and it's children are always on the same thread because parents and children can pass data to each other and as such need to be be grouped together.
: 粒子被系统设为了多线程。因此如果你有多个系统,他们会分布到尽可能多的线程里。所以从这点看,将复杂系统分割成多个系统来利用这个特性是一个不错的方式。这即是说,每个系统都有它们的开销,所以这个有效的方法的益处也是有限的,尤其在更简单的系统上。将一个只有少量粒子的系统分割开来几乎肯定是一种损失。然而,如果你的系统有1000+的粒子,那么你值得将粒子分成小份并分布到多线程中去。系统和其子系统总在同一个线程里因为父系统与子系统可以相互传递数据并且非常需要被组合在一起。


== SIMD ==
== SIMD(单指令多数据流) ==
: Right now, most particle operators, Initializers, etc. work in SIMD. This means on current hardware they're generally doing all math on groups of four particles simultaneously. Theoretically in the future this will scale up to wider numbers on different kinds of hardware. The point here is that if you stick to multiples of four, you'll be making better use of the system. Scaling a system down to the closest multiple of four will make it slightly more optimal. This isn't a huge gain, but it's something to be aware of.
: 现在,大多数粒子操纵器、初始化器等工作在SIMD中。这意味着他们通常同时在硬件上做四个粒子的组的所有数学运算。理论上来讲未来在不同种类的硬件上这将增长至更广阔的数字。需要指出的是如果你注意四的倍数,你将会更好地利用系统。将系统缩放至最接近四的倍数可以使它变得稍稍更加理想。这虽然没有巨大的收获但也是应该被注意到的事。


== 共享数据 ==
== 共享数据 ==
: There are a variety of ways to share data between parent and children systems. Some of the more complex Initializers or operators can minimize their performance impact by writing out their results to a control point, which can then be read by children and use the same data without having to do any of the work.
: 在父系统与子系统有许多方法可以共享数据。一些更复杂的初始化器或者操纵器可以通过向一个控制点写出他们的结果来最小化它们的表现效果,随后子系统可以读到这些结果并且不用计算便可得到相同数据。


== 碰撞 ==
== 碰撞 ==
: In general, collision is an expensive operation. The default mode 0 does traces for each particle every frame. This is expensive and doesn't scale well. However, the Collision constraint allows for a few different collision modes which allow for much faster collisions that trade off accuracy for speed. Collision Mode 3 is the best accuracy/performance tradeoff for dynamic collisions with particles in unpredictable locations/movements.
: 通常,碰撞是一项昂贵的操作。默认模式0在每一帧描绘每一个粒子的轨迹。这很昂贵并且无法良好地缩放。然而,碰撞约束允许一些不同的碰撞模式,他们能够用精确度换来速度以取得更快的碰撞碰撞模式3可以当粒子在不可预知的位置或动作时为动态碰撞最好地权衡精确度与性能。


[[Category:Dota 2 Workshop Tools]]
[[Category:Dota 2 Workshop Tools]]
[[Category:AMHC 汉化]]

Latest revision as of 20:09, 10 July 2024

English (en)中文 (zh)Translate (Translate)

最大粒子数

默认情况下每个系统的最大粒子数设为1004。无论系统使用与否都会被分配到这么大的内存。所以在你设定完系统之后,你应该看看计数器来观察你有多少粒子被使用,并将最大粒子数设为这个值。这将有利于将内存占用量保持在一个理智的数量。

线程

粒子被系统设为了多线程。因此如果你有多个系统,他们会分布到尽可能多的线程里。所以从这点看,将复杂系统分割成多个系统来利用这个特性是一个不错的方式。这即是说,每个系统都有它们的开销,所以这个有效的方法的益处也是有限的,尤其在更简单的系统上。将一个只有少量粒子的系统分割开来几乎肯定是一种损失。然而,如果你的系统有1000+的粒子,那么你值得将粒子分成小份并分布到多线程中去。系统和其子系统总在同一个线程里因为父系统与子系统可以相互传递数据并且非常需要被组合在一起。

SIMD(单指令多数据流)

现在,大多数粒子操纵器、初始化器等工作在SIMD中。这意味着他们通常同时在硬件上做四个粒子的组的所有数学运算。理论上来讲未来在不同种类的硬件上这将增长至更广阔的数字。需要指出的是如果你注意四的倍数,你将会更好地利用系统。将系统缩放至最接近四的倍数可以使它变得稍稍更加理想。这虽然没有巨大的收获但也是应该被注意到的事。

共享数据

在父系统与子系统有许多方法可以共享数据。一些更复杂的初始化器或者操纵器可以通过向一个控制点写出他们的结果来最小化它们的表现效果,随后子系统可以读到这些结果并且不用计算便可得到相同数据。

碰撞

通常,碰撞是一项昂贵的操作。默认模式0在每一帧描绘每一个粒子的轨迹。这很昂贵并且无法良好地缩放。然而,碰撞约束允许一些不同的碰撞模式,他们能够用精确度换来速度以取得更快的碰撞碰撞模式3可以当粒子在不可预知的位置或动作时为动态碰撞最好地权衡精确度与性能。