Nuclide
Software Development Kit for id Tech
|
Particles, part of a particle system, are sprites/models in 3D space that simulate impacts and other chemical reactions. They can be used for a variety of use cases - most commonly they're used for explosions, bullet impacts and smoke.
In Nuclide we are happy to use the built-in engine particle system.
The particle system in FTEQW is quite advanced despite its use of a plaintext scripting format.
By default, particle definitions are read from either the game/mod its default.cfg
file, or from <gamedir>/particles/default.cfg
.
The path can be changed by overriding the console variable r_particledescr
. The scripted particle system is also only available when r_particlesystem
is left to the default value of script
.
Particles are similar to Materials in the way they are written. However they can be injected into any config file and have a completely different set of commands.
The above example will give transparent (0.5) red particles that will fade to fully white when they go fully transparent 2 seconds later. They will spawn within a ball of 32 units radius.
For inspiration or help in experimentation, it's best to look at particle configs in existing games.
Always try to include a type. The engine will guess what your particle is meant to be otherwise, based on textures and other factors.
You can add multiple particle descriptions to a single effect. The first should be r_part foo
, and the others should be r_part +foo
. Particles without a + will reset the chain.
Effects set by r_particledesc
will be given an internal prefix,
eg: foo.cfg
.
If the gamecode or entityDef explicitly states foo.bar
, your foo.cfg
will
automatically be executed, and will automatically use the bar
effect from it.
The effect can still be overriden from a custom config by explicitly naming
the effect foo.bar
- the effect bar
in the config foo
will not override
this, but would override bar
on its own.
Such values are defined in 1/4th qu, for some reason. The value of scalefactor
typically needs to be explicitly set to 1
. This value affects how the particle scales with distance from view, rather than
the actual size of the particle.
Specifies to use an image named <TEXTURENAME>
for this effect.
For example: texture "gfx/particles/explosion.tga"
Specifies to use a named material, instead of a texture sample. The name is a misnomer, it does not affect a programmable shader to use,
but a 'Q3A Shader' which are now just referred to as Materials.
If matbody
is included (as a nested block on the following line) then that material text will be used to create the material if it doesn't otherwise exist in memory.
This overrides blend modes specified using the blend <mode> command.
Specifies to use a subsection of the image.
If tscale
is set, all units are divided by this. it is the virtual size of your texture.
So a value of 1
means that your texture coords must be between 0
and 1
.
But if it properly matches your texture's size, the coords are in pixels.
If rsmax
is present, each particle will use a random image.
These images must be on a single row in your particle font.
The rsstep
value specifies the stride (gap from one to the next) in your particle font, and is only needed if rsmax
is present and greater than 1
.
An alternative to tcoords.
The specified texture (or shader) is to be considered as a grid of sprites (x times x, where x is specified by count_in_each_axis
).
Value of firstidx
specifies the first image to use (horizontal, then vertical).
Value of last
specifies the last image to use (inclusive).
The engine will pick one at random. They should not span multiple rows.
The particle will start with a rotation rotated between startmin
and startmax
. It will then rotate with some per-particle value randomly picked between the speedmin
+speedmax
values.
@important Should not be used on type beam
particles.
Specifies the number of game units per beam texture repetition.
Controls how fast the texture scrolls on the beam.
type beam
.Particles will start with a diameter of this many game units.
Actual scale will be randomly chosen between min
and max
. The max
defaults to equal if min
is missing.
Controls how the particle scales with distance. Value of 1
makes the particle scale the same as anything else. Value of 0
makes the particle not change size no matter how far it is.
Controls how spark particles stretch according to their velocity. Negative values give fixed length sparks.
Controls how the particle scales over time. Specifies the change in the particle scale per second.
type decal
particles are unable to use this parameter.Specifies the distance between each particle in the trail (or beam).
Specifies how many particles are spawned per effect.
Some classic effects contain an extra scaler which is multiplied by the resulting value.
Specifies the initial alpha value of the effect.
Specifies a randomized additonal value added to each particle's initial alpha.
Specifies how much the alpha value of the effect changes per second (subtracted).
Specifies the maximum age of the particle. In seconds.
Controls how fast the particle moves when it spawns (according to its spawn pattern). This works regardless of any requested velocities.
If vert
is not specified, horiz
is used instead.
Controls how much of the effect's spawn velocity is used, can be greater than 1
, or negative.
Biases how much to add to the starting origin relative to the requested velocity.
Biases the particle's origin by this absolute worldspace vector, regardless of spawn mode.
Biases the particle's velocity by this absolute worldspace vector, regardless of spawn mode.
Randomised offset for the particle's origin, in worldspace.
Randomised offset for the particle's origin, in worldspace.
Proportion of the particle's speed that should be lost from friction. Negative values are accepted.
Amount that the particle's velocity changes per second, in game units.
How much of the particle's velocity to use if the particle is clipped. See cliptype <effectname>. Defaults to 0.8
.
Specifies which new effect to spawn when the particle hits something.
The origin and velocity of the particle are used to spawn the new effect.
The clipbounce value is used as a scaler for the reflected velocity.
If the effect named is the effect itself, the particle will merely bounce, instead of spawning a new effect.
The scaler to use for the number of particles to spawn upon a clip event. Only valid in conjunction with cliptype.
Specifies another effect to spawn at the same time that this effect is spawned. Thus allowing two sets of particles from one effect.
Specifies that this particle should only be spawned when out of water.
The particle will not spawn under water (this does not affect assoc chains).
Content names are a space-separated list of: water slime lava sky solid fluid
. Default is fluid
if not specified.
The r_part_contentswitch
cvar must be enabled for this to function correctly.
Specifies that this particle should only be spawned when underwater. The inverse of notunderwater [content names].
Adds a palette index between 0
and 3
, based on the particle index in the effect or trail.
colorindex
is set.Specifies the initial red, green, and/or blue values for each particle. Fully opaque is 255
or above. Values above 255
are valid, but will remain opaque until the value drops below 255 from the color deltas. The rgbf form takes values scaled by `1` instead of `255`.
Specifies how much extra red, green, and/or blue there may be for particles. The initial color will be multiplied by this amount before addition. Each componant is separately randomized. EG, red might add nothing, while the full green is added, and only half the blue. Fully opaque is 255
or above. The rgbrandf form takes values scaled by `1` instead of `255`.
Specifies how much extra red, green, and/or blue there may be for particles. The initial color will be multiplied by this amount before addition. Componants are syncronised. EG, if the full amount of red is added, the full amount of green and blue will also be added. Fully opaque is 255
or above.
Specifies how much the red, green, and/or blue values of each particle change over time. The value 255
is the value required to go from opaque to invisible in 1
second.
Specifies for how long the particle may change colors for. After this many seconds, the particle may no longer change colors (delta becomes 0).
Mode may be one of:
if not none, the ramp index used is based upon the particle's age, its lifetime, and how many ramp elements there are.
Scale used is the currently set scale value. Specifies a set of palette index values to use for the effect as part
of the effect's color ramp.
Specifies an individual palette index value and particle scale to use for the effect as part of the effect's color ramp
Specifies a ramp index in rgb terms, regardless of palette.
How much the effect discolors the wall upon impact. The stained color is based upon the color of the particle upon impact.
If the texture used is actually a material then its blend mode will take precedence.
The mode
value may be one of the following:
blend
- Blend based on alpha channel. Default.blendalpha
- Blend using alpha. Same as blend
.blendcolor
- Blend using colors. If a pixel in the particle texture is black, then the background is fully visible. Equivalent to OpenGL blend mode GL_SRC_COLOR, GL_ONE_MINUS_SRC_COLOR
.add
- Additive blend using alpha. Equivalent to OpenGL blend mode GL_SRC_ALPHA, GL_ONE
.adda
- Same as add
.addc
- Additive blend using color. Equivalent to OpenGL blend mode GL_SRC_COLOR, GL_ONE
.subtract
- Subtract color from background, using particle texture's alpha.invmoda
- Inverted add
and adda
. Equivalent to OpenGL blend mode GL_ZERO, GL_ONE_MINUS_SRC_ALPHA
.invmodc
- Inverted addc
. Equivalent to OpenGL blend mode GL_ZERO, GL_ONE_MINUS_SRC_COLOR
.premul_blend
- Like blend
but pre-multiplied.premul_subtract
- Like subtract
but pre-multiplied.premul_add
- Like add
but pre-multiplied.rtsmoke
- Blended and lit with realtime lighting, instead of being unlit.This affects how particles are positioned when they first spawn, and their initial velocities.
For point-based effects, mode may be one of:
For trail-based effects, mode may be one of:
Sets how the particles look.
Options for modes are:
The two extra args allow you to spawn these decals ONLY on surfaces with matching surfaceflags.
Separation of mask+match allows you to create many descrete surface types instead of being limited to 32 bits/types.
Specifies the effect to periodically emit.
Particles will not emit additional effects for this duration after emitting one.
Adds an amount of randomness to the emit interval.
Prevents the particle from emitting anything for this duration when it first spawns.
Specifies that this particle type should move relative to the camera.
@important Should not normally be used in combination with clipping/bouncing.
Apply inverse frametime to count (causes emits to be per frame).
Average trail points from start to end, useful with effects like t_lightning
, etc
Causes the particle system to ignore all state information.
Don't randomize org/vel for first generated particle.
Don't randomize org/vel for last generated particle.
When the effect is first spawned, the named sound will play with the given volume
and attenuation at the center point.
This may not work with all spawn methods, as it will ignore any count scales.
Spawns a dlight when the effect is spawned. Dlight is removed when radius drops to 0 or the age is exceeded.
How fast the light radius shrinks per second.
Dynamic light colors. The value of 1
equals white. Higher values can over-saturate.
How fast lightrgb changes over time.
Specifies the maximum lifetime of your dlight.
Set to 0
for no cubemap. Otherwise with e.g. cubemap 5
, uses image files cubemaps/5ft.tga
, cubemaps/5bk.tga
, etc.
multipliers for the rtlight's various types of lighting.
Can be 0
or 1
, specifies whether the dynamic light will cast shadows or not. It's faster if it doesn't. So the default is 0
.
Gives the light being cast a corona at the specified intensity and size, in game units.
Spawns sprites or models that fly away with random angles and run through some frame sequence. Handy for simple gib effects.
Plays a sound when the effect is spawned. Only one sound will be used, picked randomly from the included sounds according to their weights.
options are:
Controls whether a stain will be created at the same time as any particles,
instead of depending upon impacts.
Specifies the interval between spawning new particle puffs on surfaces.
These particles will periodically all change their direction, in a vauge attempt to approximate snow flurries.
Will ask Nuclide to list all currently precached particle effects.