43 lines
2.2 KiB
Markdown
43 lines
2.2 KiB
Markdown
# treppe-gl
|
|
|
|
Render Shadertoy style GLSL shaders onto the treppe2000.
|
|
|
|
The shader is rendered into a 16x1 float framebuffer (x = stair step) and
|
|
sent as RGBW16 UDP frames to the priority port (3124) of `trepped` on
|
|
`treppe.club.berlin.ccc.de`. While it runs it overrides whatever else the
|
|
stairs show. On exit it sends a black frame. The stairs power must be on
|
|
(Bluescreen > Stairs).
|
|
|
|
nix-shell --run "python treppe_gl.py shaders/flow.glsl"
|
|
nix-shell --run "python treppe_gl.py shaders/pulse.glsl --dry-run"
|
|
|
|
Wrappers: `./treppe-run.sh <shader> [brightness]` and `./treppe-dry.sh <shader> [brightness]` (dry run, nothing is sent).
|
|
|
|
Options: `--brightness 0-100` (scales output, default 100), `--host`, `--port`, `--fps`, `--dry-run` (send nothing),
|
|
`--no-window` (headless), `--white {extract,alpha,off}`.
|
|
|
|
Shaders define `mainImage(out vec4 fragColor, in vec2 fragCoord)` and may
|
|
use `iResolution`, `iTime`, `iTimeDelta` and `iFrame`. The file is reloaded
|
|
when it changes; on a compile error the last working shader keeps running.
|
|
|
|
The same shader also runs at full size in the debug window, so derive the
|
|
step from the resolution (`floor(fragCoord.x / iResolution.x * 16.0)`) or use
|
|
`fragCoord.x / iResolution.x`, never raw `fragCoord.x`.
|
|
|
|
2D shaders: put `// canvas: 256x48 compact: mean` at the top of a shader (or use
|
|
`--canvas 256x48 --compact mean`) and it is rendered as a real 2D picture of
|
|
that size, then compacted to the 16 steps, each step being a 16 pixel wide
|
|
(canvas width / 16) group of columns. The width must be a multiple of 16.
|
|
`compact`: `mean` averages the group (default), `max` takes the brightest value
|
|
per channel, `row` averages only the middle row. The debug window then shows
|
|
the actual canvas on top. See `shaders/reef-2d.glsl`.
|
|
|
|
White channel: `extract` (default) sets `w = min(r,g,b)` and subtracts it
|
|
from rgb, `alpha` uses the shader's alpha, `off` sends w = 0.
|
|
|
|
Debug window: top is the shader at full resolution, bottom are the 16 steps
|
|
as sent (step numbers, colour, white bar). Steps 13-15 are greyed out,
|
|
`trepped` only drives 13 channels. The step to channel mapping is done by
|
|
`trepped`, frames are sent in step order.
|
|
|
|
Tests: `nix-shell --run "python -m pytest tests"`.
|