Loading...

WebGL

Passes

Framebuffers

Meshes

Textures

Samplers

Nothing selected.

Preferences

Appearance
Accent hue
Accent saturation
Secondary hue
Surface hue
Animation speed (seconds)
Text size (%)
Code text size (rem)
Control size (px)
Editor
Default render scale
Undo history depth
Snapshot interval (minutes)

Help

How the editor works

The canvas is the page, and nothing resizes it: one sheet lies over it. Held upright, the sheet rises from the bar along the window's foot; turned sideways, that bar stands up as a rail down the window's left and the sheet hangs off it, the window's height, and a shader takes the whole width. The bar's tabs choose what the sheet shows: View is the shader alone, then Code (the outline and the editor), Controls and Debug. Menu, at the bar's one end, slides out the menus; Compile is at its other, and restart and play are at the top right. Compile flashes the canvas's edge green, or red on an error. Upright, drag the sheet's head to resize it, or all the way down to close it. Double-click or double-tap the canvas to hide the sheet and the bars.

The outline is the whole document as a tree, and selecting a row opens it in the editor in the tree's place: a shader's source, or the settings of the document, a pass, a draw, a framebuffer, a mesh or a texture. The sheet's two tabs, Outline and what's selected, go between them, and so does a swipe sideways. A row's ⋯, a right-click on it, or a long press on a row opens its menu: rename, duplicate, move or delete it. A shader's ▾ renames it, or picks another for the pass.

Passes run in order, top to bottom. Each runs a vertex and a fragment shader and one or more draws, and renders to the screen, a framebuffer, or transform feedback; the last pass always draws to the screen. Each draw has its pipeline settings (blend, depth, stencil, cull, scissor, clear) on its row. Passes and their draws are all that has an order.

Objects (framebuffers, meshes, textures, samplers) are what draws bind: a draw's Target and Mesh rows pick one or make another, a Target's gear opens the one picked, and a Mesh's gear opens how the draw draws it: its mode, count and buffers. Each draw holds its own uniform values; a draw's ⋯ copies them, its textures and its mesh, and another's pastes them. The outline lists them all under the passes, a group of each kind with its +, each row’s ⋯ renaming or deleting it. A pass's settings list its sets under them instead: what its shaders read without declaring it. Framebuffers are named off-screen targets; a draw picks one as its Target (the draw's row, Target), and later passes sample its attachments as u_channel0, u_channel1 and on, in the order a pass's Samplers list. An attachment's Sampler name is another way to sample it, once a shader declares uniform sampler2D by that name. Meshes are vertex buffers a draw reads, imported from .obj or the library. Textures are images a shader samples by name: the library's built-in and generated ones upload, and an image uploads too, a shader's images 160 KB at most.

Controls has time, resolution and the input uniforms; Debug has the compile log, the GPU objects, and a published shader's page, with Share. A shader's Head, above its text, lists the built-in uniforms it can read (u_time, u_mouse and the rest), what each holds and in what units. A uniform the shader declares itself gets its value on its draw, under Uniforms.

Work is kept in this browser as you type. File → Save keeps a named copy, File → Restore lists everything kept, and File → Upload publishes the shader.

Keyboard shortcuts
Alt+NNew shader
Ctrl+SSave
Ctrl+Shift+SSave as
Ctrl+OOpen a file
Ctrl+ZUndo
Ctrl+Shift+Z / Ctrl+YRedo
Ctrl+EnterCompile
SpacePlay / pause
F11Fullscreen
Alt+IImport pieces of another document
Alt+LLibrary
Alt+PAdd a pass
Alt+Up / Alt+DownMove the selected pass or draw
1 / 2 / 3Show or hide the outline, the editor, Controls or Debug
FFocus mode
.Step one frame
HomeRestart time
EscapeClose menu or dialog
Tab / Shift+TabInsert a tab, or indent and outdent the selected lines, in a shader
Ctrl+/Comment the selected lines out or back in, in a shader
Escape, then TabLeave a shader for the next control
Drop files on the pageOpen them, or add them to this shader: a shader document, glTF with its .bin, .obj, or shader text

On macOS use Cmd in place of Ctrl, and Option in place of Alt. Single-key shortcuts are ignored while you are typing, and while a button or a switch has the focus, where Space presses it.

GLSL / WebGL docs
About sh8r

sh8r is a WebGL2 shader editor and gallery. A document is a list of programs, each with its own vertex and fragment shader, pipeline state and draw calls, plus the framebuffer and vertex-buffer resources they share.

Work is kept in this browser as you type. Uploading publishes it under your account and gives you a link anyone can open.

Import

In that document

    Taking

      What’s sent

      What can’t be uploaded stays out, as listed. This is the file as it will be sent, drawn from that file.

      The file
      Download

      Library

      Built in

        Generators

          Texture

          Upload to sh8r.org

          What’s sent

          Report

          Export

          Format

          Export to Shadertoy

          Shadertoy takes a shader only through its editor. In a new shader there, add a tab for each buffer and Common with the + beside its tabs, paste each tab’s text into it, and set its channels as listed below each name.

          Each pixel runs a draw’s vertex shader once per vertex, up to this many runs. A draw past it is cut to fit, and its u_instanceCount and u_vertexCount say what is drawn. Shadertoy slows as this grows.

          Capture

          The capture, as it will be saved

          Restore

          Snapshots of this shader

          Saved

          Working copies

          Originals

          Unsaved working copy

          Loading the original keeps your edits under File → Restore, one undo back.