Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin

Overview

This is a continuation of the Creating a Simple Particle Effect tutorial that focused on creating simple 2D particles.

After completing this tutorial you will be able to add more details to already existing particle effects.

To get started, load the fire particle that you created in the first tutorial.

Table of Contents
maxLevel3
minLevel2

Adding More Particles to the Effect

Adding Child Particles

Every particle can have child nodes that can be triggered by the parent effect.

First, make sure that the particle Fire1, which you created in the previous particle tutorial is selected in the Particle Editor.

Now click the Add Sub Effect button to make a child node.

Right-click the child node and rename it "Spark1."

Setting Up Sparks

  • Select Spark1.
  • Go into the Appearance pane
  • Turn on Orient To Velocity.
  • Set the Blend Type to Additive.
  • Assign the spark_stretched_mono.dds file in the Texture field.
  • In the additional parameters of Texture Tiling, set Tiles X and Tiles Y both to 2 and the Variant Count to 4.

Note: You may have to right-click your entity and select Reload Script in order to see the visual effect.

Using a Random Frame in an Animated Particle

This sprite is designed for use as an animated texture. To create an animated texture yourself, prepare a tiled texture like the one shown.

The animation frame order starts at the top left corner, continues to the right, and ends at bottom right tile.

The resolution of each tile must follow the general rule of texture creation in CryENGINE. It must be a multiplier of 16.

In this case, set the Variant Count instead of the Anim Frames Count, so that on spawn the sprite texture will be randomly picked from one of the 4 tiles.

Spawning the Sparks

Go to Emitter pane and turn on the Continuous switch, set Count to 30, set Particle Life Time to 0.5 and set Particle Life Time Var Random to 0.5.

Go to the Lighting pane and set Diffuse Lighting and Diffuse Backlighting to 0. Then set Emissive Lighting and Emissive HDR Dynamic to 3.

Go to the Appearance pane, make sure that Orient to Velocity is selected and that the blend type is set to Alpha based. Set Alpha to 1, and then set the Var Particle Life curve as shown below.

Interpolation Types in the Particle Graphs

Next, select the end point of the curve, then put the mouse cursor in to the graph area and press the SPACE key. This will change the point's interpolation type to linear.

Adding Color to the Particle

At the moment, this texture has no color so let's add some. Open the Appearance pane and scroll done to the color property. Double-click the left edge of the Color Var Particle Life bar.

The color selector will come up:

Select a bright orange color then press OK. Double-click the right edge of Color Var Particle Life bar.

Make a new point and set it to dark orange. The Var Particle Life bar should look like this:

Altering the Size of the Sparks

Now, go to the Size pane and set it up as shown:

Go to the Spawning pane and set Random Offset X and Y to 0.5.

Spawning/Random Offset boxes adds a random offset to the spawning point of the particle from the emitter's axis.

Next, turn on the Second Generation switch. This makes sure spawned particles are triggered by the parent particle. Every time Fire1 spawns 1 sprite, Spark1 triggers, to spawn up to a maximum 30 sprites.

When second generation is turned on, the Inherit Velocity value will affect the Second Generation particles movement. This is the percentage of velocity that a child particle inherits from the parent particle at emission time. Try increasing this value, and see how it affects the movement of your particles, and save it if you like it.

Be sure to save your scene before going to the next step.

Tweaking the Particle's Movement Behavior

Go to the Angles pane and set Emit Angle to 45 and the Emit Angle Var Random to 1.

Go to the Rotation pane and set the Rotation Rate Z to 20

Go to the Movement pane and type in the settings indicated below:

This time, you set a negative value for Gravity Scale. This means particles will not fall to the ground, but rather move upwards to the sky.

Turbulence Size, and Turbulence Speed adds simple turbulence movement to particle. The Turbulence Size value controls the amount of turbulence the particle is exposed too, and Turbulence Speed controls the speed of the particle moving along the turbulence path.

Play with higher or lower values of these parameters to get a good understanding of how these values work.

Testing the Particle at Different Times of the Day

Open the Time Of Day window from View -> Open View Pane -> Time Of Day.

Turn on the Force sky update switch and drag the slide bar to around 22:30 as shown below:

The scene will now become dark, so you can check out how your effect looks at night time.

From this image, it seems like the particle is glowing too strongly at night. To counter this, decrease Emissive Lighting, Emissive HDRDynamic and Alpha value.

You should always test your particle by switching between day time and night time and tweaking values, to make sure it looks good at all times.

Making the Fire Look More Realistic

Setting Up an Animated Texture

To make the fire appear even more realistic, you can change it to an animated texture.

Change the Fire1 settings to as shown below. Use the texture textures\sprites\fire\large_animated1.dds.

Also, be sure to set the position as shown below:

Adding Smoke to the Fire

Select Fire1, create a child and rename it Smoke1.

Set up Smoke1 as below. Use the texture textures\sprites\smoke_white_tiled2.dds.

Now, repeat the earlier steps:

In the Emitter pane, turn on Continuous and change the Count to an appropriate value.

In the Lighting pane, set up the Alpha value and Var Particle Life curve.

In the Angles pane, set up Rotation Randomization.

Also, remember to Reload Scripts on your selected particle, should you not see changes.

Adding a Glow Around the Base of the Fire

Select Fire1, create a child and rename it Base1. This will be a particle that will spawn around the base of your fire, and as such, should not raise up. Set the movement speed to a very low value to reflect this:

Set up Base1 as below. Use the texture textures\sprites\radialfire2.dds.

In the Emitter pane, turn on Continuous, change the Count to an appropriate value.

In the Lighting pane, set up the Alpha value and Var Particle Life curve. It is also possible to tweak Emissive Lighting and Emissive HDRDynamic.

In the Angles pane, adjust the Random Rotation Rate.

Remember to Reload Scripts.

Adding a Heat Haze to the Flames of the Fire

Select Fire1, create a child and rename it to Haze1. This will be a particle effect attached to the flames to create a refractive heat haze effect.

Set up Haze1 as below. Use the texture textures\sprites\fire_blur1_ddn.dds.

Click on the material selection and choose a refractive material, such as Materials\particle\refraction_muzzle.

Change particle size, stretching, count, life time as you like. Also, adjust random rotation angles on the Z-axis to your liking.

In the spawning pane, check the second generation box to create particle emitters that are relative to the parent particles.

Don't forget to reload scripts on your particle entities. You can check this effect by placing it before other geometry so the refractive disturbing becomes visible.

You can also achieve a heat haze effect with the settings below.

Useful Information

Loading and Using Other Libraries

Click the Load Library button at left top of the Database View.

A browser window will open, from which you can select a different library.

You can switch between libraries by selecting them from the library drop-down menu.

Copying and Pasting Particle Attributes

You can copy and paste between libraries by right-clicking within the pane and selecting either Copy Category or Copy All.

You can Paste using the same menu.

Applying a Material to a Particle

You can apply materials to the particle. For example, if you select a refractive material, it will apply refraction to your particle.

Clicking the Browse Material button will open the Material Editor. Select a material from there, then go back to your particle in the database view. Now, click Assign Material.

 

 

Excerpt
hiddentrue
Add more details to particle effects with sparks, animated textures, and smoke.
Chinese

给粒子特效添加更多细节

这是关于创建简单 2D 粒子的《创建简单粒子特效》教程的延伸。完成此教程后,您就能够为现有的粒子特效添加更多细节。在开始此课程之前,请加载您在第一个教程中创建的火焰粒子。

添加更多特效粒子

添加子级粒子

每个粒子都可有由父级特效触发的子节点。

首先,要确保您之前在粒子教程中创建的粒子*火焰 1*已在粒子编辑器中选中。

现在单击*添加子特效*按钮添加一个子节点。

右击*子节点*并将其重命名为“火花 1”。

设置火花

*注:*必须右击实体,然后选择*重载脚本*以便体验视觉效果。

在动画粒子中使用随机帧

此片画面是设计用作动画纹理的。若要自己创建动画纹理,请准备一张如图所示的拼贴纹理。动画帧的顺序从左上角顶部开始向右延续,然后在右侧底部结束。

每个 tile 的分辨率必须遵循 CryENGINE 中创建纹理的基本规则,必须使用 16 倍的分辨率。

在这种情况下,要设置“变体的数量”而不是“动画帧的数量”,这样再生时将会从 4 个 tile 中随机挑选一个片画面纹理。

生成火花

进入*粒子发生器*窗格并打开*连续*开关,将*数量*设置为 30,将*粒子寿命*设置为 0.5 以及将*粒子寿命的随机 Var*设置为*0.5*。

进入 Alpha 窗格并将*漫反射照明*和*漫反射背光*设置为 0。然后将*放射性光照*和 Emissive HDR Dynamic 设置为 3

进入*外观*窗格,确定*适应速度*已选并确定将混合类型设置为基于 Alpha。将 Alpha 设置为 1,然后将 *Var 粒子寿命*曲线设置为如下所示。

粒子图中的插值类型

接下来,选择曲线的端点,然后把鼠标放在图形区域并按下 SPACE 键,这将会改变点的插值类型改为线性。

给粒子添加颜色

此时,这个纹理是没有颜色的,所以现在需要给它们添加一些颜色。打开*外观*窗格,然后向下滚动至颜色属性。在 *Var 粒子寿命颜色*栏的左边线处双击。

将会显示颜色选择器:

选择橙黄色,然后按下*确定*。在 *Var 粒子寿命颜色*栏的右边线处双击。

创建一个新点并将其设置为深橘色。“Var 粒子寿命颜色”栏应该是这样的:

更改火花的大小

现在进入*大小*窗格并对其进行如下设置:

进入*再生*窗格并将*随机偏移 X* 和 Y 设置为 0.5

再生/随机偏移盒从粒子发生器坐标轴将随机偏移添加到粒子再生点。

接下来,打开*第二代*开关,以便确定父级粒子触发了再生粒子。每次火焰1 再生 1 个片画面将触发火花 1,最多可以再生 30 个片画面。

当打开第二代开关时,“继承速度”值将会影响“第二代”粒子的移动,这是子级粒子在发射时从其父级粒子继承的速度百分比。尝试增加这个值,并了解其是如何影响粒子移动的,如果喜欢可以将其保存。

在进入下一步骤之前请确定此场景已保存。

调整粒子的移动行为

进入*角度*窗格并将*发射角度*设置为 45 以及将*随机 Var 发射角度*设置为 1

进入*旋转*窗格并将*旋转速率 Z* 设置为 20

进入*移动*窗格并按以下指示在设置中输入:

此时,将“重力因子”设置为负值。这意味着粒子不会掉到地上,相反会向上移动到天空中。

“扰动尺寸”和“扰动速度”为粒子添加了简单的扰动移动。“扰动尺寸”值控制着粒子出现的数量,“扰动速度”控制着粒子沿着扰动路径移动的速度。通过设置这些参数的较高值或较低值以更好地理解这些值是如何发挥作用的。

在不同的当日时间对粒子进行测试

从*视图 -> 打开视图窗格 -> 当日时间*中打开*当日时间*窗口。

打开*强制更新天空亮度*开关并按照下图所示,将滑动条拖到 22:30 左右:

场景现在将会变暗,这时就可以检验出晚上您所设置的特效效果。

从此图像中可以看出,粒子在晚上发出的光很强。若要解决这个问题,请减少*放射性光照*、放射性 HDR 动力*和 *Alpha 值

应该经常通过白天和夜晚的切换以及微调数值来测试粒子,以确保粒子看起来总是很好。

使火焰看起来更真实

设置动画纹理

若要使火焰看起来更真实,则可以将其更改成动画纹理。

使用纹理 textures\sprites\fire\large_animated1.dds,将*火焰1*设置成如下所示。

同样地,确保设置的位置如下所示:

给火焰添加烟雾

选择*火焰1*,创建一个子级并将其重命名为*烟雾1*。

使用纹理 textures\sprites\smoke_white_tiled2.dds,如下所示,设置*烟雾1*。

现在,重复前面的步骤:

在*粒子发生器*窗格,打开*连续*并将*数量*更改为适当的值。

Alpha 窗格,设置 Alpha 值和 *Var 粒子寿命*曲线。

在*角度*窗格,设置*旋转随机化*。

同样地,若您没有看到变化,记住要对已选粒子*重载脚本*。

在火焰底部周围添加光晕

选择*火焰1*,创建子级并将其重命名为*底部 1*。这是一个将会在火焰底部周围再生的粒子,正因如此,它是不能升高的。将移动速度设置为一个低数值以反映出这一点:

使用纹理 textures\sprites\radialfire2.dds,如下所示,设置*底部 1*。

在*发射器*窗格,打开*连续*,将*数量*更改为适当的值。

Alpha 窗格,设置 Alpha 值和 Var 粒子寿命*曲线。 It is also possible to tweak *Emissive Lighting and Emissive HDRDynamic.

在*角度*窗格,调整*随机旋转窗格*。

记住要*重载脚本*。

为火焰添加热浪

选择*火焰1*,创建子级并将其重命名为*热浪 1*。这将是火焰的附属粒子特效以创造一种折射的热浪特效。

使用纹理 textures\sprites\fire_blur1_ddn.dds,如下所示,设置*火焰 1*。

单击“材质选择”并选择一种折射材质,例如 Materials\particle\refraction_muzzle。

根据您的需要更改粒子尺寸、拉伸、数量以及寿命。同样地,也可以根据您的需要在 Z 轴上调整随机旋转角度。

在“再生”窗格,选中“ 第二代 ”复选框,以便创建与父级粒子相关的粒子发生器。

 

切勿忘记重载粒子实体的脚本。您可以将粒子实体放在其他几何体的前面以检查其特效,在这种情况下折射干扰是可见的。

通过以下设置,也可以获得热浪特效。

 

实用信息

加载并使用其他函数库

单击“ 数据库视图 ”左上角的“ 加载函数库”按钮。

将会打开一个浏览器窗口,您可以从中选择不同的函数库。

您可以从下拉菜单中选择函数库,并且所选函数库之间可以相互切换。

复制和粘贴粒子特性

在窗格内右击,选择*复制类别*或*复制全部*可以实现函数库之间的复制和粘贴。

您可以使用相同的菜单进行*粘贴*。

将材质应用于粒子

您可以将材质应用于粒子。例如,如果选择一种折射材质,则该材质将会把折射应用于粒子。

单击*浏览材质*按钮将会打开*材质编辑器*。从中选择一种材质,再返回至数据库视图中的粒子。现在单击*指定材质*。