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>


Outputs

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:

One output

# TOML
# defines one "Output" for the node 
outputs = ["Output"]  
// GLSL
// declares one output: "Output" 
out vec4 Output;

Representation in the Graph

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/90edad65-6256-4e30-a78e-6b0827b1bd11/Untitled.png

Multiple outputs

# 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

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/7a3ab080-a41d-4576-9f6b-104aa016de37/Untitled.png


Inputs

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:

Texture Inputs

# TOML
[[textures]]  
name = "Texture"  # define a texture input
// GLSL
uniform sampler2D Texture;  // declare an input texture

Integer numbers

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/90d2131f-dbba-4e27-8a13-acb0d857f882/Untitled.png

# TOML
[[uniforms]]
name = "Integer"
type = "int"      # define an integer input (parameter)
// GLSL
uniform int Integer;  // declare an integer number

Integer vectors

# 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)

Floating-point numbers

# TOML
[[uniforms]]
name = "Float"
type = "float"  # define a float input (parameter)
// GLSL
uniform int Float;  // declare a float number