Developers1 of 7

GLSL shaders

One sketch.glsl. No boilerplate.

One folder, one sketch.glsl. No page, render loop or boilerplate: Operatour supplies them, and the audio as uniforms.

my-shader/
  sketch.glsl

Drag the folder onto Operatour, or just the .glsl file.

The smallest one that works

void main() {
  vec2 uv = gl_FragCoord.xy / sialkResolution;
  fragColor = vec4(uv.x, uv.y, sialkLevel, 1.0);
}

No imports, no declarations. Uniforms update once per composited frame.

Both dialects

GLSL ES 3.00 and GLSL ES 1.00, detected from the source: gl_FragColor and texture2D mean 1.00.

Most shaders online are still 1.00 and should just run:

precision highp float;

void main() {
  vec2 uv = gl_FragCoord.xy / sialkResolution;
  gl_FragColor = vec4(uv, sialkBass, 1.0);
}

ES 1.00 requires constant loop bounds: the language, not Operatour.

glslsandbox and The Book of Shaders shaders run as is.

  • Its own time, resolution and mouse, or u_time, u_resolution and u_mouse: set every frame.
  • An #extension line anywhere in the file: lifted to the top.
  • Shadertoy's iTime, iResolution and mainImage(): accepted.

What Operatour gives you

All supplied as uniforms, with the meanings of the audio contract, where the detail lives.

Uniform Type
sialkResolution vec2 The surface being composited, in pixels.
sialkTime float Show transport position, in seconds.
sialkDelta float Seconds since the previous frame.
sialkFrame float Frames since this sketch loaded.
sialkLevel float Broadband loudness, 0-1.
sialkBass sialkMid sialkHigh float The three bands, 0-1.
sialkHits float Onset counter.
sialkOnBeat float 1 on the beat, decaying.
sialkBeatPhase float Ramps 0 → 1 between beats.
sialkBpm sialkBpmConfidence float BPM, and its confidence.
sialkSilent float 1 when the input has been quiet for a second.
sialkSpectrum sampler2D 64 bins as a texture.
sialkLevelTrail sampler2D 128 frames of level as a texture.

Two helpers skip the texture lookup, in both dialects:

float sialkBand(float t);   // t 0..1 across the spectrum
float sialkTrail(float t);  // t 0..1 back through the level trail

#define SIALK_CONTRACT 1 is set, so a shader can compile inside and outside Operatour.

A shader you wrote for Shadertoy

iTime, iResolution, iFrame and iMouse are defined; your own shader in that dialect should run as is. iMouse is a constant zero; pointer input arrives with v1.

Making it react

Swap a constant for a band:

float radius = 0.2 + sialkBass * 0.3;

Leave headroom: a value saturating at 0.9 makes loud and very loud rooms look identical (the audio).

For anything that decays, prefer sialkBeatPhase to sialkOnBeat: 1.0 - sialkBeatPhase decays in sync with the music, not a number you picked.

Cost

GLSL cost is pixels, nothing else. A loop that always runs to the end costs its full length at every pixel: at 4K, 8.3 million times. A distance field that converges early is cheap; step count alone says little.

Fine at 720p, collapses at 4K: that is the shape of the problem, and not one Operatour can fix.