bullet@Posted: Mon Aug 09, 2004 5:03 pm :
Particle Effects Tutorial 1


Welcome to the wonderful world of particles! If you've played the game AT ALL then I'm sure you know something about what can be done with them. The jets from the spaceship you arrive in are particles. The steam from that hose right at the beginning is a particle effect. Blood, clouds of dust, fireballs, ricochets, rain, explosions, waterfalls, tornadoes--these can all be done with particle effects. And thanks to the particle editor (which I'll get to in a moment) it's amazingly easy since there's no code that needs to be written.


1. What is a Particle Effect, exactly?

A particle is a small, one-sided square made out of two polygons. If you turn on r_showtris and look at a particle effect, you'll see a whole bunch of little squares like this one:

Image

Because they are on-sided, if you look behind them you can't see them at all. This is important to remember with certain settings. Particles have a "look-at" command, so that they always face the view (or a certain axis if you change it later). This makes it easier on the engine because it only has to render two polygons per particle, wheras if they were viewable from behind, it would require at least four. Six polygons per particle if you wanted to see them from any direction. I know it doesn't seem like much, but when you're dealing with particles numbering in the thousands, it starts to add up. Think about this: most character models in the game aren't much higher than 5,000 polygons. The largest number of particles you can have through their editor for one stage of an effect is 4,096. That's 8,192 polygons. If each particle were two-sided, it would be 16,384 polygons. Look-at controllers are our friends :)
On a side note related to look-at controllers: Half-Life 2 uses a similar look-at technique for all its vegetation, which helps since their engine never has to render an actual blade of grass; their bushes are on flat planes that rotate to match the view.

Through the particle Editor you can change the orientation of the look-at controller so that it doesn't point directly at the camera. You can align it to the X, Y, and Z axis, the player's View, or to the direction the particle is moving (called "Aimed" in the editor).
If you set it to Z, you won't be able to see the particles from below. If you set it to X, you won't be able to see them from behind, etc.

Another thing to note, is that when particles get near eachother their color values add together. If you have 30 yellow particles right on top of eachother, you'll get a white blob. This is great for explosions and light effects, but really doesn't seem to fit with dust clouds.



2. Alright Already! How I do this?

First thing's first. Launch Doom in windowed mode. If it comes up fullscreen push Alt + Enter to get it windowed. I suggest a smaller resolution like 640x480, but as long as you can see everything it's fine.

Pull down the console (Ctrl + Alt + ~) and type 'editParticles'

Now, this takes a while for anything to happen, so please be patient. Go get something to drink, or read ahead, or engage in an exciting thumb-twiddling competition with your cat. Anything other that staring at it waiting for it to load :P

After 40-60 seconds or so, you should get a screen like this:

Image

This looks a little daunting, perhaps a bit complex. Most of it is actually pretty simple, and I'll take you through some pieces of thing step by step in an attempt to make you more comfortable with it. The things I skip will be covered in later tutorials.

3. The Editor

Starting at the top:
Image

The green highlighted area shows the particle you're currently working on. The dropdown box shows the name of the particle (which can be anything not already named as a particle) and will let you select any other particle to work on. The text below that shows where the file itself is located. You can see in this example we're working on "Admin_hall_smk_cone" which is located in "particles/alphalabs1.prt"

The yellow highlighted area is pretty self-explanatory, but just in case: Click on New... to create a new particle. It will first ask you for the name of the particle, which will be displayed in the dropdown. It will also ask if you want to copy the current particle into the new one (a good way to work on Id's particles), then it'll ask you where to save it and for a filename for the .prt file.


Moving down...

Image

On the left you have the Stages section. The box where it says "stage 0" is where you can select different stages of your effect. Whichever stage you have selected will be highlighted blue, and any change you make to any setting will affect that stage only.

The gold buttons above the stage selection box will (from left to right) Create a new Stage, Delete the selected Stage, Hide the selected stage (any effects on that stage will not show up when you test the effect), and Show the selected stage if it's Hidden.

The yellow box indicates the material currently applied to the effect on the current stage. In order to craft your own 100% original particle effect, you will have to make your own images for the effect and write a material file for them. This will be included in the next installment.
To the right of that box is a button that merely says "..."
Click this box and a material selection dialogue box will appear, allowing you to change the material without typing it in the little box.

The portion that is highlighted Light Blue controls fading effects for your particle. Fade in controls how much each particle will have to fade in order to become fully apparent when it spawns. Setting this at 0 means all the particles will spawn without any extra transparency and won't fade at all. Likewise, setting it to 1 will make them completely invisible the instant they spawn and all the particles will fade in from that.

Bunching is important. It controls how many particles are spawned at a time. Setting this to 0 will make all of the particles (from 0 to 4096, remember?) spawn at once, fly away and disappear. The closer to 1 you get, the fewer come out at one time. At 1, you will have a continuous effect (if you keep looping it).


Image

Count controls the number of particles. It can range from 0 to 4,096 and will drastically affect any particle effect you ever make. One reason for this, is the additive property particles have. If you put them close together they add together. Dark things get darker, light things get lighter. Dark greys, indigoes, and blacks will become absolutely black. Yellows, oranges and light greens will become absolutely white. dark oranges will become red. And so on. If you want to make smoke, you will need to keep this down :wink:


Image

On the top we have Gravity. A negative setting will pull your partices upward, a positive setting pulls them downward. The greater the number, the stronger the pull.

Below and to the left we have Distribution
This will influence the behavior of your particles to a great extent. By defining a shape, you define that shape around the particle emitter (what you put in your map). The particle emitter will be at the center of this shape, unless you set Offset to something other than 0 0 0.
Rect will define a Cube with the dimensions you set. The particles will spawn on the cube, not in the cube.
Cylinder defines a cylinder with the dimensions you set. The particles spawn on the surface the perimeter of the cylinder.
Sphere defines a sphere with the dimensions you set. The particles will spawn on the surface of the sphere.
I cannot stress enough that the particles do not spawn within the shape at all. They spawn on the surface of the shape.
Ring will define the radius of a circle around your shape for the particles. This only works if you're using Outward for your direction instead of Cone. Here's an example of the Ring in action.

Image

Ring is set to 0

Image

Ring is set to 5


The ring is a way of expanding your sphere without defining a larger radius. Quite often you can make it look like particles are spawning within your shape by using the ring properly.


After you've defined your shape, you can set the Direction and Orientation of your effect.
If you select Cone (in light green) then you will have to define an Angle for it. This can be anything from 0 to 360. The smaller the angle, the smaller and tighter the cone will be. The larger the angle, the larger the cone.
If you select Outward (in light green) instead, then Angle becomes Upward Bias. The larger the number the more the particles will try to push themselves upward.

To the right of that, in light blue, with have the orientation. This is what I was talking about with the look-at controller. By default it's set to View. If you set it to Aimed you'll still be able to see the particles all the time, though they'll look stretched (which is cool for some stuff). Setting X Y or Z will make the particles only viewable from one side.

Initial Angle (at the bottom in green) defines the angle the particles come out of the emitter at.



Image

Here, in red is the Speed. There are two values, as you can see. The speed of your particles will start at the first number, and end at the second. By using a positive for the first and a negative for the second, your particles will turn around. If you want them all moving at the same speed, set both to the same number. Speeds can be negative.

In green you have the Size. Again, two values, and your particles will spawn as large as the first value, and die at the second value.

In yellow you have Rotation. Same as above with the two numbers. Rotations can be negative as well. I've achieved better results leaving this setting alone and adding some rotation into my material file instead, though.

In blue is the Aspect. By increasing one value over the other, you can stretch your particles. Take it too far and you get a bunch of lines.



Image


In the lower-left hand corner of the editor are some buttons under the heading DOOM Stuff. The only two that you need to worry about right are the T and Switch to DOOM buttons.

Pressing the T will spawn the current particle you're working on at the player's feet as a testmodel. For playing around with particles I reccomend the map 'testmaps/test_box'

clicking Switch to DOOM will do just that. If you ran it in a window like I told you to, though, you can just click on the DOOM window. Plus, you'll see all the changes you make updated as you make them without having to switch.



That should give you enough to get started making your own particles! I plan to have another update soon (I'm hoping before Thursday) which will go in-depth on more specific uses for different settings, and may even include the use of vertex fragment programs. Stay tuned and happy tweaking! :)



Methidox@Posted: Wed Sep 01, 2004 2:11 pm :
This is great and all.... But I can only view the particle editor from the top to Bounds Expansion

Which sucks, do you know a way so i can scroll to the bottom?



rich_is_bored@Posted: Wed Sep 01, 2004 5:44 pm :
Increase your desktop resolution so that the full window is visible?



Methidox@Posted: Wed Sep 01, 2004 5:56 pm :
Its at maximum resolution... come on, you've got to give me some intellectual credit =P



rich_is_bored@Posted: Wed Sep 01, 2004 7:13 pm :
I worked a helpdesk for four years.

It's good practice to assume the simplest solution is the right one when you're talking to someone new, even if you risk offending them.

The next thing to try is some kind of virtual desktop software that allows you to make the desktop size larger than the resolution of your screen. This way you can scroll the desktop around to gain access to the rest of the window.

If that's not good enough you'll either need to wait for this issue to be addressed in a patch, which may not even happen or get a monitor capable of higher resolutions.



bozo@Posted: Thu Sep 02, 2004 12:27 pm :
here are some comments:


Quote:
Rect will define a Cube with the dimensions you set. The particles will spawn on the cube, not in the cube.
Cylinder defines a cylinder with the dimensions you set. The particles spawn on the surface the perimeter of the cylinder.
Sphere defines a sphere with the dimensions you set. The particles will spawn on the surface of the sphere.
I cannot stress enough that the particles do not spawn within the shape at all. They spawn on the surface of the shape.


for me this seems not be true, only the cylinder behaves like this,
in the rect and sphere case they spawn within the shape/volume



Quote:
The portion that is highlighted Light Blue controls fading effects for your particle. Fade in controls how much each particle will have to fade in order to become fully apparent when it spawns. Setting this at 0 means all the particles will spawn without any extra transparency and won't fade at all. Likewise, setting it to 1 will make them completely invisible the instant they spawn and all the particles will fade in from that.


i think that is not the case, it's not a transparency control, it's a more generally control,
they control the use of the Color and Fade Color,
fade frac controls how much of the particles are fully faded



Quote:
In blue is the Aspect. By increasing one value over the other, you can stretch your particles. Take it too far and you get a bunch of lines.


with this setting you can control how much one dimension of the particle is scaled
it's like the other's - the scalevalue of the particles will start at the first number and end at the second



the time period for these settings are the "Time" setting



but what does the "Cycles" and "Time offset" settings?



Quote:
In yellow you have Rotation.


the particles choose randomly a rotation direction, clockwise or counterclockwise



Quote:
Bunching is important. It controls how many particles are spawned at a time. Setting this to 0 will make all of the particles (from 0 to 4096, remember?) spawn at once, fly away and disappear. The closer to 1 you get, the fewer come out at one time. At 1, you will have a continuous effect (if you keep looping it).


when 0, than all "Count" number of particles spawn at once, not from 0 to 4096
when > 0, than the "Count" number of particles are distributed evenly across the "Time" time period



i couldn't really found out how this "Cone" setting really works, also what the particles really do
and also what this "Ring" setting really does
and how this "Aimed" setting really works



Techx@Posted: Sun Sep 05, 2004 7:04 pm :
bullet, Excellent tutorial! When I first saw the p.ed it did look daunting but after reading through your tut, it's just like you said.. very easy to use, and a lot of fun creating crazy different particle effects.

Thanks again,
Techx



FloodAnxiety@Posted: Sun Sep 05, 2004 9:30 pm :
bozo wrote:
but what does the "Cycles" and "Time offset" settings?

Cycles determines the number of times the effect will repeat itself. Setting it to 0 means the effect will repeat itself forever. The effect repeats for another cycle after its time expires.

Time offset delays the effect from starting by the specified amount.



bozo@Posted: Mon Sep 06, 2004 10:53 am :
@FloodAnxiety
thanks, for clarify this

i thought on this, but it seems that the behavior of the editor are strange, when i change the cycles value to something other than 0, nothing shows up after pressing the apply button, the editor doesn't reset the time of the particleeffect, so the time periode of the choosen cycles are passed, really bad behavior



abigserve@Posted: Wed Sep 08, 2004 12:13 am :
Will this edit the particles in my map only, or will it change that particle effect in every level? i don't want a remake of the PDA mishap (don't ask, but my marines name is now Default.)

[edit] IIIIII get it!



Cryect@Posted: Wed Sep 08, 2004 12:29 am :
Alright the explaination of the Particle Editor is pretty good except this one part just bugged me (I kinda skipped it before)

bullet wrote:
Because they are on-sided, if you look behind them you can't see them at all. This is important to remember with certain settings. Particles have a "look-at" command, so that they always face the view (or a certain axis if you change it later). This makes it easier on the engine because it only has to render two polygons per particle, wheras if they were viewable from behind, it would require at least four. Six polygons per particle if you wanted to see them from any direction. I know it doesn't seem like much, but when you're dealing with particles numbering in the thousands, it starts to add up. Think about this: most character models in the game aren't much higher than 5,000 polygons. The largest number of particles you can have through their editor for one stage of an effect is 4,096. That's 8,192 polygons. If each particle were two-sided, it would be 16,384 polygons. Look-at controllers are our friends :)


If they were two sided triangles that doesn't double the number of polygons. You just disabled backwards culled triangles and it draws them no matter which side they are facing. If the material specifies its two sided then backwards culling is disabled, not twice as many polygons are drawn. Okay I'm happier now :P



Danabacken@Posted: Tue Aug 22, 2006 7:32 pm :
Old thread, I know.

How do I get my particles into my own map, and being able to move them around and rotating them? :) Anyone?



Ivan_the_B@Posted: Tue Aug 22, 2006 8:31 pm :
bind it to a func_mover :wink:



shadowscrawl@Posted: Thu Sep 10, 2009 1:13 pm :
the pics are gona any chance of getting them back?? i am really trying to follow this but much seems to depend on the pictures



parsonsbear@Posted: Thu Sep 10, 2009 2:21 pm :
Chances are slim to nil- still a good tutorial, just open the editor and try to follow along.

As with all thing doom3, the best way to learn is to try to understand the basic concepts, then look at the stuff id did, then modify it little by little to see how it changes, then build your own when you know whats what.

For the particles in particular, there's a huge amount of them already build by the pros at id- i'm guessing whatever you have in mind is either already in there, or just involves a few tweaks.