shadertoy2webgl
v0.7.0
Published
Convert ShaderToy shaders to WebGL2 - CLI and library
Maintainers
Readme
Install
npm install -g shadertoy2webgl
# or
npx shadertoy2webgl <response.json>Usage
One flow:
- Open a shader on shadertoy.com in your browser.
- Open DevTools (
F12) → Network. - Reload or open the shader so the shadertoy (POST) request appears.
- Click it → Response tab → copy the response body (the JSON) or right‑click → Save as.
- Save to a file (e.g.
shader.json). - Run:
shadertoy2webgl shader.json
# or multiple files
shadertoy2webgl a.json b.json
# overwrite existing dirs
shadertoy2webgl --force shader.jsonOptions: --force (overwrite), --debug, --help, --version.
Output: a directory per shader (named by shader id) with index.html, shader.js, shader.json.
Library
import { shadertoy2webgl } from 'shadertoy2webgl';
const results = await shadertoy2webgl('shader.json', { force: true });
// results = [{ shaderId, html, js }, ...]Features
- Converts ShaderToy shaders to WebGL2
- Handles ShaderToy uniforms (iResolution, iTime, iFrame, iMouse)
- Zero dependencies, Node.js >= 18, ESM
Demos
Testing
npm test