METADATA

Shader file name

// name[ShaderName]

A metadata attribute that defines the name of the shader file. Changes are reflected directly in the user interface.

The name is used in the title bar, in the shader menu on the right as well as when exporting a shader file.

Define tags

// tags[tagName, ...]

A metadata attribute that defines the tags which are used to organize the shader files in the shader menu. Changes are reflected directly in the user interface.

A shader files can have multiple tags in which case they will have multiple entries in the shader menu.

Define sorting precedence

// sort[Integer]

A metadata attribute that defines the precedence for sorting shader files in the shader menu. Changes are reflected directly in the user interface.

Shader files are sorted alphabetically unless a precedence is defined.

Bind textures to vertex function

// txrv[textureName, ...]

A metadata attribute that defines the textures that are accessible to the vertex function. Changes are reflected directly in the render result.

The textures that are bound to the shader file are marked with a link icon in the texture menu.

Bind textures to fragment function

// txrf[textureName, ...]

A metadata attribute that defines the textures that are accessible to the fragment function. Changes are reflected directly in the render result.

The textures that are bound to the shader file are marked with a link icon in the texture menu.

Bind object to shader

// objc[objectName]

A metadata attribute that defines a specific object overriding the global selection. Changes are reflected directly in the render result.

The object that is bound to the shader file is marked with a link icon in the object menu. As long as an object is bound to the shader file the selection can not be changed in the object menu. The object selected in the object menu is used for all shader files without this metadata attribute.

Define custom uniform

// unif[type][name][min:max][defaults]
// 
// unif[float][exponent][1.0:100.0][50.0]
// unif[float3][color][0.0:1.0][0.1,0.1,0.1]
// unif[float4][position][-1.0:1.0][0.5,0.5,1.0,1.0]
// unif[bool][flag][true]

A metadata attribute that defines a property of the built-in uniform structure that is available to the shader as a buffer.

User-defined uniforms are properties of a data structure that can be bound to the shader as part of the function signature.

vertex Varying vertexShader(const Vertex in [[stage_in]], constant Uniforms &uniforms [[buffer(1)]])

Uniforms can be accessed inside the shader function via the uniform structure.

float4 position = uniforms.position;

The uniform menu is automatically populated with the corresponding user interface controls to change the values of the uniforms. All changes are reflected directly in the render result.