UDN
Search public documentation:

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

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 > Particles SubUV Tutorial
UE3 Home > FX Artist > Particles SubUV Tutorial

Particles SubUV Tutorial


Overview


The Unreal Engine's Particle System provides an emitter TypeDataModule that allows for the selection of sub-images from a source texture to be displayed on its particles. It works by allowing you to select the sub-image to display for a particular particle as a function of the lifetime of the particle. See the CascadeUserGuide for a general description of the Cascade Particle Editor.

This document assumes you are familiar with the Content Browser, and with creating packages and objects within those packages.

Create a new ParticleSystem


Start the editor, right-click in the Content Browser, and select "New ParticleSystem". The New window will pop-up, prompting you for a package name, object name, and the factory as shown below:

PS_SubUV_01_New.jpg

Enter the following information:

Package MyEmitters
Group  
Name SubUV_Emitter
Factory should be on ParticleSystem

[[NOTE: If you have done other particle system tutorials, the MyEmitters package may already exist. In this case, if you do not want to lose the previous work and the package is not open, open the MyEmitters package and perform the right-click in the browser window for MyEmitters.]

This will result in the following insertion into your MyEmitters package:

PS_SubUV_02_InitialBrowser.jpg

Import a Texture


In this example, we will be using a simple 'subdivided texture' called ColorQuads. The texture consists of a simple quartered color square scheme, with the alpha channel embedding the numbers 1, 2, 3, and 4 in each sub-square from left-to-right and top-to-bottom. This image allows for simple verification that the sub-image system is working.

After importing the texture, MyEmitters in the browser should look similar to the shot below:

PS_SubUV_03_AddTexture.jpg

Create a ParticleSubUV Material


The next step is to create a material that will be applied to the sprites generated by the particle emitter. Right-click in the MyEmitters browser window and select "New Material". Name the material "SubUV_Mat" and open it in the Material Editor.

In the case of Sub-UV emitters, a special material expression, ParticleSubUV, must be used. First select the ColorQuads texture in the Content Browser, then right-click in the material editor window and pick it from the list as shown below:

PS_SubUV_04_Mtrl_NewExp.jpg

The following material expression widget will appear in the editor:

PS_SubUV_05_Mtrl_ExpPic.jpg

The next step is to `hook-up' the SubUV expression to the output of the material. In this simple case, just run the RGB output to the Emissive input, and the Alpha output to the Opacity, as shown below:

PS_SubUV_07_Mtrl_HookUp.jpg

If desired, the blend mode of the material can be set according to how you want the particles to be drawn. In this case, we will use "BLEND_Translucent", so select it as shown in the screen shot below:

PS_SubUV_08_Mtrl_Translucent.jpg

The View So Far


Provided this tutorial was started with no MyEmitters package, the browser window should look similar to the following:

PS_SubUV_09_ReadyToEdit.jpg

Create the Particle SubUV Emitter


To open the Particle Editor, Cascade, right-click on the ParticleSystem and select it from the menu as shown below:

PS_SubUV_10_OpenEditor.jpg

Once Cascade opens, select the SubUV_Mat in the Content Broswer and right-click the `emitter bar' and select "New ParticleSpriteEmitter" as shown below:

PS_SubUV_11_CreateNew.jpg

At this point, you should see the following view in Cascade, showing the newly created Emitter in the preview window:

PS_SubUV_12_CascadeView.jpg

Located in the 'Required' class are the SubUV-related settings: the InterpolationMethod, and the Horizontal and Vertical sub-image counts for the texture.

Emitter_SubUV.jpg

Setting up the SubUV parameters


Enter the following information for the given fields:

SubImages_Horizontal 2
SubImages_Vertical 2
InterpolationMethod PSSUV_Linear

This informs the emitter that the sub-images are laid out in a 2x2 grid, and that the interpolation should be in a linear fashion between sub-images.

Emitter_Running.jpg

As you can see, the emitter is selecting the `first' sub-image for the supplied texture, as the default sub-image index will be a constant 0.

Setting the SubImage Selection


Add a SubImage index module to the Emitter by right-clicking and selecting it from the list. The properties for this module will now be displayed in the lower-left panel of Cascade. There is only one piece of information contained in the SubImageIndex module, and that is a scalar distribution named "SubImageIndex".

PS_SubUV_17_SIIUniform.jpg

Switch the distribution to a Constant Curve by clicking on the blue arrow and selecting it from the list.

PS_SubUV_17_SIIUniform2.jpg

Click on the small green 'graph button' on the SubImage Index module of the emitter to add the curve to the curve editor.

PS_SubUV_17_graph.jpg

Add a curve with data points at the following increments:

Time Value
0.00 0.00
0.75 3.01

This will generate an emitter that smoothly transitions between all of the existing sub-images, giving each one approximately 25% of the lifetime of the particle. Below is a screenshot:

PS_SubUV_18_SIIConstCurve.jpg

The MyEmitter package is available here.