webgl-shader-effectslisted
Install: claude install-skill RaveenDi/Skilloadout
# WebGL Shader Effects
Shaders are what make a site look *authored* instead of templated. Use **one hero effect and one
supporting effect** per page; everything else stays calm.
## Setup conventions
- Pass time/scroll/pointer as uniforms: `uTime`, `uProgress` (0–1 scroll/chapter), `uPointer` (vec2, -1..1, damped), `uResolution`.
- Damp pointer & progress on the CPU; shaders should never jump.
- Prefer `ShaderMaterial` with `#include <common>` or three's **TSL/NodeMaterial** when targeting WebGPU.
- Share a noise chunk (simplex/curl) across materials.
## 1. Living gradient background
```glsl
// fragment
uniform float uTime; uniform vec2 uPointer; varying vec2 vUv;
#include ./noise.glsl // snoise(vec3)
void main() {
vec2 uv = vUv + uPointer * 0.03;
float n = snoise(vec3(uv * 1.6, uTime * 0.05));
float m = snoise(vec3(uv * 3.2 + n, uTime * 0.08));
vec3 a = vec3(0.06, 0.07, 0.16), b = vec3(0.45, 0.20, 0.95), c = vec3(1.0, 0.55, 0.35);
vec3 col = mix(a, b, smoothstep(-0.4, 0.8, n));
col = mix(col, c, smoothstep(0.35, 0.9, m) * 0.6);
col += (fract(sin(dot(gl_FragCoord.xy, vec2(12.9898, 78.233))) * 43758.5453) - 0.5) * 0.03; // grain
gl_FragColor = vec4(col, 1.0);
}
```
## 2. Image hover / scroll distortion (DOM-synced planes)
- Mirror each `<img data-gl>` with a plane whose size/position is synced to `getBoundingClientRect()` every frame (or on scroll/resize).
- Distort UVs with velocity: `uv += normal * sin(uv.y * 10. + uTime) * uVelocity * 0.02;`
- Hover