Attention: Here be dragons

This is the latest (unstable) version of this documentation, which may document features not available in or compatible with released stable versions of Godot.

ParticleProcessMaterial 2D Usage

Process material properties

ParticleProcessMaterial properties

Min, max, and curve properties

The properties in this material control how particles behave and change over their lifetime. A lot of them have Min, Max, and Curve values that allow you to fine-tune their behavior. The relationship between these values is this: When a particle is spawned, the property is set with a random value between Min and Max. If Min and Max are the same, the value will always be the same for every particle. If the Curve is also set, the value of the property will be multiplied by the value of the curve at the current point in a particle's lifetime. Use the curve to change a property over the particle lifetime. Very complex behavior can be expressed this way.

備註

This page covers how to use ParticleProcessMaterial for 2D scenes specifically. For information on how to use it in a 3D scene see Process material properties.

Lifetime Randomness

The Lifetime Randomness property controls how much randomness to apply to each particle's lifetime. A value of 0 means there is no randomness at all and all particles live for the same amount of time, set by the Lifetime property. A value of 1 means that a particle's lifetime is completely random within the range of [0.0, Lifetime].

Particle Flags

生成

角度

確定粒子的初始角度(以度為單位). 該參數通常在隨機化後會有用.

../../_images/paranim11.gif

Velocity

方向

這是粒子發射的基礎方向. 預設值是 Vector3(1,0,0) , 它使粒子向右發射. 然而, 在預設的重力設定下, 粒子會直線下降.

../../_images/direction1.png

為了讓這個屬性作用更明顯, 你需要一個大於0的 初始速度(initial velocity) . 這裡, 我們把初始速度設為40. 你會注意到粒子向右發射, 然後受重力作用下降.

../../_images/direction2.png

發散

此參數是以度為單位的角度, 它會被隨機加減到基礎 Direction 上. 180 的鋪開角度將向所有方向發射(+/- 180).

../../_images/paranim3.gif

扁平度

這個屬性只對3D粒子有用.

初速度

初始速度是粒子發射的速度(單位為像素/秒)。以後可以通過重力或其他加速度來修改速度(後述)。

../../_images/paranim4.gif

Animated Velocity

角速度

Angular velocity is the speed at which particles rotate around their center (in degrees/sec).

../../_images/paranim5.gif

環繞速度

環繞速度速度用於使粒子繞它們的中心轉動.

../../_images/paranim6.gif

Accelerations

重力

應用於每個粒子上的重力.

../../_images/paranim7.gif

Linear Acceleration(線性加速度)

應用於每個粒子的線性加速度.

Radial Acceleration(徑向加速度)

如果此加速度為正, 則粒子會向遠離發射中心加速. 如果是負的, 他們會被加速吸進去.

../../_images/paranim8.gif

Tangential Acceleration(切向加速度)

該加速度會使用從粒子到中心點的切向量, 結合徑向加速度可以做出很酷炫的效果.

../../_images/paranim9.gif

阻尼

阻尼選項會對顆粒施加摩擦力, 迫使它們停止. 它特別適用於火花或爆炸, 火花或爆炸通常以高線速度開始, 然後在他們隱去時停下來.

../../_images/paranim10.gif

Display

縮放

確定粒子的初始大小.

../../_images/paranim12.gif

Color Curves

顏色

用於改變發射出來的粒子顏色.

Hue Variation

Variation 值設定的是應用於每個粒子的初始色調變化. Variation Rand 值控制色調變化的隨機性比率.

動畫

備註

Particle flipbook animation is only effective if the CanvasItemMaterial used on the GPUParticles2D or CPUParticles2D node has been configured accordingly.

To set up the particle flipbook for linear playback, set the Speed Min and Speed Max values to 1:

Setting up particle animation for playback during the particle's lifetime

Setting up particle animation for playback during the particle's lifetime

By default, looping is disabled. If the particle is done playing before its lifetime ends, the particle will keep using the flipbook's last frame (which may be fully transparent depending on how the flipbook texture is designed). If looping is enabled, the animation will loop back to the first frame and resume playing.

Depending on how many images your sprite sheet contains and for how long your particle is alive, the animation might not look smooth. The relationship between particle lifetime, animation speed, and number of images in the sprite sheet is this:

備註

At an animation speed of 1.0, the animation will reach the last image in the sequence just as the particle's lifetime ends.

\[Animation\ FPS = \frac{Number\ of\ images}{Lifetime}\]

If you wish the particle flipbook to be used as a source of random particle textures for every particle, keep the speed values at 0 and set Offset Max to 1 instead:

Setting up particle animation for random offset on emission

Setting up particle animation for random offset on emission

Note that the GPUParticles2D node's Fixed FPS also affects animation playback. For smooth animation playback, it's recommended to set it to 0 so that the particle is simulated on every rendered frame. If this is not an option for your use case, set Fixed FPS to be equal to the effective framerate used by the flipbook animation (see above for the formula).

碰撞區域的顯示

ParticlesMaterial 可以讓你設定一個發射遮擋(Emission Mask), 它決定了粒子發射的區域和方向. 這些可以用專案中的紋理來生成.

確保設定了ParticlesMaterial, 選中Particles2D節點. 工具列中應顯示 "Particles(粒子)" 功能表:

../../_images/emission_shapes1.webp

打開它, 選擇"載入 Emission Mask(發射遮擋)":

../../_images/emission_shapes2.webp

然後選擇你想要用作遮擋的紋理:

../../_images/emission_shapes3.webp

會出現一個具有多個設定的對話方塊.

發射遮罩

紋理可以生成三種型別的發射遮擋:

  • Solid Pixels(實心像素): 粒子將從紋理的任何區域產生, 透明區域除外.

../../_images/emission_mask_solid.gif
  • Border Pixels(邊界像素): 粒子將從紋理的外邊緣產生.

../../_images/emission_mask_border.gif
  • Directed Border Pixels(定向邊界像素): 類似於邊界像素, 在遮罩中新增額外的資訊, 使粒子能夠從邊緣發射出去. 請注意, 想要使用它, 需要設定一個 初始速度.

../../_images/emission_mask_directed_border.gif

發射色彩

Capture from Pixel 會使粒子在其產生點處繼承遮擋材質的顏色.

Once you click "OK", the mask will be generated and set to the ParticleProcessMaterial, under Spawn and then Position

../../_images/emission_shapes4.webp

這個部分所有提到的值, "載入Emission Mask(發射遮擋)"功能表都會自動生成, 所以通常他們放著不管就可以了.

備註

不應該直接新增圖像到 Point TextureColor Texture 中. 應該始終使用"載入Emisson Mask(發射遮擋)"功能表.