Skip to content

BumpyClock/agent-templates / skills/shader-art-coding

shader-art-coding

Verified

Writes, debugs, and art-directs procedural GLSL fragment shaders (Shadertoy mainImage, WebGL2 / GLSL ES 3.00): SDF raymarching, procedural buildings/cities, 2D distance-field graphics, noise / fBm / domain warping, terrain, ocean/coastal water optics, clouds and other volumes, PBR lighting, color and tonemapping. Ships a verified GLSL building-block library with a bundler and checker. Use when the user asks for a shader, Shadertoy, GLSL/.frag/.glsl code, a raymarcher, an SDF scene, a procedural texture or generative visual, or wants a shader fixed, optimized, ported or explained. Not for HLSL/Unity ShaderLab or non-graphics GPU compute.

FileKindSize
CREDITS.mdmarkdown6.3 KB
LICENSEother1.0 KB
SKILL.mdskill md7.1 KB
agents/openai.yamlconfig298 B
glsl/architecture.glslother1.8 KB
glsl/atmosphere.glslother4.6 KB
glsl/camera.glslother2.1 KB
glsl/color.glslother4.7 KB
glsl/common.glslother2.7 KB
glsl/debug.glslother1.4 KB
glsl/domain.glslother4.8 KB
glsl/hash.glslother4.1 KB
glsl/intersect.glslother1.7 KB
glsl/noise.glslother21.3 KB
glsl/operators.glslother5.3 KB
glsl/pattern.glslother3.1 KB
glsl/post.glslother2.6 KB
glsl/raymarch.glslother4.0 KB
glsl/sdf2d.glslother11.7 KB
glsl/sdf3d.glslother10.0 KB
glsl/shading.glslother4.6 KB
glsl/tonemap.glslother4.8 KB
glsl/volume.glslother3.4 KB
glsl/water.glslother3.1 KB
references/composition-and-debugging.mdmarkdown5.2 KB
references/formula-code-couples-materials.mdmarkdown15.5 KB
references/formula-code-couples-sdf.mdmarkdown20.5 KB
references/formula-code-couples-terrain.mdmarkdown17.1 KB
references/formula-cookbook.mdmarkdown19.0 KB
references/library-index.mdmarkdown56.2 KB
references/noise-use-cases.mdmarkdown17.1 KB
references/procedural-buildings.mdmarkdown7.5 KB
references/rendering-pipeline.mdmarkdown8.4 KB
references/sdf-library-guide.mdmarkdown10.4 KB
references/shader-workflow.mdmarkdown3.5 KB
references/subject-routing.mdmarkdown9.7 KB
references/terrain-production.mdmarkdown7.3 KB
references/water-quality.mdmarkdown10.6 KB
scripts/glsl_tools.pyscript29.4 KB
templates/alpine-valley.glslother3.9 KB
templates/coastal-water.glslother7.6 KB
templates/noise-progression.glslother2.3 KB
templates/noise-terrain-map.glslother2.2 KB
templates/ocean.glslother13.1 KB
templates/pattern-swatches.glslother3.6 KB
templates/procedural-city.glslother4.5 KB
templates/raymarch-sdf.glslother5.3 KB
templates/sdf-2d-poster.glslother3.7 KB
templates/terrain.glslother4.7 KB
templates/volumetric-clouds.glslother3.9 KB

glsl/pattern.glsl

View on GitHub
//! pattern: tilings and antialiased procedural patterns. The filtered versions integrate the pattern over the
//! pixel footprint (box filter), so floors and stripes stay clean in the distance with no supersampling.
//! Filtering math follows https://iquilezles.org/articles/checkerfiltering/ and /filterableprocedurals/.

/// Triangle wave, the integral of a square wave. Building block for box-filtered patterns.
/// @use writing new filtered patterns
vec2 triangleWave(vec2 x) { return 1.0 - 2.0 * abs(fract(x * 0.5) - 0.5); }

/// Box-filtered checkerboard with unit squares: 0 or 1 up close, fading to 0.5 where squares are smaller than a pixel.
/// Compute the footprint before any branching: w = fwidth(p) (or max(abs(dFdx(p)), abs(dFdy(p)))).
/// @use floors, chessboards, test patterns, racing flags, tablecloths
/// @range [0,1]
float filteredChecker(vec2 p, vec2 w) {
    w = max(w, 1e-4);
    vec2 i = (triangleWave(p + 0.5 * w) - triangleWave(p - 0.5 * w)) / w;
    return 0.5 - 0.5 * i.x * i.y;
}

/// Box-filtered grid lines (unit cells, line width = 1/n of a cell). Returns 1 on lines, 0 inside cells.
/// @use blueprints, graph paper, tiles with grout, sci-fi floors, synthwave grids
/// @range [0,1]
float filteredGrid(vec2 p, vec2 w, float n) {
    w = max(w, 1e-4);
    vec2 a = p + 0.5 * w;
    vec2 b = p - 0.5 * w;
    vec2 i = (floor(a) + min(fract(a) * n, 1.0) - floor(b) - min(fract(b) * n, 1.0)) / (n * w);
    return 1.0 - (1.0 - i.x) * (1.0 - i.y);
}

/// Box-filtered stripes along x with period 1 and duty cycle 0.5. Returns 0..1.
/// @use awnings, candy, zebra (warp x first), barcodes, road markings
/// @range [0,1]
float filteredStripes(float x, float w) {
    w = max(w, 1e-4);
    float a = x + 0.5 * w, b = x - 0.5 * w;
    float ia = floor(a) * 0.5 + max(fract(a) - 0.5, 0.0);
    float ib = floor(b) * 0.5 + max(fract(b) - 0.5, 0.0);
    return (ia - ib) / w;
}

/// Hexagonal tiling with unit spacing between neighboring centers. Neighbors sit left/right, so hexes are
/// pointy-top. Returns vec4(local offset from the hex center, integer-valued hex id).
/// @use honeycomb, scales, tiles, game boards, hex pixelation
vec4 hexGrid(vec2 p) {
    const vec2 s = vec2(1.0, 1.7320508);
    vec2 a = mod(p, s) - 0.5 * s;
    vec2 b = mod(p - 0.5 * s, s) - 0.5 * s;
    vec2 local = (dot(a, a) < dot(b, b)) ? a : b;
    vec2 center = p - local;
    vec2 id = floor(vec2(center.x * 2.0, center.y * 1.1547005) + 0.5);
    return vec4(local, id);
}

/// Distance from a hexGrid local coordinate to its hexagon's edge (0.5 at the center, 0 on the edge).
/// @use hex borders, bevels, edge wear on tiles
float hexEdgeDistance(vec2 local) {
    vec2 a = abs(local);
    return 0.5 - max(a.x, dot(a, vec2(0.5, 0.8660254)));
}

/// Truchet tiling of quarter-circle arcs, randomly flipped per cell. Returns signed distance to arcs of half-width w.
/// @use maze-like ornaments, pipes, Celtic-style weaves, procedural circuitry
float truchetArcs(vec2 p, float w) {
    vec2 id = floor(p);
    vec2 f = fract(p) - 0.5;
    if (hash12(id) < 0.5) f.x = -f.x;
    vec2 q = f - 0.5 * sign(f.x + f.y + 1e-6);
    return abs(length(q) - 0.5) - w;
}
receiving-code-reviewobra/superpowersUse when receiving code review feedback, before implementing suggestions, especially if feedback seems unclear or technically questionable - requires technical rigor and verification, not performative agreement or blind implementationStars: 319kUpdated Claude CodeCodexVerifiedInstall
requesting-code-reviewobra/superpowersUse when completing tasks, implementing major features, or before merging to verify work meets requirementsStars: 319kUpdated Claude CodeCodexVerifiedInstall
using-git-worktreesobra/superpowersUse when starting feature work that needs isolation from current workspace or before executing implementation plans - ensures an isolated workspace exists via native tools or git worktree fallbackStars: 319kUpdated Claude CodeCodexVerifiedInstall
verification-before-completionobra/superpowersUse when about to claim work is complete, fixed, or passing, before committing or creating PRs - requires running verification commands and confirming output before making any success claims; evidence before assertions alwaysStars: 319kUpdated Claude CodeCodexVerifiedInstall