DESIGNING PARTICLE TYPES
|
This is the most creative part -designing a particle type.
This is done by creating a new particle type and specifying
it's parameters. First of all, here's an example
definition of a nice looking smoke particle type:
; SMOKE EXAMPLE
P1 = CreateParticleType()
ParticleType_SetImage P1,4
ParticleType_SetSpeed P1,5,2
ParticleType_SetSize P1,1,1,2,3
ParticleType_SetAlpha P1,.7,.5,-.8
ParticleType_SetWeight P1,-1,.5
ParticleType_SetRotation P1,1,90
ParticleType_SetColor P1,125,125,140,60,-50,-50,-55
ParticleType_SetInnerAngle P1,0
ParticleType_SetOuterAngle P1,75
ParticleType_SetLifeTime P1,1500
ParticleType_SetBounce P1,-5,1,10
ParticleType_SetAddedBlend P1,0
; ATTACH TO AN EMITTER & LAUNCH:
MyEmitter = CreateEmitter()
Emitter_AddParticleType MyEmitter, P1, 0,5000,75
Emitter_Start MyEmitter
|
COMMANDS TO DEFINE A PARTICLE TYPE
|
|
|
Handle%
= CreateParticleType()
|
| This will create a simple default particle type and return an integer handle to it. You will need this handle with all the following commands. |

|
ParticleType_SetImage
Handle%, ImageFrame%
|
| Handle% |
Handle of an existing particle type. |
| ImageFrame% |
Cell / frame number of the particle texture file. Default frame number is always 1 (the first top-left frame of the texture file). |

|
ParticleType_SetSpeed
Handle%, Speed#, Variation#, Change#
|
| Handle% |
Handle of an existing particle type. |
| Speed# |
The amount of units (per second) the particle should move. A value of 1, for example, means that the particles will travel 1 Blitz unit within the time of a second. |
| Variation# |
Moving all particles with exactly the same speed wouldn't look very realistic. Use this value to add some variation. A value of .5, for example, would add a tolerance from -.5 to .5 to the previously given speed value. |
| Change# |
This will change the particles' speed over time. Using this (optional) parameter, you can slow down the particle movement (like a firework burst, for example) or speed it up. A value of -1.0, for example, will slow down the movement at one Blitz3D unit per second. |

|
ParticleType_SetRandomSpeed
Handle%, SpeedX#, SpeedY#, SpeedZ#
|
| Handle% |
Handle of an existing particle type. |
| SpeedX# |
A value that will be added or substracted randomly to the particles x-velocity each time the particle is updated. Useful to create chaotic particle effects like windy snow etc. Use very low values here, like 0.05 or 0.1 |
| SpeedY# |
Same as above but affects the particle's y-velocity. |
| SpeedZ# |
Same as above but affects the particle's z-velocity. |

|
ParticleType_SetSize
Handle%, Size#, Variation#, Change#, MaxSize#
|
| Handle% |
Handle of an existing particle type. |
| Size# |
The initial particle size. |
| Variation# |
This value will be randomly added or subtracted to the initial size of each particle. Use this if you'd like to vary the size of the particles randomly within that given range. |
| Change# |
This value will change the particles' size over time. A value of 5 will enlarge the particles of five units within the time of one second. Higher values will speed this up. Negative values will let them shrink, of course. Particles with a size of 0 or below will be deleted automatically. |
| MaxSize# |
If you don't want the particles to exceed a maximum size, indicate a size limit here. When reached this limit, the particles will just stop growing. |

|
ParticleType_SetAlpha
Handle%, Alpha#, Variation#, Change#
|
| Handle% |
Handle of an existing particle type. |
| Alpha# |
The initial alpha (transparency) value of the particles. Use values from 0.1 (almost invisible) to 1.0 (solid). Particles will be deleted automatically when reached an alpha value of 0.0, so you should use an initial value of 0.1 for example, if you'd like to start your particles invisible and fade them in slowly. |
| Variation# |
This value will be randomly added or subtracted to the initial alpha value of each particle to add some variation. |
| Change# |
This value will change the particles' visibility over time. A value of -.5, for example, will fade-out the particles at 50% within the time of one second. A positive value will let them fade-in. |

|
ParticleType_SetWeight
Handle%, Weight#, Variation#
|
| Handle% |
Handle of an existing particle type. |
| Weight# |
This value indicates, how much a particle type will be influenced by gravity. A value of 0 will deactivate gravitation for this particle type. A value higher than 0 will make it 'heavy', a value below 0 will cause it to travel upwards (smoke, flames, bubbles, for example). |
| Variation# |
This value will be randomly added or subtracted to the weight value of each particle to add some variation. |

|
ParticleType_SetRotation
Handle%, Mode%, Value#
|
| Handle% |
Handle of an existing particle type. |
| Mode% |
Use one of the following values here:
0 - The rotation angle of all particles will be set to a given value (the VALUE parameter) and not be changed anymore.
1 - Each particle will be set to a random start rotation and will rotate automatically with a speed specified by the VALUE paramter.
2 - The particles will always be aligned to their travel direction. This may be very useful to simulate sparks, for example. Should be only used with textures that look very similar to a line stroke -other textures may disturb this effect. Just try it. |
| Value# |
The effect of this parameter depends on the rotation mode used:
If mode 0 is used, this parameter will indicate the absolute rotation angle for all the particles.
If mode 1 is used, this value indicates how much the particles will be rotated automatically within the time of one second. Positive values will let them rotate clockwise, negative counter-clockwise, higher values will increase rotation speed.
If mode 2 is used, this value becomes needless, since the particles' rotation will always depend to their current travel direction. |

|
ParticleType_SetHorizontalAlign
Handle%, Mode%
|
| Handle% |
Handle of an existing particle type. |
| Mode% |
Use one of the following values here:
0 - The particles will always face the camera (default).
1 - The particles will be rotated at 90 degrees on their X-axis to be placed horizontally, looking up to the 'sky' (like paper sheets lying on the ground, for example). You can use this effect to simulate rings on a water plane. |

ParticleType_SetColor
Handle%, R%, G%, B%, Variation%, R-Change#, G-Change#, B-Change#
|
| Handle% |
Handle of an existing particle type. |
| R%, G%, B% |
The initial red, green and blue color values of this particle type. Use integer values from 0 to 255 here. |
| Variation% |
This value will darken or brighten the specified color randomly for each particle within that given range. Use a value between 0 (no brightness variation) and 255 (very different variations of the specified color). |
R-Change# G-Change# B-Change# |
These values will change the particles red, green and blue color channel within the time of one second. If you use a RCHANGE value of -50, for example, the particle's red color amount will shrink at 50 units within a second. Higher values will increase the color change speed. Using this parameters together with the initial RGB values produces color fades and gradients over time. |

|
ParticleType_SetStartOffsets
Handle%, X-Start#, X-Width#, Y-Start#, Y-Width#, Z-Start#, Z-Width#,
|
| Using this command, you can specify the size and offset of the emission area around the emitter. Use this, together with ParticleType_SetEmissionShape( ), if you want your particles to be emitted within an area or along a ring instead from a single point only. |
| Handle% |
Handle of an existing particle type. |
| X-Start# |
This value defines an x-offset from the emitter's center. |
| X-Width# |
This value defines the width of the emission area, counted from the X-Start value. |
| Y-Start# |
Same as the X-Start value but sets the y-offset. |
| Y-Width# |
Same as the X-Width value but specifies the width of the emission area along the Y-axis. |
| Z-Start# |
Same as the X-Start value but sets the z-offset. |
| Z-Width# |
Same as the X-Width value but specifies the width of the emission area along the Z-axis. |

|
ParticleType_SetEmissionShape
Handle%, Mode%
|
| Handle% |
Handle of an existing particle type. |
| Mode% |
This value determines if the particles will be emitted from a single point, within an area, or along a ring, for example. Use the following values here:
0 - (Area) Particles will be spread within an area (default). The size of this area is defined by the command ParticleType_SetStartOffsets( )
1 - (Point) Particles will be emitted from a single point (the emitter's top). Start offset values will be ignored.
2 - (Ring) Particles will be emitted along a ring. The inner and outer radius of this ring are defined by the command ParticleType_SetStartOffsets( )
3 - (Line) Particles will be emitted along a line. You can set the start and width of this line using ParticleType_SetStartOffsets( ). For example: ParticleType_SetStartOffsets(-5,10,0,0,0,0) together with an emisson shape value of 3 (line-style) will spread the particles on a line that starts -5 units to the left of the emitter and is 10 units width. |

|
ParticleType_SetInnerAngle
Handle%, Angle#
|
| Handle% |
Handle of an existing particle type. |
| Angle# |
This value determines the start angle of the emission, seen from the 'top' of the emitter (it's Y-axis). It's the minimum angle of the emission fan.
Example: if you use ParticleType_SetInnerAngle with an angle of 45 and ParticleType_SetOuterAngle with an angle of 90, all particles will be spread in a fan that starts at 45 degress and stops at 90 degress from the emitter's Y-axis. You can use the inner angle to create a 'hole' in the middle of the emission fan. The inner and outer angle values depend very much on the emission shape you set.
|

|
ParticleType_SetOuterAngle
Handle%, Angle#
|
| Handle% |
Handle of an existing particle type. |
| Angle# |
This value determines the maximum angle of the emission, seen from the 'top' of the emitter (it's Y-axis). It's the maximum angle of the emission fan. |

|
ParticleType_SetCircularMotion
Handle%, DegreesPerSecond#
|
| Handle% |
Handle of an existing particle type. |
| DegreesPerSecond# |
Degrees per second to rotate around the emitter.
This command activates a circular or helix-type movement for a particle type. The particles will rotate around the emitter's Y-axis at the speed you specified with the second parameter. If you set a value of 360 here, for example, all particles will rotate at 360 degrees (a full turn) per second around the emitter's emission axis (Y-axis).
|

|
ParticleType_SetLifeTime
Handle%, MilliSeconds%
|
| Handle% |
Handle of an existing particle type. |
| MilliSeconds% |
The maximum lifetime of a particle in milliseconds, counted from the moment of its emission. Note: a particle may also be deleted automatically, before its maximum lifetime has exceeded. This happens when a particle becomes invisible (alpha or size < 0, for example). So remember: this will be the MAXIMUM lifetime of the particle. |

|
ParticleType_SetBounce
Handle%, GroundHeight#, Elasticity#, MaxBounces%
|
| Handle% |
Handle of an existing particle type. |
| GroundHeight# |
This specifies a Y coordinate where the particle will be reflected. Set this value to the Y coordinate of your floor or terrain, for example. This command does not use collision tests, so using it won't speed down anything.
Note: If ground height is set to 0.0 or 0, bouncing will be deactivated (default)! If your ground is positioned on an Y-coord of 0, use 0.1 or -0.1, for example.
|
| Elasticity# |
This specifies the 'bouncyness' of a particle. A value of .5 will cause a particle to lose the half of its Y velocity when reflected. A value of 1 will let a particle bounce forever (it will not lose any momentum when reflected) and a value of 0 will cause a particle not to be reflected. If using values higher than 1, the particle will even gain speed with each floor reflection (funny, but not recommended). |
| MaxBounces% |
This parameter sets the maximum number of bounces for a particle. If set to 3, the particle will be deleted automatically on its third bounce. |

|
ParticleType_SetPulsation
Handle%, Strength#
|
| Handle% |
Handle of an existing particle type. |
| Strength# |
Use this for flickering effects. A strength value of .5, for example, will alter each particle's size randomly within a range of -.5 and +.5 per frame which produces a flickering effect. Use this for electric sparks, glowing flares, etc. |

|
ParticleType_SetTrail
Handle%, AnotherHandle%, Delay%, Duration%, EmissionRate%
|
|
This allows you to use any another particle type as a particle trail. If using this command, each particle will emit sub-particles of that type during its lifetime. Very useful for smoke- or fire trails.
|
Note: use this effect with caution only! It may produce very large particle amounts at once! Keep the emission rates of both, the parent and the trail particle,
as low as possible.
|
|
| Handle% |
Handle of an existing particle type. |
| AnotherHandle% |
A particle type that should be used as trail particles. NOTE: This particle type must already exist, so always create the trail particle type first. |
| Delay% |
The delay time, in milliseconds, the trail emission should start (counted from the creation time of the parent particle). |
| Duration% |
The emission duration in milliseconds. |
| EmissionRate% |
Indicates the number of trail particles emitted within the time of one second. |

|
ParticleType_RemoveTrail
ParticleType%
|
|
This will remove any previously attached particle trail from a particle type. |
| ParticleType% |
Handle of an existing particle type that has a particle trail attached. |

|
ParticleType_SetAddedBlend
Handle%, BlendMode%
|
| Handle% |
Handle of an existing particle type. |
| BlendMode% |
Use the value 0 if the particles should be solid (f.e. rocks) or a value of 1 if you'd like to create transparent or light-emitting particle types like fire, smoke, etc. |

|
ParticleType_SetNearCameraFade
ParticleType%, radius#
|
| ParticleType% |
Handle of an existing particle type. |
| radius# |
The radius around the camera where particles should start to fade out. The particles of the specified particle type will fade to transparent when inside this radius and become as more transparent as closer they move to the camera. Using this command, you can simulate a flight through a cloud bank, for example where the cloud particles slowly disappear instead of 'popping away' in front of the camera. |

Now, after designing one or more particle types, you can attach
them to an emitter and launch it at any time:
MyEmitter = CreateEmitter()
Emitter_AddParticleType MyEmitter, ParticleType, 0,5000,75
Emitter_Start MyEmitter
|
|