Particle System Operators:zh-cn

From Valve Developer Community
Revision as of 13:25, 18 August 2014 by Cs italy (talk | contribs) (Created page with "== 公有操作器 == 一般而言,所有的粒子系统都会有movement_basic(基本移动)和lifespan_decay(寿命衰减)这两个操作器。movement_basic用来控制粒...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

公有操作器

一般而言,所有的粒子系统都会有movement_basic(基本移动)和lifespan_decay(寿命衰减)这两个操作器。movement_basic用来控制粒子的移动。lifespan_decay用来定义粒子的生存时间,一旦生存时间结束,系统就可以删除该粒子并回收相应的资源(alpha_fade 操作器本身内部包含 lifespace_decay,所以使用alpha_fade操作器时不需要再用额外的lifespan_decay 操作器了)。

一般操作

Fade In(淡入)/Fade Out(淡出)/Fade Oscillate(震荡闪变) 这三个是标准操作器,能作用于其他所有操作器。根据操作器的不同,淡化组件可能有效,也可能无效而是一个二进制效果。

Fade In(淡入)、Fade Out(淡出)的时间点是相对于emitter(发射器)的生存期而言的,我们说一个操作器在3秒后淡入指的是发射器发射结束(而不是粒子生存期结束)的3秒后。

如果设定了Fade Oscillate的振荡周期,那么fade in和fade out的时间就要被设定为震荡周期的小数倍。下面举个例子:如我们使用了Fade Oscillate操作器,并且把震荡周期设定为4秒、淡入系数设定为0.25、淡出系数设定为0.75,那么得到如下效果: 4秒为一个周期,每个4秒分为3个阶段,第一阶段为1秒(4秒的0.25倍),该阶段没有任何效果,第二阶段出现视觉效果且持续2秒(4秒的0.75-0.25=0.5倍),最后一阶段1秒,该阶段效果为淡出;然后如是循环反复。

粒子期限计时器

用于在粒子的生存期超限之后,将粒子删除。该操作没有参数传入。如果既没有使用lifespan_decay也没有使用alpha_fade,那么相关的粒子将永远不会因过期而被删除。

需要注意的是,如果没有使用相应的decay操作(或者,由于不合适的EndCap(截止)设定,decay操作没能被激活),创建的粒子将会永远存在于系统中,即便粒子本身已经完全淡出、半径缩小为0且生存期超限,这会导致严重的后果--已占用的系统资源(内存、处理器)不能正常释放--系统的可用资源将越来越少。我们可以通过粒子编辑器提供的预览窗口来快捷的确定自己粒子系统是否设计正确,确保粒子效果能正常结束并完成资源的清理和回收。如果预览窗体中显示的是不断的循环效果,那么你的设计是正确的。如果显示效果停止,并且永不重现,那么必定是因为它或者它的一个子系统缺少应有的decay操作器。为了继续设计(或者对于那些使用了EndCap的效果),在粒子编辑器中按下Stop(停止)按钮,就可以让它执行EndCap并重新启动。

Alpha衰减和计时

用于指定在一段特定时间内将粒子的alpha值衰减到一个特定值,然后删除该粒子。

start_alpha
指定粒子淡入过程的alpha值(亮度)的起点。淡入过程中,粒子亮度从start_alpha渐变至该粒子亮度的初始设定值。
end_alpha
淡出过程中,粒子亮度将渐变至end_alpha设定的值。
start_fade_in_time
设定淡入过程的起始时间点(规定为lifespan(粒子生存期)的小数倍)。
end_fade_in_time
设定淡入过程的终止时间点(规定为lifespan(粒子生存期)的小数倍)。
start_fade_out_time
设定粒子淡出过程的起始时间点(规定为lifespan(粒子生存期)的小数倍)。
end_fade_out_time
设定粒子淡出过程的终止时间点(规定为lifespan(粒子生存期)的小数倍)。

随机Alpha淡入

设定粒子从零alpha值开始淡入,淡入过程持续时间是在一个指定的绝对或者相对时间范围内的一个随机值。

fade in time min
时间范围的下限(最短时间)。
fade in time max
时间范围的上限(最长时间)。
fade in time exponent
随机时间范围的偏差值。
proportional 0/1
设定随机时间范围为粒子生存期的相对值(小数倍)(1)或者绝对值(0)。

随机Alpha淡出

设定粒子从其alpha初始设定值开始淡出并渐变为零alpha值,淡出过程持续时间是在一个指定的绝对或者相对时间范围内的一个随机值。不论是相对还是绝对时间,都是从粒子的生存期末尾计算(即对已粒子生存期的最后阶段)。举例来说,0.25的相对时间设定值表示粒子淡出过程位于粒子生存期的最后四分之一时段;而2的绝对时间设定值表示淡出过程对应于粒子生存期的最后2秒。(--alpha_fade_out操作本身不包含lifespan_deca操作--)

fade out time min
时间范围的下限(最短时间)。
fade out time max
时间范围的上限(最长时间)。
fade out time exponent
随机时间范围的偏差值。
proportional 0/1
设定随机时间范围为粒子生存期的相对值(小数倍)(1)或者绝对值(0)。

Color Fade

Fades the color of a particle to a target color over a given amount of time.

color_fade
Color to fade to.
color_fade_time
Time over which to fade the color (seconds).
fade_start_time
Once this point in time is reached in the particles lifetime, the particle will be fully it's original color. If this value is greater than "fade_end_time" the particle will stay it's original color.
fade_end_time
Once this point in time is reached in the particles lifetime, the particle will be fully affected by the color of "color_fade". If this value is greater than "fade_start_time" then the particle will remain the color of "color_fade".

TIP: both "fade_end_time" and "fade_start_time" can be negative values to start the color transition before the particle is created.

Movement Basic

Allows for basic movement of the particle through space.

gravity
Gravity to apply to the particle.
drag
Drag to apply to the velocity of the particle.

Rotation Spin Roll

Adds rotational spin to the particle, including spinning down and minimum spin.

spin_rate_degrees
Rate at which to spin (degrees).
spin_stop_time
Time at which to be at the minimum speed (seconds).
spin_rate_min
Minimum spin to be at when the stop time is past (degrees).

Rotation Spin Yaw

Adds rotational spin to the particle's yaw axis, including spinning down and minimum spin. Works just like the roll rotation spin.

spin_rate_degrees
Rate at which to spin (degrees).
spin_stop_time
Time at which to be at the minimum speed (seconds).
spin_rate_min
Minimum spin to be at when the stop time is past (degrees).

Radius Scale

Scales the radius of the particle over time.

start_time
Time at which to begin the scaling (second).
end_time
Time at which to end the scaling (seconds).
radius_start_scale
Scale value at the beginning of the scaling.
radius_end_scale
Scale value at the end of the scaling.
ease_in_and_out
Spline scaling curve.
scale_bias
Bias the curve towards either end (0..1).

Movement Lock to Controlpoint

Forces the position of a particle to that of some control point on the emitter.

start_fadeout_min
Bottom range of time to start fading out the lock (leave the particle behind).
start_fadeout_max
Top range of time to start fading out the lock (leave the particle behind).
end_fadeout_min
Bottom range of time to end fading out the lock. Particle will be fully disengaged from the control points movement at this point.
end_fadeout_max
Top range of time to end fading out the lock. Particle will be fully disengaged from the control points movement at this point.
start/end exponents
Bias on the selection within the range.
control point number
Which control point to lock to
fade distance
Particles will detach as they approach this distance
lock rotation
This will update a particle relative to a Control Point's rotation as well as position.

Movement Lock to Bone

Lock to Bone works like the Position Lock to Control Point operator, but is used in combination with the random position on model initializer. Given a particle is emitted from a particular bone, it will update its position based on the specific movement of that bone. Excellent for player auras or burning players.

control_point_number
The control point that references the model in question.
lifetime start fade
The time at which to start fading the lock - relative to particle lifespan (0-1).
lifetime end fade
The time at which to end (fully detach) the lock - relative to particle lifespan (0-1).

Oscillate Scalar

Oscillates a scalar output value at a certain rate and frequency. This can be used to creating flashing, glowing, pulsing particles or more subtle effects. The start and end timings are useful for creating an effect which occurs only once other operators have reached a desired effect, etc. Multiple oscillators of the same type can be applied to create multiple levels of effects (such as a particle which slowly pulses between small and large, but is also constantly minorly jittering in size as it does so).

Scalars are mapped to a sin wave oscillation. A few sample frequencies have been marked.
proportional
This bool sets whether to oscillate at the specified frequency over the lifespan of the particle (1) or per second (0)
oscillation frequency max
Top range of frequency of oscillation. Depending on whether proportional is set, this frequency will map to the lifespan of the particle or per second. A high frequency will cause the particle to strobe, while anything lower than .25 can be used to apply a more constant direction of the rate rather than an oscillating effect.
oscillation frequency min
Bottom range of frequency of oscillation. Depending on whether proportional is set, this frequency will map to the lifespan of the particle or per second. A high frequency will cause the particle to strobe, while anything lower than .25 can be used to apply a more constant direction of the rate rather than an oscillating effect.
oscillation rate max
Top range of rate of change applied. This defines how much the particular output field changes per frame. Some fields (such as alpha) will be automatically clamped from 0.0 to 1.0, while others, such as radius, are not capped.
oscillation rate min
Bottom range of rate of change applied. This defines how much the particular output field changes per frame. Some fields (such as alpha) will be automatically clamped from 0.0 to 1.0, while others, such as radius, are not capped.
oscillation field
What parameter is oscillated. This can be alpha, radius, roll, etc.
start time min/max
A range defining when to start applying the oscillation. Start/End proportional flag defines whether this is relative to the lifespan of the particle or a strict time in seconds.
end time min/max
A range defining when to stop applying the oscillation. Start/End proportional flag defines whether this is relative to the lifespan of the particle or a strict time in seconds.
oscillation multiplier
This is a simple multiplier for the oscillation rate min/maxes.
oscillation start phase
This is where on the sin curve oscillation begins.

Oscillate Vector

Oscillates a vector output value at a certain rate and frequency. This can be used to create weaving, squiggling particles and so forth. The start and end timings are useful for creating an effect which occurs only once other operators have reached a desired effect. Multiple oscillators of the same type can be applied to create multiple levels of effects (such as a bug particle which slowly weaves about on a large scale at random and squiggles constantly as it moves).

Scalars are mapped to a sin wave oscillation. A few sample frequencies have been marked.
proportional
This bool sets whether to oscillate at the specified frequency over the lifespan of the particle (1) or per second (0)
oscillation frequency max
Top range of frequency of oscillation. Depending on whether proportional is set, this frequency will map to the lifespan of the particle or per second. A high frequency will cause the particle to quickly move back and forth, while anything lower than .25 can be used to apply a more constant direction of the rate rather than an oscillating effect.
oscillation frequency min
Bottom range of frequency of oscillation. Depending on whether proportional is set, this frequency will map to the lifespan of the particle or per second. A high frequency will cause the particle to quickly move back and forth, while anything lower than .25 can be used to apply a more constant direction of the rate rather than an oscillating effect.
oscillation rate max
Top range of rate of change applied. This defines how much the particular output field changes per frame. Color will be automatically clamped from 0 to 255, while position is not capped.
oscillation rate min
Bottom range of rate of change applied. This defines how much the particular output field changes per frame. Color will be automatically clamped from 0 to 255, while position is not capped.
oscillation field
What parameter is oscillated. This can be color or position.
start time min/max
A range defining when to start applying the oscillation. Start/End proportional flag defines whether this is relative to the lifespan of the particle or a strict time in seconds.
end time min/max
A range defining when to stop applying the oscillation. Start/End proportional flag defines whether this is relative to the lifespan of the particle or a strict time in seconds.
oscillation multiplier
This is a simple multiplier for the oscillation rate min/maxes.
oscillation start phase
This is where on the sin curve oscillation begins.

Movement Dampen Relative to Control Point

This operator suppresses movement as a particle approaches the specified control point. This can be used with lock to control point (and it's distance fade option) to have CPs "capture" particles near them and draw them along with them. It can also lock endpoints of a line of particles while allowing the middle section to move freely.

control_point_number
The control point to dampen relative to.
falloff range
The distance over which the dampening will fall off.
dampen scale
The strength of the movement dampening.

Set Control Point Positions

Allows a particle system to configure its own control points.

<nth> Control Point Number
The CP being affected. To do: Safe to set to -1?
<nth> Control Point Parent
Specify another CP to act as a movement parent. Leave at zero to use the system's origin.
<nth> Control Point Location
Vector coordinates for the CP
Set positions in world space
When true, CP locations are relative to the world. When false, they are relative to the system's local origin.
Control Point to offset positions from
CP locations are offsets from this CP's location. To do: Updated over time or one-shot?

Set Control Point to Particles' Center

Locks a control point to the center of this system's particle cloud.

Control Point Number to Set
Center Offset
The control point to set, and an optional worldspace offset.