parameter

A parameter is a variable, which can be directly manipulated in the GUI, and is accessible throughout the remainder of the script, including GLSL functions. It is a handy tool for fine-tuning the appearance of your outputs.

Its syntax can be one of:

parameter <type> <name>;
parameter <type> <name> = <value>;
parameter <type> <name> : <control type>;
parameter <type> <name> = <value> : <control type>;

The parameter keyword may be shortened to param. <type> is the type of the parameter variable. Currently, only basic GLSL types are allowed (float, int, vecn, ivecn, matn, and bool). <value> is its default value (zero if not specified), and <control type> is the type of GUI element that shall control it, possibly with additional parameters. The available control types are listed below. A linear scale will be used by default.

Control types

The parameter control type can be one of:

  • range(<minimum>, <maximum>) – the default control, allows the user to change the value (or its individual components) using a linear slider. if <minimum> is omitted, it will be 0. If <maximum> is also omitted, the range will be from 0 to 1
  • logrange(<minimum>, <maximum>) – allows the user to change the value (or its individual components) using a logarithmic scale slider
  • color() – an interactive color picker control, only applicable to vec3 (RGB) and vec4 (RGBA) parameter types
  • hidden() – the parameter won't be shown in the GUI, but can be controlled programmatically

Example

parameter vec2 myCoord = vec2(0.3, -0.4) : range(vec2(-1.0, -1.0), vec2(1.0, 1.0));