Simulator
The Simulator shader is in control of updating the data of all Particles, it allows their position and velocity to react to different forces in real time and can also re-spawn particles under certain conditions.
This shader has to be used on the two Simulator GameObjects in the Quantum Particles prefabs.
If you want to change how the particles behave, interact, spawn or their movement patterns, this is the shader you will be working with.
Currently, every setup has two materials with this shader, one for each hand, this has a technical reason as at least two unique simulators are required, working in tandem, to make the simulation work.
Base Settings
Input Texture
Render Texture
containing the particle input data.
DO NOT remove this texture or edit the settings, unless you know what you are doing, without it the simulation will not work and the particles might not move or show up at all.
EXCEPTION: if you want to change the amount of particles, follow this guide: Change Particle Amount.
Simulator ID
Integer
containing the simulator ID, typically set to 0
for the left hand and 1
for the right hand.
DO NOT change this setting, unless you know what you are doing, otherwise the simulation will not work and the particles might not move or show up at all.
Simulator Count
Integer
containing the number of simulators, typically set to 2
for all current setups.
DO NOT change this setting, unless you know what you are doing, otherwise some features might break or will not work as intended.
Simulation Speed
Float
controlling the Speed of the simulation, typically set to 1.0
for normal speed.
This value will be used as a multiplier for all time based calculations, this means you can change this value to slow down or speed up the simulation.
Technically negative values will also work, but might have unexpected results.
Simulation Scale
Float
controlling the Scale of the simulation, typically set to 1.0
for normal scale.
This value will be used as a multiplier for all distance based calculations, this means you can scale up the simulation while keeping the same behavior for the particles.
This could be used to scale the particles with your avatar if you want the effects to look the same relative to your avatar's size.
Technically negative values will also work, but might have unexpected results.
Speed Loss
Float
value in the Range [0.0, 1.0]
, used to control how much of the velocity is approximately lost every second of the simulation.
A value of 1.0
means all speed will be lost over the span of a second, while a value of 0.0
means that speed will never be lost over time, this can have wild effects when forces keep acting on a particle and keep speeding them up, so choose carefully.
Due to varying precision with different frame rates this value can slightly fluctuate in different situations and hardware.
Speed Limit
Float
value in the Range [0.001, 1000.0]
, used to control the maximum speed a particle can have.
This value is used to prevent particles from moving too fast and potentially breaking the simulation or flying out of range.
After every simulation step the speed of a particle will be clamped to this value if it exceeds it, this will not affect the direction a particle can travel in, but particles traveling at the speed limit will react differently to forces.
Forces
Forces are what makes the particles act dynamically, they can be used to simulate attraction, repulsion, gravity, wind, drag, turbulence and many more effects. All forces can be toggled individually and have their own settings to control their strength and behavior.
The following settings are present for all forces:
Affect
Toggle
between a force affecting the Position
or the Velocity
of a particle.
When a force is applied to the Position
of a particle it will always be moved exactly as the force direction and strength dictates and will stop moving if the strength is zero.
When applied to the Velocity
of a particle it will keep accelerating towards the force direction while the strength is larger than zero and keeps moving even if the force is no longer present.
Typically a force would act on the Velocity of a particle, but if the speed loss is too large they might not be able to move at all, in this case you could try to apply the force to the position instead.
Use the Position
setting with caution if multiple particles will be moved to the same spot they might no longer separate afterwards.
Field Strength
Float
value in the Range [-100.0, 100.0]
, used as a basic multiplier for the force. Use this value if you want to for example make particles get attracted/repelled stronger/weaker.
Field Behavior
Toggle
between a Uniform
or Dynamic
force field.
A Uniform
force field will have the same strength no matter the distance, while a Dynamic
force field will use the following parameters to have a different strength dependent on distance.
The calculations for the Dynamic
force field are roughly as follows: clamp(pow(particleDistance + offset, falloff) * strength, -maxAttraction, maxAttraction)
and a graph showing the Force over Distance can be seen at the end of the force field settings.
Strength Falloff
Float
value in the Range [-100.0, 100.0]
, used as an exponent for the distance based strength falloff.
This means that for positive values the force will get stronger the further away a particle is from the source, while for negative values the force will get weaker the further away a particle is from the source.
A value of 0.0
will result in a constant force field strength, which is basically the same as setting the Field Behavior to Uniform
.
Distance Offset
Float
value between 0.0
and 1.0
, used to offset the distance calculation for the force field.
This means that the force field will act as if the particles are further away from the source than they actually are.
This is mainly useful if you don't want the flipped field strength behavior for distances below 1.0
.
Force Limit
Float
value in the Range [0.001, 1000.0]
, used to limit the maximum strength a force can have.
This is NOT related or connected to the speed limit and will only affect the maximum effect this specific force can have on a particle.
Force over Distance Graph
This graph shows the strength of the force field over distance, the x-axis represents the distance from the source and the y-axis represents the strength of the force. Both axes will scale dynamically to show the fully possible strength range of the force depending on the force limit.
The red lines represent the current sample point, for which the values will be displayed at the top right of the graph (D=Distance, F=Force). By double-clicking on the graph you can set a new sample point, which will update the red lines and corresponding values at the top right.
Attraction
Attraction Mode
- Point
- Shape
- Shape Offset
- Shape Dynamic Offset
- Shape Individual Offset
Position
Vector3
containing the position of the point to attract particles to.
This position is relative to the simulator GameObject and in local space.
Attraction Shape
Render Texture
or Shape Texture
containing positions for each individual particle to be attracted to.
Attraction Shape
Render Texture
or Shape Texture
containing positions for each individual particle to be attracted to.
Offset
Float
used as an offset for indexing the positions in the shape texture. For example this can be used to attract particles to a different position in the same shape texture.
Attraction Shape
Render Texture
or Shape Texture
containing positions for each individual particle to be attracted to.
Change Speed
Float
used as an offset over time for indexing the positions in the shape texture. Having a value of 1.0
will make the particles be attracted to a different position every second.
Attraction Shape
Render Texture
or Shape Texture
containing positions for each individual particle to be attracted to.
Offset Texture
Offset Texture
containing individual offsets for each particle to be used for indexing the positions in the shape texture.
This can be used for example to make the particles follow each other in a very specific structure.
Directional
Shape Mode
- Uniform
- Funnel
- Coilgun
Direction
Vector3
containing the direction of the force.
The length of this vector is irrelevant, only the direction will be used, so a vector like (0.0, 1.0, 0.0)
will have the same effect as (0.0, 1000.0, 0.0)
.
Space
Toggle
between World
and Local
space for the direction of the force.
In World
space the direction will be relative to the world, while in Local
space the direction will be relative to the simulator GameObject.
Direction
Vector3
containing the direction of the force.
The length of this vector is irrelevant, only the direction will be used, so a vector like (0.0, 1.0, 0.0)
will have the same effect as (0.0, 1000.0, 0.0)
.
Cone Width
Float
value in the Range [0.0, 100.0]
, used to control the width of the funnel cone.
Every particle outside of this cone will be attracted towards the center of the cone, while particles inside the cone will be moved in the direction of the cone.
Inward Strength
Float
value in the Range [0.0, 1.0]
, used to control how much the particles will be attracted towards the center of the cone rather than the direction of the cone.
Gradient Length
Float
value in the Range [0.0001, 100.0]
, used to control the length of the gradient from particles being attracted directly to the center of the cone to particles being attracted in the direction of the cone.
This value is measured from the surface of the cone outwards.
Space
Toggle
between World
and Local
space for the direction of the force.
In World
space the direction will be relative to the world, while in Local
space the direction will be relative to the simulator GameObject.
Direction
Vector3
containing the direction of the force.
The length of this vector is irrelevant, only the direction will be used, so a vector like (0.0, 1.0, 0.0)
will have the same effect as (0.0, 1000.0, 0.0)
.
Cone Width
Float
value in the Range [0.0, 100.0]
, used to control the width of the coilgun cone.
Particles inside this cone will be moved in the direction of the coilgun, for particles outside of this cone the force depends on their position relative to the starting point of the coilgun.
Particles in front of the coilgun will be brought back in a circle around the coilgun starting point, while particles behind the coilgun will be pushed towards the coilgun center.
Space
Toggle
between World
and Local
space for the direction of the force.
In World
space the direction will be relative to the world, while in Local
space the direction will be relative to the simulator GameObject.
Rotational
Rotation Axis
Vector3
containing the axis of rotation for the force.
The length of this vector is irrelevant, only the direction will be used, so a vector like (0.0, 1.0, 0.0)
will have the same effect as (0.0, 1000.0, 0.0)
.
Inwards Angle
Float
value in the Range [-1.0, 1.0]
, used to control the angle of rotation for the force.
This is NOT the angle of rotation, but instead controls how much the particles will be rotated towards the axis of rotation and the direction (clockwise for positive and counter-clockwise for negative values). A value of -1.0
or 1.0
will rotate the particles fully towards the axis.
Distance Factor
Float
value in the Range [0.0, 1.0]
, used to determine how much the distance from the axis of rotation will affect the rotation.
A value of 0.0
will result in no distance based scaling, while a value of 1.0
will have the distance multiplied with the rotation strength.
Distance From
Toggle
between the Point
or the Axis
of rotation for the distance calculation.
When set to Point
the distance will be calculated from the position of the simulator GameObject, while when set to Axis
the distance will be calculated from the axis of rotation.
Space
Toggle
between World
and Local
space for the direction of the force.
In World
space the direction will be relative to the world, while in Local
space the direction will be relative to the simulator GameObject.
Turbulence
The Turbulence force can be used to create chaotic movement patterns for the particles and introduce some natural randomness to the simulation.
Density
Vector3
containing the density of the turbulence.
This value controls how much the Turbulence will change over a given area, a higher value will result in more chaotic movement, while a lower value will result in more uniform movement.
Panning
Vector3
containing the panning of the turbulence.
This value controls how and in what direction the Turbulence will move over time, a higher value will result in faster movement.
Time Dependent
Checkbox
to toggle if the Turbulence should be time dependent.
When enabled the Turbulence will change over time, while when disabled the Turbulence will be static.
Change Speed
Float
used to control how fast the Turbulence will change over time.
Space
Toggle
between World
and Local
space for the direction of the force.
In World
space the direction will be relative to the world, while in Local
space the direction will be relative to the simulator GameObject.
Drag
The Drag force can be used to drag the particles around using the simulator GameObjects movement.
When combined with a Uniform
field of strength 1.0
and both positional and rotational drag, this can be used grab and move particles around as if they were attached to the simulator GameObject.
Drag Mode
- Position
- Rotation
- Both
Only the positional change of the simulator GameObject will be used to drag the particles around.
Only the rotational change of the simulator GameObject will be used to drag the particles around.
Both the positional and rotational change of the simulator GameObject will be used to drag the particles around.
Particle Spawning
In the Particle Spawning section you can control how particles are spawned, this includes where they are spawned, how they move and how long they live.
The Quantum Particles system will always have a fixed amount of particles, so it would be more accurate to say that particles are re-spawned rather than spawned.
Even after a particle "dies" it will still be part of the simulation, but might be invisible depending on the visualizer settings.
This is why in the following some values can be set to Keep
, which means that the value will be kept from the previous particle life cycle.
Data Sources
You can either use a Single Texture
for all particle data or use Multiple Sources
for different data types like position, velocity, age and life.
Shape Texture (Single Texture
Mode)
Shape Texture
or Render Texture
containing all the data for the particles to be spawned.
Position Source
All position sources are relative to the simulator GameObject and in local space, except for the Texture which can be toggled between local and world space.
- Keep
- Texture
- Point
- Line
- Sim Line
- Sphere
- Box
Position will be kept from the previous particle life cycle.
Position Texture
Render Texture
or Shape Texture
containing positions for each individual particle.
Position
Vector3
containing the position to spawn particles at.
Start Position
Vector3
containing the start position of the line to spawn particles on.
End Position
Vector3
containing the end position of the line to spawn particles on.
Start Position
Vector3
containing the start position of the line to spawn particles on.
End Position Simulator
Integer
containing the simulator ID of the simulator GameObject that will be used as the end position of the line to spawn particles on.
Radius
Float
value used to control the radius of the sphere to spawn particles in.
Position
Vector3
containing the position of the sphere to spawn particles in.
Rotation
Vector3
containing the rotation of the sphere to spawn particles in.
A full rotation can be achieved by values from 0.0
to 1.0
for each axis.
Scale
Vector3
containing the scale of the sphere to spawn particles in.
Velocity Source
- Keep
- Texture
- Value
- Range
- Sphere
- Position
Velocity will be kept from the previous particle life cycle.
Velocity Texture
Render Texture
or Shape Texture
containing velocities for each individual particle.
Velocity
Vector3
containing the velocity to spawn particles with.
Rotation Space
Toggle
between World
and Local
space for the velocity of the particles.
In World
space the velocity will be relative to the world, while in Local
space the velocity will be relative to the simulator GameObject.
Min Velocity
Vector3
containing the minimum velocity to spawn particles with.
Max Velocity
Vector3
containing the maximum velocity to spawn particles with.
Separate Axes
Checkbox
to toggle if the values for the velocity should be chosen for each axis separately.
This means that for example the X-axis can have it's minimum value while the Y-axis has it's maximum value.
Rotation Space
Toggle
between World
and Local
space for the velocity of the particles.
In World
space the velocity will be relative to the world, while in Local
space the velocity will be relative to the simulator GameObject.
Speed
Float
value giving the speed of the particles to spawn.
The direction of the velocity will be random and uniform on the surface of a sphere with the given speed.
If the distribution of the speed is not uniform enough you can enable the Better Quality Noise
setting.
Speed
Float
value giving the speed of the particles to spawn.
The direction of the velocity will be from the position of the simulator GameObject to the position of the particle.
Central Distance Factor
Float
value which will be multiplied with the distance from the simulator GameObject to the particle.
This can be used to control how much the speed will be affected by the distance.
Negative values will result in the particles moving towards the simulator GameObject.
Starting Age Source
- Keep
- Texture
- Value
- Range
Age will be kept from the previous particle life cycle.
Starting Age Texture
Render Texture
or Shape Texture
containing starting ages for each individual particle.
Starting Age
Float
value in the Range [0.0, 1000.0]
giving the starting age of the particles.
Lifetime Source
- Keep
- Texture
- Value
- Range
Lifetime will be kept from the previous particle life cycle.
Lifetime Texture
Render Texture
or Shape Texture
containing lifetimes for each individual particle.
Lifetime
Float
value in the Range [0.001, 1000.0]
giving the lifetime of the particles.
Particle Re-Spawn Check
- All
- Partial
All particles will be checked every frame.
Only a fraction of the particles will be checked every frame.
Spawn Rate
Float
value giving the fraction of particles to be checked every second.
Time Error Compensation
Float
value in the Range [0.0, 1.0]
used to compensate for timing errors.
This value is used to compensate for the small fluctuations in frame rate and time passed between frames.
A value of 0.5
will result in 50% more particles being checked every second.
Respawn Conditions
- Always
- Conditions
Particles will always be re-spawned, no matter the state they are in.
Particles will only be re-spawned if they meet the following conditions. Each type of data like position, velocity, age and lifetime can have a different condition to be met.
Position Conditions
- Off
- Range
- Distance Smaller
- Distance Larger
- Distance Range
The position of the particles will not be checked.
Position Below
Vector3
containing the position below which the particles will be re-spawned.
Position Above
Vector3
containing the position above which the particles will be re-spawned.
Distance Below
Float
value used to control the distance below which the particles will be re-spawned.
Distance Above
Float
value used to control the distance above which the particles will be re-spawned.
Velocity Conditions
- Off
- Smaller
- Larger
- Range
Age Conditions
- Off
- Larger
The age of the particles will not be checked.
Age Above Lifetime
Float
value used to control the age above which the particles will be re-spawned.
This value is relative to the lifetime of the particles, this means that a value of 1.0
will be the full lifetime of the particles.
Infinite Lifetime
Checkbox
to toggle if particles with an infinite lifetime should be re-spawned.
This might be necessary when particles have never been re-spawned before.
Sampling Offset
This setting controls how the data for the particles is sampled from the input textures.
- None
- Constant
- Dynamic
- Individual
No offset will be used for sampling the data.
Constant Offset
Float
value used as an offset for sampling the data.