Revision Difference
Understanding_Emmiters_Initializers_&_Operators#548638
<cat>Particle.Intro</cat>
<title>Understanding Particle Editor</title>
# Brief intro
This is here to help share and understand what everything does in terms of making particles.
Can be used by beginners or more "advanced" creators.
Feel free to make changes or add what you think is missing or would be useful, try to keep everything tidy for people to read.
if you are a beginner, i recommend to go to <page>Creating_your_first_particle_effect</page>
to understand what you should be doing, although still look here for what does what though and what options you have.
#Emmiters
Emitters are what create the particles, they control the amount created, delay before creation and all of that.
## Constant / Continuous Emitter
Within this emitter it will do a constant spew of particles, it wont look at the amount of particles already emitted, it will just constantly create them within the specified amount of particles per second.
you can control:
Duration, how long it should keep spewing out particles.
Start time offset, how long it should wait before activating.
Emit rate, the amount of particles created per second.
##Instant / Instantaneous Emitter
Will just create a certain amount of particles specified, will not loop.
you can control:
Emit count, amount of particles created.
Start time offset, how long it should wait before activating.
##Standard Emitter
Like a smart version of Constant, it will constantly create particles, only up till a specified amount though, e.g., if there is a cap of 100, it will only make 100 particles, it will never activate again if the total stays at 100, or if you delete them and the tot drops below 100, it will shoot out particles again until its at 100 again.
you can control:
Max particles, the max amount of particles it will ever allow to exist and emit up to.
Emit rate, the amount of particles created per second.
Start time offset, how long it should wait before activating.
#Initializers
This is the information that each particle will have with it on creation, you can specify,
what location it should be created in, what size, what color, what rotation, what speed in what direction, how long its lifespan should be and so on.
Basically all the information it will use to display itself once its created.
THIS IS ONLY ON CREATION THOUGH, so it will not control how the particle will act after creation, that's what operators do,
initializers only how it looks and information about what it should do for operators to use upon creation and so on.
so if you wanted a big, randomly placed particle that should have speed pushing it in a certain direction as soon as it spawns, it will all be specified in here, aka initialized on creation.
The main things in here you will be using will be
##Position in (BLANK)
You can choose from a list of them
![the list](https://i.imgur.com/xERlmLz.png)
Most of the time you will use sphere, but all of them technically work, the difference is the region and shape where the particles can spawn, for example the box vs the sphere.
![box](https://i.imgur.com/zmZvm8q.png)
![sphere](https://i.imgur.com/hP58pa1.png)
See it changes the shape, but the sphere is much more useful in my opinion.
As you can see the sphere gives so much more options, so i recommend just to use it.
let me go over all the properties options in sphere.
| property | use / purpose |
| ------------- |:-------------:|
| distance min | minimum distance from the center of the sphere particles will spawn (anything more than 0 will cause a gap in the middle where nothing will spawn) |
| distance max | max distance away from a point particles will spawn bigger number, bigger area, if you want them to shoot from one point, set min and max to 0 |
| distance bias | will give a bias where particles can be spawning in a flat circle if you set to 1, 1, 0 and so on. |
| distance bias absolute value | causes the particles to prefer or only spawn in certain parts of the sphere, setting first 2 to 0 and leaving last at 1 will cause them to only spawn in the top half like a dome |
| Control point number | changes what control point its centre is at |
| speed min | minimum amount of speed it will have shooting out away from the centre of the sphere |
| speed max | maximum amount of speed it will have shooting out away from the centre of the sphere |
| speed random exponent | another bias, for if it should bias towards speed min or speed max |
| bias in local system | When enabled, if the particle is attached to an entity or object with rotations that are different from just placing the particle in the world, the particle's properties in this initializer will align with the rotation and position of that entity. |
| randomly distribution growth time | not sure please fill it in if you find out |
| speed in local coordinate system min | adds minimum velocity on the particle on a certain axis, e.g. 0, 0, 100 will cause to min amount of speed that it shoot upwards |
| speed in local coordinate system max | adds maximum velocity on the particle on a certain axis, e.g. 0, 0, 100 will cause to max amount of speed that it shoot upwards |
| output vector | the vector it will output from (just leave this alone) |
| velocity vector | the vector for its velocity (just leave this alone) |
Please have a mess around with this since it will be the main way you will be making your particles move and spawn in a specific place.
<warning> MAKE SURE TO ADD THE MOVEMENT BASIC IN THE OPERATORS IF YOU WANT TO VIEW AND TEST THIS INITIALIZER IF YOU WANT TO MESS AROUND ON A NEW PARTICLE, ALSO ADD A BASIC RENDER SPRITES IN THE RENDERERS </warning>
## Set Float (per Particle)
Summed up this allows you to put an input for everything that will affect the particle, so it can change the base rotation it spawns at, the base size, the life duration and so on.
Within this you can click this button to give a list of input types.
![input types](https://i.imgur.com/vQ4mvKK.png)
The main ones you will probably use are the top 3.
1. The top is just a single number so will have a constant rotation, scale, life duration on every single particle.
2. The 2nd option will randomly give an output between 2 numbers, each particle will have a random number between these 2.
3. The 3rd option will also randomly give an output between 2 numbers, but you can push a bias towards one number, lets say if you wanted big particles with only a small amount of smaller particles you do that with this.
Here are the main targets you will be using, also what operators are needed for them to actually work.
| target | use | inputs needed | operators needed |
| ------------- |:-------------:| -----:|
| life duration | how long a particle will exist for in seconds | any number you want, it controls time | either Alpha fade and decay or Lifespan decay |
| radius | changes the size of each particle | any number you want, bigger number bigger size | nothing needed |
| roll | this controls the rotation the particle spawns at | 0 - 360 | nothing needed |
| roll speed | controls the amount of continuous rotation is has once after spawns | any number, but keep it low unless you want to spin REALLY quick | rotation basic |
## Set Vector (per particle)
This controls pretty much color, it does do other things, but you will only ever really use it for the color.
Instead of a value input like the float this takes a vector input.
![vector input example](https://i.imgur.com/9XfeADD.png)
Although some of these options can be adjusted by a value input like the last option, the color gradient.
![value input on vector input](https://i.imgur.com/6ajJxQ7.png)
Let's put this to a common use, you can cause it to spawn with a random color between 2 colors, let's say black and white, you can set it a color gradient input, then use random uniform on the value option just below the gradient option to spawn randomly between them 2 colors, so you will now get a variation from black-grey-white gradient of particles.
Like so one you set the colors in that gradient.
![example](https://i.imgur.com/iywBKCt.png)
# Operators
Operators are what control and tell the particle what to do after its creation, either it does it based on its own inputs, or inputs receive from the initializers.
Here is a list of the operators you will commonly be using and what their purpose is.
| operator | use | initializer needed |
| ------------- |:-------------:| -----:|
| movement basic | this will allow the particle to move after creation, it will receive an input from an initializer and allow it to move, You can add gravity to the particle on whatever strength and direction you want and also add DRAG to the particle to cause it to slow down after the initial speed it had so it comes to a stop| Position in sphere / move particle between 2 points (also set vector but i don't recommend using that at all) |
| alpha fade and decay | will cause the particle to fade in and fade out of existence (you can change it to also just pop it and fade out or fade in and pop out) | needs Set Float - life duration OR it will auto set to 1 second |
| Lifespan decay | also causes the particles to come in and out of existence, but instead pop in and out instead of fading | needs Set Float - life duration OR it will auto set to 1 second |
| Lifespan endcap timed decay | Causes the particle to live indefinitely until an endcap (destroying) event is triggered on the particle (either through code, or in the particle through some function). You can give it a delayed time before the particle disappears after being triggered. Generally this operator is used for particles that do not require continuous emission or that do not fade/die unless some event is triggered in-game. | needs Set Float - life duration OR it will auto set to 1 second. Life duration in this context simply refers to the amount of seconds before all operators in the particle finish or reset their cycle (but does not necessarily kill the particle) |
| rotation basic | will cause the particles to rotate at a constant rate | needs Set Float - roll speed |
| rotation spin roll | will cause the particle to spin starting at one speed and then switching to a 2nd speed but a certain amount of time | needs no input |
# Constraints
These in simple terms can cause extra stuff to happen while the operators are doing stuff, they can allow collisions and interactions with stuff external to the particle.
The only one you would ever need to use (try and avoid it since it can lag the game used too much) is Collision via traces.
| Constraint | Purpose |
| ------------- |:-------------:|
| Collisions via traces | this allows your particles to interact with geometry up to a certain point, mainly allowing them to stick to wall and bounce of walls if needed, BE CAREFUL WITH IT, SINCE IT CAN BE LAGGY IF OVER USED |
# Renderers
This is how the particle will physically display and render as game as, although the initializers can change the colour, everything about how it looks is all done in here.
You will be using
Render sprites pretty much every single time.
in there, there are options to change everything about how it renders.
This meaning how it is shaped (STENCIL TEXTURE), how lighting will work, uv stuff, animation on the particle, normal stuff, orientation that the particle is facing, extra color adjustment related stuff.
The main options in there you probably will use are:
1. Stencil texture.
2. Color blend.
3. Radius scale.
4. Alpha scale.
5. Self illum amount.
6. Orientation type.
If you want to use custom sprites (stencil textures) please head over to <page>using_custom_sprites</page>
And if you want to learn how to make animated sprites (stencil textures) check out <page>creating_animated_sprites</page>
# vSnap⤶
# Snapshot⤶
A .vsnap (valve particle snapshot file) that is used by the particle system as a reference for control point data. Generally a .vsnap is a collection of vectors such as vertices from a model, and can be used for example to position particles in a certain manner.
⤶
They can hold information you can use like, Position, Color, Radius, Creation Time and many more, This is done by storing them on the vertex data. They can also be animated along with the mesh (this can be seen in Half Life Alyx G-Man Speech scene).⤶
To create a .vsnap File you can use ModelDoc. Just add a VSNAPFile operator in modeldoc and select the mesh you want to convert. When compiled this will save a .vsnap file in your particles folder.
# Conclusion
## Here is an example using a lot of what has been explained here.
<upload src="70317/8d91a26971f9a18.mp4" size="1688476" name="2021-05-18 18-54-50_Trim.mp4" />
here is what is going on
EMITTERS
1. Emit standard - is creating a constant 100 particles max, once they die it create another 100.
INITIALIZERS
1. Position in sphere - spawning the particles in sphere at a distance, then moving them outwards and upwards.
2. Set Float - Roll speed - setting a random rotation speed value for the operators to use for each particle.
3. Set Vector - Color - setting a random color from white to black on each particle.
4. Set Float - life duration - setting the life of the particles to all be 5 seconds.
OPERATORS
1. Alpha fade and decay - causing the particles to fade in and out at the start and end of the lifespan given by the Set Float - life duration initializer
2. Movement basic - Is grabbing the speed input from the position in sphere, then also adding some drag and gravity onto it to slow them down in the air and drag them down to the ground.
3. Rotation spin roll - is just giving a rotation at the start and the stopping it after a certain amount of seconds.
CONSTRAINTS
1. Collision via traces - this is causing the particles to hit and bounce the ground and then eventually also slide away at the end.
RENDERERS
1. Render sprites - This is just applying the star texture i have given, i am also setting the self illum so no shadows can be cast upon it and also adding some slight alpha onto it so its slightly transparent.
hopefully after reading through this you can now understand everything that is going on.
<note>if you find anything more that are useful for basic beginners missing from the tables please add it to the table with | | | | on a new line filling in the gaps</note>