Skip to content

About

CLI and library to convert ShaderToy shaders to standalone WebGL2 with uniform handling

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

14 stars

Watchers

2 watching

Forks

Latest commit

 

History

15 Commits

Folders and files

Repository files navigation

demo

ShaderToy ❯❯ WebGL2

demo

Install

npm install -g shadertoy2webgl
# or
npx shadertoy2webgl <response.json>

Usage

  1. Open a shader on shadertoy.com. DevTools (F12) → Network, reload.
  2. In the list: shadertoy https://www.shadertoy.com/shadertoy (POST) Copy its Response (JSON), save as shader.json.
  3. Run:
shadertoy2webgl shader.json
shadertoy2webgl a.json b.json
shadertoy2webgl --force shader.json   # overwrite

Options: --force, --debug, --help, --version. Output: one directory per shader (id as name) 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

Plasma st2webgl response.json (after saving that shader’s API response)
demo/wdyczG/index.html
shadertoy.com/view/wdyczG
Waves demo/DdcfzH/index.html
shadertoy.com/view/DdcfzH

Testing

npm test

License

MIT

About

CLI and library to convert ShaderToy shaders to standalone WebGL2 with uniform handling

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

14 stars

Watchers

2 watching

Forks

Releases

Used by

Contributors

Languages