The particle_system section represents a particle system. By default, the particle system object serves as a preview and cannot be used any further. The particle_system section can however be combined with the keyword animation, making the render available as a texture in the remainder of the script, but forcing it to have a fixed resolution, specified by the dimensions modifier.

Its syntax can be one of:

particle_system <name> : <modifier1, modifier2, ...>;
particle_system animation <name> : <modifier1, modifier2, ...>;

The available modifiers are listed below.


You can specify a subset of the following modifiers. Only the vertex specification, update function, and count is mandatory.

  • count(<N>) – specifies how many particles to process and draw
  • particle_data(<type>) – specifies the data type that will be used to store data of each individual particle. The type can only be float, vec2, vec3, vec4, or a simple structure consisting of these types.
  • fragment_data(<type>) – specifies the data type that will be used to transfer data between the vertex and fragment shader. The type can only be float, vec2, vec3, vec4, or a simple structure consisting of these types. The value passed to the fragment function will be interpolated based on proximity to each vertex like OpenGL varyings.
  • initialize(<function>) – specifies the function that computes the initial particle data. Its first parameter is the output particle data, and the second is an integer index of the particle. If no initialize function is specified, the particle data will be zero initialized.
    void initializeFunction(out ParticleDataType particleData, int particleIndex);
  • update(<function>) – specifies the function that updates the particle data in every frame. Its first argument is the input/output particle data parameter, and the second argument is the time elapsed between this frame and the previous frame.
    void updateFunction(inout ParticleDataType particleData, float deltaTime);
  • vertex(<function>, <primitive type>, <vertex count>) – specifies the sequence of each particle's vertices. function is a function that receives the particle data and the index of the current vertex as int and returns that vertex's gl_Position (vec4) – meaning that any coordinate transformations must be applied in this function. If fragment_data has been specified (as non-void), the function's first argument must be an output parameter of fragment data type. The possible primitive types are points, lines, line_strip, line_loop, triangles, triangle_strip, and triangle_fan.
    vec4 vertexFunction(out FragmentDataType fragmentData, in ParticleDataType particleData, int vertexIndex);
    vec4 vertexFunction(in ParticleDataType particleData, int vertexIndex); // if no fragment data type set
  • fragment(<function>) – specifies the function that computes the fragment color and returns it as vec4. If fragment_data has been specified (as non-void), the function has one parameter – the fragment data. Otherwise it has no parameters. If no fragment function is specified, all particles will be rendered solid white.
    vec4 fragmentFunction(in FragmentDataType fragmentData);
    vec4 fragmentFunction(); // if no fragment data type set
  • update_rate(<updates per second>) – sets how often the particles are updated. If unset, they will be updated every frame, which are synchronized with the monitor's refresh rate.
  • background(<color>) – specifies the background color, which is used to fill the viewport before drawing the model. Black with zero alpha is the default
  • blend(<mode>) – specifies the blending mode to be used. The possible values are:
    • none
    • transparency
    • transparency_premultiplied
    • additive
    • multiplicative
    • min
    • max
  • depth(<true / false>) – enables or disables the depth buffer (disabled by default)
  • cull(<true / false>) – enables or disables backface culling (disabled by default)
  • wireframe(<true / false>) – enables or disables wireframe mode (disabled by default)
  • multisample(<factor>) – enables (>0) or disables (0) multisample anti-aliasing. The value of the argument is the maximum number of samples per pixel

Animation modifiers

The following modifiers are only available with the animation keyword.

  • dimensions(<width, height>) – specifies the dimensions of the viewport
  • filter – see animation filter modifier
  • map – see animation map modifier
  • hidden – see animation hidden modifier
  • resizable – see animation resizable modifier
  • full_range – see animation full_range modifier