Particle Editor: Difference between revisions

From The DarkMod Wiki
Jump to navigationJump to search
Bikerdude (talk | contribs)
Datiswous (talk | contribs)
 
(10 intermediate revisions by 3 users not shown)
Line 1: Line 1:
Beginners and those who just want to use the already existing particle effects might like to first read [[Particles for Beginners]].
Beginners and those who just want to use the already existing particle effects might like to first read [[Particles for Beginners]].


===Editing the particles themselves (size etc):===
==Editing the particles themselves (size etc):==
Open your test map in Doom3Ed and press {{key|F2}} (this brings up the game in windowed) and in the console type '''EditParticles'''. This will bring up the particle editor in Doom3Ed and allows you to make changes, as well as see the result of them in the renderview. Once the particle editor loads, you should see something like this:
The particle editor in DR is under menu option Entity > Particle Editor


[[Image:Editor particle.jpg]]
[[Image:Ptcl editor.png|728px]]
 
:Note: this article refers to the older [https://iddevnet.dhewm3.org/doom3/editor_particle.html Doom3 particle editor], and the editor layout has been updated since. The options do the same things so the information is still valid.


Now to explain a few things. At the top you have the particle name next to "particle", next to it you have new, save, and save as. Now, for easiest editing of particles, load up an existing particle, such as the leaf one in the example, modify it and then use "save as". I will explain a bit more further down.
Now to explain a few things. At the top you have the particle name next to "particle", next to it you have new, save, and save as. Now, for easiest editing of particles, load up an existing particle, such as the leaf one in the example, modify it and then use "save as". I will explain a bit more further down.


Firstly, and most importantly, we have material. This is the path to your material; not the image file but the material for your custom leaf. So for example you can see the example above has textures/particles/tdm_leaves_01. If you know the name of your material (for example textures/particles/green_leaves) then you can type that in there and press enter and it will find it by itself showing the changes in the render view.
To see the changes you are making, center your camera in the render view on the tree and press {{key|F7}} and {{key|F6}}. {{key|F7}} rebuilds everything and {{key|F6}} enables animations. Leave it in render view and move the particle editor to the side so you can see the render view (to watch the changes you are making as you make them).


Now that you can see your custom material we can continue on to the size of the leaves etc.
Firstly, and most importantly, we have '''Material'''. This is the path to your material; not the image file but the material for your custom leaf. So for example you can see the example above has textures/particles/tdm_leaves_01. If you know the name of your material (for example textures/particles/green_leaves) then you can type that in there and press enter and it will find it by itself showing the changes in the render view.


'''Bunching''' this determines how much the particles tend to bunch together, 0 meaning they want to spread out as evenly as possible, while 1 means that they bunch together a bit. The effect is not actually that noticeable mind.
Other things which combine with material are '''Color''' and '''FadeColor'''. The material you use will be modulated/multiplied by the color value specified. So if you have a white particle texture, you can set color to "1.0 0.3 0.3" to make all particles green. Or you can set color to "0.05 0.05 0.05" to make particles much more transparent. The FadeColor should usually be fully zero, since it specifies the color of a fully "faded-away" particle. The particle can also change the color dynamically using fading settings. If you want particles to gradually disappear during the second half of their lifetime, set '''Fade Out''' to "0.5". If you want the particles to gradually appear from nowhere during the first 20% of their lifetime, set '''Face In''' to "0.2".


'''Count''' controls how many particles there are, so basically the example shown has 32 particles in total. Obviously the more you have, the more dense the tree. This is a slider so slide it around as necessary. Alternatively you can input a value into the box and then press apply down the bottom right.
'''Cycles''' determines how many times the particle effect will play. Zero value means "infinite number of times".
In general, a particle system repeats itself prescribed number of times, and every such time is called a "cycle".
The most common values are: "cycles 1" for a single-time effect (e.g. one-time explosion), or "cycles 0" for an endless continuous effect (e.g. rain).


'''Cycles''' this is how long the effect will last in seconds, If you set "cycles 0.000", it is endless, otherwise repeated so many times. In my case I am creating some ceiling dust that is triggered so am going with 1 or 2 cycles.  
'''Time''' this is how long one cycle of the effect will last in seconds.
If you want to determine the total duration of the effect, multiply this time by the number of cycles it has.
For fast effects like fire, smoke, or rain, this is usually about a second.
For something lazy like leaves randomly flying around, better set this to something like 300.0 (i.e. 5 minutes). This is large enough so that player does not notice randomly disappearing/appearing particles.


To see the changes you are making, center your camera in the render view on the tree and press {{key|F7}} and {{key|F6}}. {{key|F7}} rebuilds everything and {{key|F6}} enables animations. Leave it in render view and move the particle editor to the side so you can see the render view (to watch the changes you are making as you make them).
'''Bunching''' this determines how much the particles tend to bunch together: 0.0 means they all come out at first instant, 1.0 means that they are emitted evenly over cycle time, 0.4 means that all particles come out in the first 40% time part of the cycle.
This is not important for a single-cycle particle system.
To create a continuous particle effect (e.g. rain), set bunching to 1.0. If you set it to any lower value, then particles will come out in bursts, bunched near the beginning of every cycle.
Note: bunching values over 1.0 are not supported and will cause some particles teleport around randomly.
 
'''Count''' controls how many particles there are (at any moment), so basically the example shown has 32 particles in total. Obviously the more you have, the more dense the effect is, and the more performance it costs. This is a slider so slide it around as necessary. Alternatively you can input a value into the box and then press apply down the bottom right.
 
To compute how many particles are emitted per second, divide Count by Time. This leads to an important observation: in order to make particles live X times longer, you have to also increase Count in X times, if you want to keep the same emitting speed.
 
Note that if you design particle system to apply to surface emitter (with "particle deform" material), then Count is specified per 64 x 64 area of emitting surface. So the larger is emitting surface in this case, the more particles will be rendered at every moment. This small adjustment is very useful e.g. for rain, because it allows you to create emitting surface of arbitrary size, and it will always have same particle density.
 
'''Orientation''' has major effect on how particles are rendered. If you want just to render particle aligned to the viewer, use View orientation. This is typical value for smoke, fire, fountains, and many other effects. If you want particles to always face up, then set orientation to Z.


You will also notice the "time" input beneath it. This is the lifespan of a particle in seconds. If I may suggest, don't mess with this, as putting it too low will make the particle lifespan visible, as in you'll notice them appearing/disappearing etc. If you put it to something ridiculous, like 99999, then it will load for extremely long, and sometimes not at all. It's best to leave it at 300 (5 minute), as you won't notice the tree leaves changing around every 5 minutes.
The last really useful orientation type is "Aimed", which allows you to stretch every particle along its movement direction, drawing a trail behind particle. The Time number is the duration in seconds of the trail. Better set this to low values like "0.1" first, then try to increase/decrease and tune how long you want the trails to be. This trail feature is useful to turn an ordinary fire particle into a fireball, or an ordinary puddle particle into a long rain droplet.
The Trails number should always be zero, unless you want to see curved trails. If you set Trails to K > 0 (integer), then every particle will be rendered as (K+1) quads, so every trail will consist of K+1 segments. Note that amount of geometry sent to GPU also increases in (K+1) times, so setting big values will decrease performance. On the other hand, bigger values may be necessary to make curves trails smoother.


'''Distribution''' This is where things get a little more annoying. You'll notice 3 check dots - rect, cylinder, and sphere. Realistically you'd want to use sphere, but for some reason the algorithm for distribution in the sphere (at least for the leaves) does not work correctly and you get several particles occupying the same spot, which results in z-fighting and generally looks really bad. Now, the rectangle distribution works perfect; particles are properly distributed and there is no z-fighting, but it's a rectangular shape, but can look ok if not too many particles are used. Another alternative is the cylinder distribution. Cylinder distribution works well but annoyingly enough the particles get distributed only on the walls of the cylinder, which means a hole in the middle, so you need to adjust the particle size and cylinder size so that there is no hole in the middle.
'''Distribution''' You'll notice 3 check dots - rect, cylinder, and sphere, describing the shape of emitting zone.
The values to the right are the size values in doom units, so change that to roughly be the size you want the emitting zone to cover.
The nonzero ring value can be set if you want to emit particles from cylinder or sphere surface, not from the whole volume.


The values to the right are the size values in doom units, so change that to roughly be the size you want the leaves to cover. If you selected cylindrical distribution, don't bother adding a ring value as it just makes it larger in diameter, so leave it at 0.
Note that if you intend to apply particle system to a surface emitter (with "particle deform" material), then the emitting position is already chosen randomly on that surface.
You don't need distribution in this case, and can leave it as "rect 0 0 0".


The offset is the offset from the center of the particle entity. Try keeping the leaves centered on the particle emitter, as Doom 3's light rendering system calculates whether or not to light the particles by checking whether the particle emitter is inside the boundary of the light; if yes then applies the lighting to it, but if not then it leaves the particle unaffected, ID did this for performance reasons.
The '''Offset''' is an additional offset vector from the center of the particle entity or surface. In general, better leave it zero. Try keeping the leaves centered on the particle emitter, as Doom 3's light rendering system calculates whether or not to light the particles by checking whether the particle emitter is inside the boundary of the light; if yes then applies the lighting to it, but if not then it leaves the particle unaffected, ID did this for performance reasons.


'''Random Distribution''' is just what it says, so you may want to leave that ticked.
'''Random Distribution''' is just what it says. Normally, you should always have it enabled, since otherwise all particles will start from the same point.


'''Speed''' leave that at 0 for the leaves as that is the speed at which the particles move away from the center of the emitter.
'''Speed''' defines how fast particles will move. Set this to zero for stationary particles. '''Direction''' specifies where they move. If you want to send all particles up (e.g. rain), set "cone 0". If you want to spread them along cone (e.g. fountain), then set "cone 45", where the second number is cone angle. If you want to create an explosion, use Outward direction. It is also possible to apply '''Gravity''' to all particles, so that they accelerate down like physical objects. In most cases you should use '''World Gravity''' flag, since otherwise gravity will be directed along local Z-axis of particle emitter.


'''Size''' is self-explanatory; it's the size of each particle.
'''Size''' is self-explanatory; it's the size of each particle.


'''Rotation''' is rotation speed of the particle and aspect stretches the particle from the center of the emitter. So leave these 2 alone for leaves.
'''Rotation''' is rotation speed of the particle and '''Aspect''' stretches the particle from the center of the emitter. So leave these 2 alone for leaves.


Notice that each of these has 2 sliders. This is for time based particles, so one slider is "from" and the second is "to". This is governed over the lifespan, so for example a particle that has sizes 0 to 50 and a lifespan of 10 would mean that it would gradually increase it's size to 50 from 0 over a span of 10 seconds. So for leaves this means that you leave both sliders at the same value. The other values below the speed, size, rotation, and aspect sliders do various things and you can mess around with them if you wish but they are not useful for leaves.
Notice that each of these has 2 sliders. This is for time based particles, so one slider is "from" and the second is "to". This is governed over the lifespan, so for example a particle that has sizes 0 to 50 and a lifespan of 10 would mean that it would gradually increase it's size to 50 from 0 over a span of 10 seconds. So for leaves this means that you leave both sliders at the same value. The other values below the speed, size, rotation, and aspect sliders do various things and you can mess around with them if you wish but they are not useful for leaves.
Line 40: Line 62:
Now that you know what each value does, just mess around with them until you reach something that looks good.
Now that you know what each value does, just mess around with them until you reach something that looks good.


Once you have something that you wish to keep, it is time to save it. Now, press save as (presuming you modified one of the existing leaf particles) and it will come up with a dialog asking for the particle name. Enter the name you wish (for example green_leaves_01) and press {{ok}}. Now it comes up with a path dialog. Browse to the Doom3/base/particles folder (if there is no particles folder create one) and name it as what you want (this is the file name, not the particle name), for example something like "mymap_particles" and then press ok. Make sure you save it into doom3/base/particles as saving it into doom3/darkmod/particles WILL NOT WORK. [EDIT - Someone check me but I tested this and it does seem you can save it direct in the darkmod/particles folder but if you save it in base/particles then it goes in darkmod/particles anyway. Also note that if you select an existing file it will ''append'' it - it does not overwrite but adds new particles definitions to existing files if selected. - Fidcal] Once you save it there you will find the particle file (in this case "mymap_particles.prt") in the doom3/darkmod/particles folder; strange, yes, but it saves it there due to the way Doom 3 mod-loading works.
''Saving''.
- Press save as (presuming you modified one of the existing leaf particles) and it will come up with a dialog asking for the particle name.  
- Enter the name you wish (for example green_leaves_01) and press {{ok}}.  
- Now it comes up with a path dialog. Browse to the Doom3/base/particles folder (if there is no particles folder create one) and name it as what you want (this is the file name, not the particle name), for example something like "mymap_particles" and then press ok. [[Make sure you save it into doom3/base/particles as saving it into doom3/darkmod/particles WILL NOT WORK]].  
 
[EDIT - Someone check me but I tested this and it does seem you can save it direct in the darkmod/particles folder but if you save it in base/particles then it goes in darkmod/particles anyway. Also note that if you select an existing file it will ''append'' it - it does not overwrite but adds new particles definitions to existing files if selected. - Fidcal] Once you save it there you will find the particle file (in this case "mymap_particles.prt") in the doom3/darkmod/particles folder; strange, yes, but it saves it there due to the way Doom 3 mod-loading works.


Now in DarkRadiant you should be able to find your new leaf particle when browsing through the particle list.
Now in DarkRadiant you should be able to find your new leaf particle when browsing through the particle list.


''Tutorial by Dram''
''Tutorial by Dram'' - updated by Bikerdude
 
== Particle settings not set by the editor ==
There are a few tweaks that can be added to particle decls manually, and that can't be set in the editor. See the [[Particles]] article for details.


{{editing}}
{{editing}}[[Category:Particles]]

Latest revision as of 12:46, 14 November 2022

Beginners and those who just want to use the already existing particle effects might like to first read Particles for Beginners.

Editing the particles themselves (size etc):

The particle editor in DR is under menu option Entity > Particle Editor

Note: this article refers to the older Doom3 particle editor, and the editor layout has been updated since. The options do the same things so the information is still valid.

Now to explain a few things. At the top you have the particle name next to "particle", next to it you have new, save, and save as. Now, for easiest editing of particles, load up an existing particle, such as the leaf one in the example, modify it and then use "save as". I will explain a bit more further down.

To see the changes you are making, center your camera in the render view on the tree and press F7 and F6. F7 rebuilds everything and F6 enables animations. Leave it in render view and move the particle editor to the side so you can see the render view (to watch the changes you are making as you make them).

Firstly, and most importantly, we have Material. This is the path to your material; not the image file but the material for your custom leaf. So for example you can see the example above has textures/particles/tdm_leaves_01. If you know the name of your material (for example textures/particles/green_leaves) then you can type that in there and press enter and it will find it by itself showing the changes in the render view.

Other things which combine with material are Color and FadeColor. The material you use will be modulated/multiplied by the color value specified. So if you have a white particle texture, you can set color to "1.0 0.3 0.3" to make all particles green. Or you can set color to "0.05 0.05 0.05" to make particles much more transparent. The FadeColor should usually be fully zero, since it specifies the color of a fully "faded-away" particle. The particle can also change the color dynamically using fading settings. If you want particles to gradually disappear during the second half of their lifetime, set Fade Out to "0.5". If you want the particles to gradually appear from nowhere during the first 20% of their lifetime, set Face In to "0.2".

Cycles determines how many times the particle effect will play. Zero value means "infinite number of times". In general, a particle system repeats itself prescribed number of times, and every such time is called a "cycle". The most common values are: "cycles 1" for a single-time effect (e.g. one-time explosion), or "cycles 0" for an endless continuous effect (e.g. rain).

Time this is how long one cycle of the effect will last in seconds. If you want to determine the total duration of the effect, multiply this time by the number of cycles it has. For fast effects like fire, smoke, or rain, this is usually about a second. For something lazy like leaves randomly flying around, better set this to something like 300.0 (i.e. 5 minutes). This is large enough so that player does not notice randomly disappearing/appearing particles.

Bunching this determines how much the particles tend to bunch together: 0.0 means they all come out at first instant, 1.0 means that they are emitted evenly over cycle time, 0.4 means that all particles come out in the first 40% time part of the cycle. This is not important for a single-cycle particle system. To create a continuous particle effect (e.g. rain), set bunching to 1.0. If you set it to any lower value, then particles will come out in bursts, bunched near the beginning of every cycle. Note: bunching values over 1.0 are not supported and will cause some particles teleport around randomly.

Count controls how many particles there are (at any moment), so basically the example shown has 32 particles in total. Obviously the more you have, the more dense the effect is, and the more performance it costs. This is a slider so slide it around as necessary. Alternatively you can input a value into the box and then press apply down the bottom right.

To compute how many particles are emitted per second, divide Count by Time. This leads to an important observation: in order to make particles live X times longer, you have to also increase Count in X times, if you want to keep the same emitting speed.

Note that if you design particle system to apply to surface emitter (with "particle deform" material), then Count is specified per 64 x 64 area of emitting surface. So the larger is emitting surface in this case, the more particles will be rendered at every moment. This small adjustment is very useful e.g. for rain, because it allows you to create emitting surface of arbitrary size, and it will always have same particle density.

Orientation has major effect on how particles are rendered. If you want just to render particle aligned to the viewer, use View orientation. This is typical value for smoke, fire, fountains, and many other effects. If you want particles to always face up, then set orientation to Z.

The last really useful orientation type is "Aimed", which allows you to stretch every particle along its movement direction, drawing a trail behind particle. The Time number is the duration in seconds of the trail. Better set this to low values like "0.1" first, then try to increase/decrease and tune how long you want the trails to be. This trail feature is useful to turn an ordinary fire particle into a fireball, or an ordinary puddle particle into a long rain droplet. The Trails number should always be zero, unless you want to see curved trails. If you set Trails to K > 0 (integer), then every particle will be rendered as (K+1) quads, so every trail will consist of K+1 segments. Note that amount of geometry sent to GPU also increases in (K+1) times, so setting big values will decrease performance. On the other hand, bigger values may be necessary to make curves trails smoother.

Distribution You'll notice 3 check dots - rect, cylinder, and sphere, describing the shape of emitting zone. The values to the right are the size values in doom units, so change that to roughly be the size you want the emitting zone to cover. The nonzero ring value can be set if you want to emit particles from cylinder or sphere surface, not from the whole volume.

Note that if you intend to apply particle system to a surface emitter (with "particle deform" material), then the emitting position is already chosen randomly on that surface. You don't need distribution in this case, and can leave it as "rect 0 0 0".

The Offset is an additional offset vector from the center of the particle entity or surface. In general, better leave it zero. Try keeping the leaves centered on the particle emitter, as Doom 3's light rendering system calculates whether or not to light the particles by checking whether the particle emitter is inside the boundary of the light; if yes then applies the lighting to it, but if not then it leaves the particle unaffected, ID did this for performance reasons.

Random Distribution is just what it says. Normally, you should always have it enabled, since otherwise all particles will start from the same point.

Speed defines how fast particles will move. Set this to zero for stationary particles. Direction specifies where they move. If you want to send all particles up (e.g. rain), set "cone 0". If you want to spread them along cone (e.g. fountain), then set "cone 45", where the second number is cone angle. If you want to create an explosion, use Outward direction. It is also possible to apply Gravity to all particles, so that they accelerate down like physical objects. In most cases you should use World Gravity flag, since otherwise gravity will be directed along local Z-axis of particle emitter.

Size is self-explanatory; it's the size of each particle.

Rotation is rotation speed of the particle and Aspect stretches the particle from the center of the emitter. So leave these 2 alone for leaves.

Notice that each of these has 2 sliders. This is for time based particles, so one slider is "from" and the second is "to". This is governed over the lifespan, so for example a particle that has sizes 0 to 50 and a lifespan of 10 would mean that it would gradually increase it's size to 50 from 0 over a span of 10 seconds. So for leaves this means that you leave both sliders at the same value. The other values below the speed, size, rotation, and aspect sliders do various things and you can mess around with them if you wish but they are not useful for leaves.

Now that you know what each value does, just mess around with them until you reach something that looks good.

Saving. - Press save as (presuming you modified one of the existing leaf particles) and it will come up with a dialog asking for the particle name. - Enter the name you wish (for example green_leaves_01) and press Click the OK button. - Now it comes up with a path dialog. Browse to the Doom3/base/particles folder (if there is no particles folder create one) and name it as what you want (this is the file name, not the particle name), for example something like "mymap_particles" and then press ok. Make sure you save it into doom3/base/particles as saving it into doom3/darkmod/particles WILL NOT WORK.

[EDIT - Someone check me but I tested this and it does seem you can save it direct in the darkmod/particles folder but if you save it in base/particles then it goes in darkmod/particles anyway. Also note that if you select an existing file it will append it - it does not overwrite but adds new particles definitions to existing files if selected. - Fidcal] Once you save it there you will find the particle file (in this case "mymap_particles.prt") in the doom3/darkmod/particles folder; strange, yes, but it saves it there due to the way Doom 3 mod-loading works.

Now in DarkRadiant you should be able to find your new leaf particle when browsing through the particle list.

Tutorial by Dram - updated by Bikerdude

Particle settings not set by the editor

There are a few tweaks that can be added to particle decls manually, and that can't be set in the editor. See the Particles article for details.