Packs / threejs-public
custom-shader-material
Write a custom GLSL ShaderMaterial (time-animated vertex displacement + fragment gradient) that compiles cleanly and reports shader errors loudly
Install
logicpacks pack use threejs-public/custom-shader-materialget_pack threejs-public/custom-shader-materialThe second line is the MCP tool call for the LogicPacks connector (Claude Code, Codex, Claude.ai and others). The first run of a pack someone else wrote asks for your yes.
Keys it needs (names only)
None.
Playbooks included
- Spec:
spec/SPEC.md(goal, steps, edge cases, don’ts) - Routes:
static-local - Checks: 1 in
outcome/checks.yaml - Code:
boot.jsindex.htmlmain.jsshaders.js - Tools: python3, playwright-python, chromium
Usage, last 8 weeks
New: no recorded use yet.
Purpose (from spec/SPEC.md)
Goal
A working ShaderMaterial template with uniforms (time, resolution, colour), vertex displacement and a fragment effect, plus a compile-error hook so broken shaders fail loudly in checks.
Steps
- Copy
code/; editshaders.js(vertex + fragment strings). - Uniforms update in the loop; keep per-frame JS work to uniform writes.
- Compile errors are caught by
renderer.debug.onShaderErrorand reported as console errors (so checks fail). - Check:
python3 ../tools/webgl_check.py code --js "window.__shader.compiled".
Edge cases
- Precision: use
highpfor positions; mobile GPUs may lack highp in fragment shaders (rare today). - Use onBeforeCompile to extend built-in materials instead when you need lighting.
Don'ts
- Don't branch heavily per pixel; prefer mix/step.
- Don't allocate new uniforms objects per frame.