Add 2D canvas mode compacted to the steps, ocean-chaos and reef-2d shaders

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
April John 2026-10-16 15:28:41 +02:00
commit d917860201

View file

@ -24,6 +24,14 @@ 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.