UDN
Search public documentation:

ParticleExamples
日本語訳
中国翻译
한국어

Interested in the Unreal Engine?
Visit the Unreal Technology site.

Looking for jobs and company info?
Check out the Epic games site.

Questions about support via UDN?
Contact the UDN Staff

UE3 Home > Particle & Effects > Particles Systems > Particle Examples
UE3 Home > FX Artist > Particle Examples

Particle Examples


Overview


This page is intended to be a quick-reference document for implementing different types of particle effects using materials and the Particle Editor in UnrealEd. For a comprehensive reference, see the Particles and Emitters Reference page; and for working with particles, see the Cascade User Guide.

Unlit Particles


UnlitOpaqueExample demonstrates how to create a particle system using an unlit material (Mat_UnlitParticleExample_Opaque).

UnlitAdditiveExample is an example of using an additively blended material (Mat_UnlitParticleExample_Additive) in a particle system. It is important to note that this will correctly render large numbers of blended particles with themselves and the scene.

UnlitTranslucentExample is an example of using a translucent material (Mat_UnlitParticleExample_Translucent) with particles to create alpha blended particles that render correctly with each other and the scene. For sorting particles between different emitters within a single particle system, the order of emitters determines the sort order.

UnlitMaskedExample demonstrates opacity-masked particles being blended with the scene. Similar to the unlit version, the material (Mat_UnlitParticleExample_Masked) uses a texture in the OpacityMask channel.

Vertex Color


The key to changing the color of a particle in Cascade is the material that is applied to the particle. Utilizing the VertexColor module, the user is able to modify properties of the material by passing values into the material using the color modules (initial color, color over life, scale color over life) in Cascade.

For coloring the particles, we will look at Mat_UnlitParticleExample_VertexColor and UnlitVertexColor.

In the material, we see that the diffuse texture is being multiplied with the VertexColor module's RGB. When coupled with the color modules in Cacade will modulate the color of the texture with the assigned color, giving us the results in UnlitVertexColor. Adding a ColorOverLife module to the particle system allows us to define color values we wish the particles to inherit based on the timeline in the curve. Any module that has 'OverLife' in its name is a relative lifetime module, meaning that the time values 0-1 scale to the particle's lifetime, 0 being birth and 1 being death. So setting a color curve that starts at black at time 0, increases to white at time .2, maintains that value to time .8, then falls to black again at time 1 will give us a particle system that fades in for the first 20% of its life, spends the next 60% of its lifetime at full color, then fades out over the last 20% of its lifetime.

An advanced use of VertexColor is to use the Alpha channel of the VertexColor module to affect another value of the material to complement the color changes. Looking at Mat_UnlitParticleExample_VertexColor_OpacityAlpha and its particle system UnlitVertexColor_Alpha, we see that the alpha channel of the VertexColor module is being multiplied with the alpha channel of the diffuse texture, the being wired to the Opacity channel of the material. This means that changing the distribution on the AlphaOverLife portion of a ColorOverLife module gives us control over the opacity of the particle over its lifetime.

We can alternatively use the alpha channel of the VertexColor module to modulate other values of the material system. For example, in UnlitVertexColor_AlphaEmissive, and its material Mat_UnlitParticleExample_VertexColor_EmissiveAlpha, the VertexColor's alpha channel is being multiplied by a large value, in this case a constant value of 200, then multiplied again with the product of the diffuse RGB and the VertexColor's RGB color. This results in control over the emissive strength using AlphaOverLife.

Sub UV


Using a ParticleSubUV module in a material gives you the ability to blend or switch between multiple 'frames' in a single image on a particle using the SubUV settings in a particle emitter. The Mat_ParticleSubUVExample material applied to the particle emitter in SpriteSubUVExample demonstrates this. Once the material is created, applying it to the emitter and setting the emitter's InterpolationMode (in the base emitter properties) as well as the number of subimages both horizontal and vertical allows us to use a SubImage Index module to determine the blend between these sub-images. Adding the SubImage Index to the curve editor and changing its distribution to ConstantCurve gives us control over the subimage being used over time. As the value starts a 0, the last image will always be the number of images - 1, thus the example curve going from 0 to 3.

See the Particles SubUV Tutorial page on the UDN for more information.

Event Generator


When the desired effect is to have rain in a level, you can also get the splash effect of the rain on meshes and materials, including on characters.

Splashes on Character Pawns can be accomplished by placing a particle system above the model and linking it to the Pawn so it moves with the character. Inside of the particle system are two emitters. The first emitter sends very tiny particles (invisible due to their small scale) down from the particle system towards the mesh. They move quickly and have short lifetimes. These particles have collision enabled which is set to "kill" the particle when it detects a collision. This first emitter also has a module called Event Generator (under the Event submenu) set to collision and given a unique name, which generates an event every time one of its particles collides with something.

The second emitter in the particle system is a small water splash. This could be a sprite or small mesh. Inside of this particle system is an Event Receiver Spawn module (also under the event submenu in Cascade) which listens to the Event Generator module and is told to spawn a particle whenever the collision event is detected, at that location.

The end result is a stream of individual invisible particles which collide with the mesh and, at that impact point, spawn a small splash.

Anim Trails


Anim Trails allow for displaying a trail or streak behind an animation using data sampled directly from the animation itself. By sampling at a user-set framerate, they provide a framerate-independent way to generate effects such as weapon trails.

See the Anim Trails page on the UDN for more information.