GLSL Shader Playground

Edit a fragment shader and watch it render as you type, add slider and colour uniforms, then save a high-resolution PNG or record a WebM video.

Runs in your browser. Your files never leave your device. See how to check

…

How to do it

  1. 1
    Pick a shader

    Choose an example from the shader list or press + New to start from a template.

  2. 2
    Choose the mode

    Select Shadertoy for mainImage code or Raw fragment shader for a complete main() shader.

  3. 3
    Edit and watch

    Change the code; it recompiles as you type and errors appear with line numbers under the editor.

  4. 4
    Add controls

    In Uniforms press + float, + colour, + vec2 or + bool, rename it and use it in your code.

  5. 5
    Interact

    Drag on the canvas to set iMouse, pause, restart or change speed and quality.

  6. 6
    Export

    Press PNG at size for a still image or choose a length and press Record WebM for a video.

About this tool

A fragment shader is a small program that runs once for every pixel on the screen, in parallel, on the graphics card. With a few lines of maths it draws gradients, fractals, raymarched 3D scenes and generative patterns at full frame rate. This playground gives you an editor next to a live WebGL 2 canvas: change a number and the picture changes almost immediately. Write in Shadertoy style with a mainImage function and the familiar iTime, iResolution and iMouse inputs, or paste a complete raw shader in the style of The Book of Shaders. Custom uniforms appear as sliders, colour pickers and switches, so you can tune a look without editing code. When it looks right, save a PNG at 4K or record a short WebM clip.

Who this is for

Creative coders, students learning computer graphics, game developers prototyping post-processing effects, motion designers who want generative backgrounds, and anyone porting a shader from Shadertoy into their own project.

Two ways to write a shader

- Shadertoy mode: write `void mainImage(out vec4 fragColor, in vec2 fragCoord)`. The tool adds the GLSL ES 3.00 header and the uniforms iResolution, iTime, iTimeDelta, iFrame, iMouse and iDate. - Raw mode: write a whole fragment shader with `void main()`. Uniforms named u_time, u_resolution and u_mouse are filled in automatically, as are the Shadertoy names if you declare them.

Uniforms as controls

Add float, colour (vec3), vec2 and bool uniforms in the Uniforms panel. You do not have to declare them in code; missing declarations are inserted for you. Each float gets a slider with its own minimum and maximum, which makes it easy to explore a parameter space or prepare a shader for an artist.

Compile errors you can find

Errors from the GLSL compiler are mapped back to your own line numbers, even in Shadertoy mode where a header is added above your code. While a shader has errors the preview keeps showing the last version that compiled, so the canvas never goes black while you type.

Export

PNG (view size) saves exactly what you see. PNG at size renders one frame at 1280×720 up to 3840×2160, or square and vertical formats for social media. Record WebM restarts the clock and captures 3 to 30 seconds through the browser's MediaRecorder.

Worked example

In the Plasma waves example, set uSpeed to 2 and the tint colour to orange. The four sine waves now move twice as fast and the palette shifts to warm tones. Press PNG at size with 3840x2160 to get a 4K wallpaper of the current frame, or record 10 s of WebM for a looping background video.

Limits

Only fragment shaders are supported: there are no vertex shaders, textures, audio input or multi-pass buffers like Shadertoy's Buffer A to D. A shader with an unbounded loop can hang the graphics driver and the tab; keep loops bounded by a constant. Video recording depends on browser support for canvas capture and is not available in every mobile browser.

Worked example

Plasma waves with uSpeed 2 and an orange tint: saved as a 3840×2160 PNG and a 10 s WebM loop.

Quick facts

Frequently asked questions

Can I paste shaders from Shadertoy?

Yes, single-pass shaders that use mainImage, iTime, iResolution and iMouse work in Shadertoy mode. Shaders that read iChannel textures or other buffers need those inputs removed.

Why is the preview not updating?

The shader has a compile error. Read the error list under the editor: line numbers refer to your code. The canvas keeps the last working version until the error is fixed.

How does iMouse work?

Press and drag on the canvas. iMouse.xy is the current position in pixels from the bottom left, and iMouse.zw holds the click position while the button is down.

Can I make the render faster on a slow laptop?

Set Quality to 75 % or 50 %. The canvas renders fewer pixels and scales them up, which helps heavy raymarching shaders.

What video format is recorded?

WebM with VP9 or VP8 in most browsers, or MP4 where the browser only supports that. The file is created in your browser.

Are my shaders saved?

Yes, in this browser's local storage. Use Save file to keep a backup or move them to another computer.

Guides for this tool

Completely freeNo cost, no sign-up
Files stay privateEverything runs in your browser
Easy in your languageAvailable in many languages