Inputs and outputs need to be specified in both, the interface and the GLSL code for Flair shaders to work correctly.
Flair shaders are mainly written in plain GLSL, but the interface is defined within the GLSL comment block \\* interface */
.
The interface code is written in TOML, a minimal markup language that is used to define the inputs and outputs for the shader in an artist-friendly way.
<aside> ℹ️ Names in the interface must correlate to names in the shader code for values to bind correctly.
</aside>
There can be multiple Outputs in a Flair shader and they need to be defined through the interface (TOML) and declared in the GLSL code as follows:
# TOML
# defines one "Output" for the node
outputs = ["Output"]
// GLSL
// declares one output: "Output"
out vec4 Output;
Representation in the Graph
# TOML
# defines three outputs for the node
outputs = ["Color", "Normals", "Edges"]
// GLSL
// declares three outputs
out vec4 Color;
out vec4 Normals;
out vec4 Edges;
Representation in the Graph
There can be multiple Inputs in a Flair shader of different types, which also need to be defined in the interface and declared in the GLSL code as follows:
# TOML
[[textures]]
name = "Texture" # define a texture input
// GLSL
uniform sampler2D Texture; // declare an input texture
# TOML
[[uniforms]]
name = "Integer"
type = "int" # define an integer input (parameter)
// GLSL
uniform int Integer; // declare an integer number
# TOML
[[uniforms]]
name = "IntVector2" # define an integer vector input (parameter)
type = "ivec2" # or "ivec3", "ivec4" depending on how many channels are needed
// GLSL
uniform ivec2 IntVector2; // declare an integer vector (ivec3 or ivec4 respectively)
# TOML
[[uniforms]]
name = "Float"
type = "float" # define a float input (parameter)
// GLSL
uniform int Float; // declare a float number