The model section represents a 2D or 3D model. By default, the model object serves as a preview and cannot be used any further. The model section can however be combined with the keyword image or 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:

model <name> : <modifier1, modifier2, ...>;
model image <name> : <modifier1, modifier2, ...>;
model animation <name> : <modifier1, modifier2, ...>;

The available modifiers are listed below.


You can specify a subset of the following modifiers. Only the vertex specification is mandatory.

  • fragment_data(<type>) – specifies the data type that will be used to transfer data between the vertex, geometry, 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.
  • vertex(<function>, <primitive type>, <vertex count / list / generator>) – specifies the model's vertex shader. function is a GLSL function that receives either the index of the current vertex as int and computes the vertex from it, or it receives a single vertex from the supplied vertex list or generated by a vertex generator, 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, int vertexIndex);
    vec4 vertexFunction(out FragmentDataType fragmentData, in VertexType vertexData);
  • 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, the model will be rendered solid white.
    vec4 fragmentFunction(in FragmentDataType fragmentData);
    vec4 fragmentFunction(); // if no fragment data type set
  • vertex_animated(<function>, <primitive type>, <vertex count / vertex list>) – same as vertex, but allows the vertex position or fragment data to change over time. The vertex function receives an additional float parameter with the current time in seconds. Modifier invalid for model image
    vec4 vertexFunction(out FragmentDataType fragmentData, int vertexIndex, float time);
  • fragment_animated(<function>) – same as fragment, but allows the fragment color to change over time. The fragment function receives an additional float parameter with the current time in seconds. Modifier invalid for model image
    vec4 fragmentFunction(in FragmentDataType fragmentData, float time);
  • geometry(<function>, <emitted primitive type>, <maximum emitted vertices>) – specifies the optional geometry shader that consumes vertices from the vertex shader, and may emit a different set of actual vertices. function is the body of the geometry shader that receives the data of a single point, line, or triangle as input array arguments:
    void geometryFunction(in vec4[N] vertexPosition, in FragmentData[N] fragmentData);
    void geometryFunction(in vec4[N] vertexPosition); // if no fragment data type set
    N is exactly the number of vertices of an input primitive (1 for points, 2 for lines, line_strip, line_loop, etc.). Within this function, two special calls are permitted:
    shadron_EmitVertex(emittedVertexPosition, fragmentData);
    shadron_EmitVertex(emittedVertexPosition); // if no fragment data type set
    shadron_EmitVertex emits an output vertex, and shadron_EndPrimitive separates individual primitives. Vertices must be emitted using these functions, or the output will be empty. shadron_EmitVertex may be called at most maximum emitted vertices times. emitted primitive type must be points, line_strip, or triangle_strip.
  • geometry_animated(<function>, <emitted primitive type>, <maximum emitted vertices>) – same as geometry, but allows the output of the geometry shader to change over time. The geometry function receives an additional float parameter with the current time in seconds.
    vec4 geometryFunction(in vec4[N] vertexPosition, in FragmentData[N] fragmentData, float time);
  • dimensions(<width, height>) – specifies the initial / fixed dimensions of the viewport
  • 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 (enabled 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
  • heavy_mode(<true / false>) – this option is required for computationally intensive shaders, where rendering time may exceed 1 second. Without it, there is a risk of GPU driver crash
  • srgb(<true / false>) – see image srgb modifier

Image/animation modifiers

The following modifiers are only available with the image or animation keyword.

  • filter – see image filter modifier
  • map – see image map modifier
  • hidden – see image hidden modifier
  • resizable – see image resizable modifier
  • full_range – see image full_range modifier