VGen File Format:
Filter:
Scintillator/Reference (extension) | Quarks > Scintillator > Developer Documentation

VGen File Format
ExtensionExtension

Description of VGen yaml file format used by Scintillator synth server.

Top-Level Format

A VGen file may contain multiple VGen definitions. Each definition at top level is a yaml dictionary with required and optional keys.

key nametyperequired or optionaldescription
namestringrequiredThe name of the VGen, must be unique. Used to identify this VGen in ScinthDef descriptions.
rateslistrequiredA list of strings identifying the rates the VGen supports, at least one of frame, shape, pixel.
samplerbooleanoptionalIf present, specifies if this VGen is a sampling VGen that will take an image input. If not present, the value is assumed to be false.
tweenbooleanoptionalIf present, specifices if this VGen has a tween table to sample.
inputslistoptionalA list identifying input names in the shader program. The ordering of inputs here must match the ordering of inputs on the ScinthDef, as those inputs can be supplied unnamed.
outputslistrequiredA list of strings identifying names of output parameters. At least one element must exist in this list.
dimensionslistrequiredA list of dictionaries of keys mapping dimension on inputs to dimension on outputs of the VGen (see below).
shaderstringrequiredThe GLSL shader program, with inputs, intrinsics, and intermediates, as well as exactly one instance of the keyword "@out" prefixed with @ symbols.

Input and Output Dimensions List

The dimensions list enumerates the valid dimensions of input to, and output from, the VGen. As shader programs rely heavily on SIMD this means that many different configurations of output and input dimensions are typically supported by the built-in functions. The dimension key must be present in a valid VGen and contain a list with one or more dictionary elements with the following keys:

key nametyperequired or optionaldescription
inputslist or integer (see note)required if VGen has inputsDescribes the dimensionality of each input signal.
outputslist or integer (see note)requiredDescribes the dimensionality of each output signal.
NOTE: If a list, must have the same number of integer elements as there are number of inputs or outputs, each integer describing the dimensionality of inputs or outputs in order. If a single integer, all inputs or outputs are assumed to have that dimensionality.

Shader Intrinsics

Some @names are reserved and will be automatically supplied to the VGen at compilation or runtime. They are described in short table form, with detailed descriptions below. Intrinsics have a rate, just like VGens, which describe their scope in terms of computation, meaning that it is not valid to use a shape-rate Intrinsic, for example, in a frame-rate VGen.

namedimensonratebrief description
@fragCoord2pixelThe screen coordinates of the curent fragment in pixels.
@normPos2shapePosition of vertex in normalized space.
@pi1frameA shortcut for the constant Pi.
@position1-4shape onlyUnormalized position of vertex. Undefined in pixel-rate VGens. Used internally by scinserver to indicate output of vertex shader.
@samplern/aframeThe curently configured and bound sampler and image. Only usable in sampling VGens.
@time1frameThe runtime of the Scinth instance in seconds.
@texPos2shapePosition of the fragment in texture coordinates space.
@tweenSamplern/aframeThe currently configured and bound sampler of the tween. Only usable in tween VGens.
@tweenDuration1frameThe total duration of the tween in seconds. Only usable in tween VGens.

@fragCoord

Equates directly to gl_FragCoord.

@normPos

The normalized position of the vertex or fragment. This is computed to allow for image coordinates with a 1:1 aspect ratio even though the output window or framebuffer might be rectangular. The @normPos is always a 2 dimensional value and sets up coordinate systems such that the image in smaller of width or height will run from -1.0 to 1.0 in normPos space, with the larger size running under -1.0 and over 1.0. So, for instance, if the image is a tall rectangle with height twice that of width, the normPos will run from -1.0 to 1.0 in width, and -2.0 to 2.0 in height.

@pi

Always substituted for the value of pi.

@position

The unormalized position of the vector.

@sampler

In sampling VGens, represents the currently bound Vulkan sampler object and image within the shader.

@texPos

Texture coordinates are typically constrained within [0, 1] inclusive, with Samplers configured to do different things outside of the texture coordinate region. The synth will configure a shape to include texture coordinate information with the vertex and fragment shaders if this intrinsic is present. Texture coordinates are currently always assumed to be 2 dimensional.

@time

The VGen will receive a upated value every frame which contains the elapsed time in seconds from when the Scinth instance started. The time intrinsic is always 1 dimensional.