About this tool
The GLSL Playground is a live fragment-shader laboratory built on WebGL2. Every keystroke recompiles your shader; compiler errors are parsed and mapped back from the injected uniform header to your line numbers, then highlighted directly in the CodeMirror editor (lazy-loaded, so it never bloats the page). A live FPS counter sits next to the render so performance regressions — one loop too many, one branch too deep — show up the moment you type them.
The Shadertoy uniform contract is honored in full: iResolution, iTime, iTimeDelta, iFrame, iMouse (drag the canvas to feed it) and four sampler channels iChannel0..3. Write the familiar `void mainImage(out vec4, in vec2)` signature and the playground wraps it into a real fragment shader; write a raw `void main()` and it passes through untouched.
The gallery covers the genres the PRD names: raymarched primitives (sphere with soft checker floor, rotating torus, a six-iteration Mandelbulb), procedural noise (animated Voronoi cells with glowing borders, five-octave FBM fog), and visual FX (synthwave cyberpunk grid, the classic plasma, matrix rain with per-column speeds, and a neon audio visualizer that reads an FFT strip from iChannel0 — feed it from the synth studio in another tab, or let it idle on a gentle wave).
When you're happy with a look, take it anywhere: export as a Three.js ShaderMaterial setup, a React Three Fiber component (fully typed, useFrame-driven), a standalone single-file WebGL2 HTML page that runs anywhere with zero dependencies, or just the raw GLSL. The canvas also records straight to WebM video via MediaRecorder — perfect for landing-page backgrounds you want to preview in motion.
Where WebGL2 is unavailable (old browsers, locked-down GPUs, headless tests), a Canvas2D plasma fallback keeps the page alive and the source still gets validated, so broken shaders surface errors even without a GPU. All rendering is local; nothing is uploaded.
How to use
Pick a preset
Start from the gallery — Raymarching, Procedural Noise, Visual FX or Classic — or paste your own Shadertoy code.
Edit live
Type in the editor; every change recompiles instantly. Errors appear under the canvas with line numbers, highlighted in the editor.
Drive it with input
Drag on the canvas to feed iMouse; time flows automatically through iTime, iTimeDelta and iFrame.
Check performance
Watch the FPS counter as you edit — it's your free performance profiler.
Record or export
Record the canvas as WebM, or export Three.js, R3F, standalone HTML or plain GLSL from the export panel.
Use cases
Prototyping site visuals
Iterate hero backgrounds and section effects with instant feedback, then export the exact code your stack needs — Three.js, R3F or vanilla.
Learning shader programming
The gallery presets progress from plasma to raymarching; live errors and the FPS counter teach both correctness and cost.
Creative coding practice
Daily-shader exercise in a tab: no toolchain, no build step, Shadertoy muscle memory fully transferable.
Producing motion assets
Record the canvas to WebM for mockups, demos and social clips without any screen-recording software.
Common mistakes
Mistake:Declaring uniforms the header already declares
Fix:iResolution/iTime/etc. are injected above your code — redeclaring them is a redefinition error; just use them.
Mistake:Testing performance at the wrong resolution
Fix:The canvas respects devicePixelRatio (capped at 2); a 4K monitor renders 4× the pixels of 1080p, so compare FPS at the same window size.
Mistake:Unbounded raymarch loops
Fix:Always cap step count and total distance (`if (d < eps || t > maxT) break;`) — an unbounded loop compiles but freezes the tab.
Mistake:Expecting identical float results everywhere
Fix:GLSL precision varies by GPU/driver (highp is requested but mobile may differ); guard against NaN with max()/clamp() on critical paths.
Frequently asked questions
Related guides
Your Font Has Axes: A Field Guide to Variable Fonts and OpenType Features
One font file, infinite weights. How the fvar and gvar tables actually work, why a font inspector can show you the axes but not animate between them, and the metric-override trick that kills fallback-font layout shift.
Symmetry, Dithering and the Sprite Sheet: A Pixel Artist's Toolkit
Why PICO-8 has exactly 16 colors, how a Bayer matrix fakes a gradient with none, and what actually happens when you export a walk cycle to Pixi, Phaser or Godot.
Stable Fluids: Why Smoke Simulators Never Blow Up
Semi-Lagrangian advection, pressure projection and vorticity confinement — the three tricks from Jos Stam's 1999 paper that made real-time fluid simulation unconditionally stable, explained by playing with them.
One Pixel at a Time: Thinking in Fragment Shaders
Fragment shaders invert everything procedural programmers know: no objects, no loops over data — just one function evaluated half a million times per frame. The mental models that make GLSL finally click, from plasma to raymarching.
References & standards
Related tools
Distributed Systems & Network Topology Simulator
Build a network topology from load balancers, API gateways, microservices, message queues, distributed databases and caches, then inject chaos — kill nodes, partition the network, packet loss, latency spikes, circuit breaker trips — and watch Raft leader election, split-brain and Hystrix-style breaker state react live. Export the topology as Docker Compose, Kubernetes manifests, Mermaid or PlantUML. Entirely client-side, educational simulation.
Typography Anatomy & Variable Font Lab
Load a TTF/OTF/WOFF/WOFF2 font and inspect glyph Bézier outlines, baseline/x-height/cap-height guides, kerning pairs, OpenType features and live variable-font axis sliders — export CSS @font-face, font-variation-settings and fallback metric overrides.
Pixel Art Sprite Studio
Draw retro pixel art on an 8x8 to 64x64 grid with pencil, flood-fill, ordered-dither and symmetry tools, curated PICO-8/Game Boy/NES/C64/Endesga-32 palettes, multi-layer compositing, and a frame timeline with onion skinning. Export static PNG, animated PNG, GIF, a sprite-sheet atlas (Pixi/Phaser/Godot/Unity JSON), or a CSS steps() animation snippet.
Digital Logic Gate & Circuit Simulator
Build digital circuits from AND/OR/NOT/NAND/NOR/XOR/XNOR gates, tri-state buffers, switches, clocks and 7-segment displays; wire flip-flops, latches and multiplexers into adders and counters. Runs an event-driven propagation-delay simulation with High-Z and driver-conflict detection, packages sub-circuits into reusable ICs, and exports a truth table, K-Map minimization, Verilog, VHDL, and a documented JSON+SVG schematic. Everything runs client-side; circuits never leave the browser.
2D Fluid Dynamics & Particle Physics Sandbox
A physics playground with two engines sharing one canvas. The fluid mode runs a real Eulerian Navier-Stokes solver — semi-Lagrangian advection, explicit diffusion, Jacobi pressure projection and vorticity confinement — that you paint with dye and velocity using mouse or touch. The particle mode is a damped Verlet N-body engine with gravity wells, Coulomb attractors and repulsors, spring links, wall restitution and elastic circle collisions. Particle counts adapt to the device (100k target on WebGL2 desktop, 2k-5k on CPU fallback), and every configuration exports as runnable code: a Matter.js world, a PixiJS ticker setup, or a standalone vanilla Canvas engine.
Web Audio Modular Synthesizer & Sound FX Generator
A full synth voice designer running entirely in your browser: seven oscillator flavors (sine, saw, triangle, square with real PWM duty control, white/pink/brown noise), a visual ADSR envelope, resonant biquad filtering, an LFO routed to pitch, filter or gain, and an effects chain of tanh overdrive, stereo ping-pong delay and Schroeder reverb. Play the two-octave keyboard with your mouse, the printed computer keys (A W S E D…) or a Web MIDI controller, watch the live FFT spectrum and scrolling waterfall spectrogram, fire retro game SFX one-shots (jump, laser, coin, powerup, explosion, click), then export your sound as 8/16/24-bit WAV or as dependency-free Web Audio code you can paste into any project.