Skip to content

archibate/dotfiles-opencode / skills/shader-dev

shader-dev

Verified

Comprehensive GLSL shader techniques for creating stunning visual effects — ray marching, SDF modeling, fluid simulation, particle systems, procedural generation, lighting, post-processing, and more.

FileKindSize
SKILL.mdskill md16.5 KB
reference/ambient-occlusion.mdmarkdown14.5 KB
reference/analytic-ray-tracing.mdmarkdown24.1 KB
reference/anti-aliasing.mdmarkdown2.9 KB
reference/atmospheric-scattering.mdmarkdown27.5 KB
reference/camera-effects.mdmarkdown3.0 KB
reference/cellular-automata.mdmarkdown26.7 KB
reference/color-palette.mdmarkdown19.9 KB
reference/csg-boolean-operations.mdmarkdown17.5 KB
reference/domain-repetition.mdmarkdown17.7 KB
reference/domain-warping.mdmarkdown16.6 KB
reference/fluid-simulation.mdmarkdown18.5 KB
reference/fractal-rendering.mdmarkdown18.2 KB
reference/lighting-model.mdmarkdown29.4 KB
reference/matrix-transform.mdmarkdown18.5 KB
reference/multipass-buffer.mdmarkdown24.8 KB
reference/normal-estimation.mdmarkdown17.2 KB
reference/particle-system.mdmarkdown28.3 KB
reference/path-tracing-gi.mdmarkdown27.5 KB
reference/polar-uv-manipulation.mdmarkdown22.6 KB
reference/post-processing.mdmarkdown23.9 KB
reference/procedural-2d-pattern.mdmarkdown16.3 KB
reference/procedural-noise.mdmarkdown21.7 KB
reference/ray-marching.mdmarkdown15.5 KB
reference/sdf-2d.mdmarkdown27.5 KB
reference/sdf-3d.mdmarkdown26.8 KB
reference/sdf-tricks.mdmarkdown2.6 KB
reference/shadow-techniques.mdmarkdown21.0 KB
reference/simulation-physics.mdmarkdown27.6 KB
reference/sound-synthesis.mdmarkdown23.6 KB
reference/terrain-rendering.mdmarkdown32.2 KB
reference/texture-mapping-advanced.mdmarkdown3.3 KB
reference/texture-sampling.mdmarkdown25.6 KB
reference/volumetric-rendering.mdmarkdown28.1 KB
reference/voronoi-cellular-noise.mdmarkdown17.6 KB
reference/voxel-rendering.mdmarkdown29.2 KB
reference/water-ocean.mdmarkdown20.2 KB
reference/webgl-pitfalls.mdmarkdown1.9 KB
techniques/ambient-occlusion.mdmarkdown11.1 KB
techniques/analytic-ray-tracing.mdmarkdown18.8 KB
techniques/anti-aliasing.mdmarkdown4.5 KB
techniques/atmospheric-scattering.mdmarkdown18.2 KB
techniques/camera-effects.mdmarkdown3.4 KB
techniques/cellular-automata.mdmarkdown19.0 KB
techniques/color-palette.mdmarkdown12.8 KB
techniques/csg-boolean-operations.mdmarkdown15.0 KB
techniques/domain-repetition.mdmarkdown9.7 KB
techniques/domain-warping.mdmarkdown12.5 KB
techniques/fluid-simulation.mdmarkdown46.5 KB
techniques/fractal-rendering.mdmarkdown13.0 KB
techniques/lighting-model.mdmarkdown17.1 KB
techniques/matrix-transform.mdmarkdown12.4 KB
techniques/multipass-buffer.mdmarkdown33.5 KB
techniques/normal-estimation.mdmarkdown9.1 KB
techniques/particle-system.mdmarkdown44.6 KB
techniques/path-tracing-gi.mdmarkdown21.5 KB
techniques/polar-uv-manipulation.mdmarkdown13.2 KB
techniques/post-processing.mdmarkdown30.3 KB
techniques/procedural-2d-pattern.mdmarkdown10.7 KB
techniques/procedural-noise.mdmarkdown16.9 KB
techniques/ray-marching.mdmarkdown13.7 KB
techniques/sdf-2d.mdmarkdown21.2 KB
techniques/sdf-3d.mdmarkdown21.6 KB
techniques/sdf-tricks.mdmarkdown3.4 KB
techniques/shadow-techniques.mdmarkdown24.8 KB
techniques/simulation-physics.mdmarkdown56.2 KB
techniques/sound-synthesis.mdmarkdown17.2 KB
techniques/terrain-rendering.mdmarkdown14.3 KB
techniques/texture-mapping-advanced.mdmarkdown4.3 KB
techniques/texture-sampling.mdmarkdown13.0 KB
techniques/volumetric-rendering.mdmarkdown12.3 KB
techniques/voronoi-cellular-noise.mdmarkdown13.0 KB
techniques/voxel-rendering.mdmarkdown45.2 KB
techniques/water-ocean.mdmarkdown17.8 KB
techniques/webgl-pitfalls.mdmarkdown5.4 KB

techniques/camera-effects.md

View on GitHub
# Camera & Lens Effects

## Use Cases
- Adding cinematic depth of field (bokeh blur)
- Motion blur for dynamic scenes
- Lens distortion and chromatic aberration
- Film grain and photographic realism

## Techniques

### 1. Depth of Field (Thin Lens Model)

Simulate camera aperture by jittering ray origins on a virtual lens disk:
```glsl
// For each sample:
vec2 lens = randomDisk(seed) * apertureSize;  // random point on aperture
vec3 focalPoint = ro + rd * focalDistance;     // point on focal plane
vec3 newRo = ro + cameraRight * lens.x + cameraUp * lens.y;  // offset origin
vec3 newRd = normalize(focalPoint - newRo);   // new ray toward focal point

// Accumulate multiple samples (16-64) for smooth bokeh
// Use with AA loop or temporal accumulation

// Disk sampling helper:
vec2 randomDisk(float seed) {
    float angle = hash11(seed) * 6.2831853;
    float radius = sqrt(hash11(seed + 1.0));
    return vec2(cos(angle), sin(angle)) * radius;
}
```

Parameters:
- `apertureSize`: 0.0 = pinhole (sharp), 0.1-0.5 = visible bokeh
- `focalDistance`: distance to the in-focus plane

### 2. Post-Process Depth of Field (Single Pass)

Cheaper approximation using depth buffer blur:
```glsl
vec3 dofPostProcess(sampler2D colorTex, sampler2D depthTex, vec2 uv) {
    float depth = texture(depthTex, uv).r;
    float coc = abs(depth - focalDepth) * apertureSize;  // circle of confusion
    coc = clamp(coc, 0.0, maxBlur);

    vec3 color = vec3(0.0);
    float total = 0.0;
    // 16-tap Poisson disk sampling
    for (int i = 0; i < 16; i++) {
        vec2 offset = poissonDisk[i] * coc / iResolution.xy;
        color += texture(colorTex, uv + offset).rgb;
        total += 1.0;
    }
    return color / total;
}
```

### 3. Motion Blur (Velocity-Based)

```glsl
// Simple radial motion blur (camera rotation)
vec3 motionBlur(vec2 uv, float amount) {
    vec3 color = vec3(0.0);
    vec2 center = vec2(0.5);
    int samples = 8;
    for (int i = 0; i < samples; i++) {
        float t = float(i) / float(samples - 1) - 0.5;
        vec2 sampleUV = mix(uv, center, t * amount);
        color += texture(iChannel0, sampleUV).rgb;
    }
    return color / float(samples);
}

// Time-based motion blur for ray marching
// Sample multiple time offsets within the frame:
// float t_shutter = iTime + (hash11(seed) - 0.5) * shutterSpeed;
// Use t_shutter instead of iTime for scene animation
```

### 4. Lens Distortion

```glsl
// Barrel/pincushion distortion
vec2 lensDistortion(vec2 uv, float k1, float k2) {
    vec2 centered = uv - 0.5;
    float r2 = dot(centered, centered);
    float distortion = 1.0 + k1 * r2 + k2 * r2 * r2;
    return centered * distortion + 0.5;
    // k1 > 0: pincushion, k1 < 0: barrel
}
```

### 5. Film Grain

```glsl
vec3 filmGrain(vec3 color, vec2 uv, float time, float intensity) {
    float grain = hash12(uv * iResolution.xy + fract(time) * 1000.0) - 0.5;
    // Apply more grain in darker areas (realistic film response)
    float luminance = dot(color, vec3(0.299, 0.587, 0.114));
    float grainAmount = intensity * (1.0 - luminance * 0.5);
    return color + grain * grainAmount;
}
```

### 6. Vignette

```glsl
vec3 vignette(vec3 color, vec2 uv, float intensity, float smoothness) {
    vec2 centered = uv - 0.5;
    float dist = length(centered);
    float vig = smoothstep(0.5, 0.5 - smoothness, dist);
    return color * mix(1.0 - intensity, 1.0, vig);
}
```

→ For deeper details, see [reference/camera-effects.md](../reference/camera-effects.md)
slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack."Stars: 196kUpdated Claude CodeCodexVerifiedInstall
ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read.Stars: 192kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report.Stars: 192kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt.Stars: 192kUpdated Claude CodeCodexVerifiedInstall