๐ Introduction
Welcome to the ShaderShop Documentation. ShaderShop is a modern, high-performance browser-based IDE and social community designed for crafting real-time WebGL and GLSL shaders directly on your GPU.
Whether you are creating generative art, audio-reactive visuals, physical simulations, or game VFX, this guide covers everything you need to know: shader fundamentals, the built-in uniforms system, multi-pass ping-pong buffers, and one-click exports to platforms like ShaderToy, Three.js, WebGPU, and Unity URP.
๐จ Creating Your First Shader
Creating your first shader in ShaderShop takes less than 30 seconds. Fragment shaders execute once for every single pixel on your screen simultaneously in parallel.
Here is the minimal boilerplate required to output solid black:
// Minimal Fragment Shader
#ifdef GL_ES
precision mediump float;
#endif
uniform vec2 u_resolution;
uniform float u_time;
void main() {
// gl_FragColor expects RGBA values in range 0.0 to 1.0
gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);
}
Click the Compile button in the bottom left or press Ctrl + Enter. Congratulations! You have compiled your first real-time GPU shader.
โญ Making a Circle (Signed Distance Basics)
Now let's render a smooth, glowing circle. Unlike traditional 2D canvas drawing where you stroke paths, GLSL works with mathematical coordinate fields.
- Normalize pixel coordinates
gl_FragCoord.xyusingu_resolution.xyso the viewport ranges from0.0to1.0. - Center the coordinates around the origin
(0.0, 0.0)and correct the aspect ratio. - Use the built-in GLSL
length()function to calculate Euclidean distance from the center.
#ifdef GL_ES
precision mediump float;
#endif
uniform vec2 u_resolution;
uniform float u_time;
void main() {
// Normalize coordinates: (0, 0) at center of screen
vec2 uv = (gl_FragCoord.xy * 2.0 - u_resolution.xy) / min(u_resolution.x, u_resolution.y);
// Compute distance from center
float dist = length(uv);
// Create a circle with radius 0.4 and anti-aliased edge
float radius = 0.4;
float circle = smoothstep(radius + 0.01, radius - 0.01, dist);
// Modulate color with brand purple
vec3 color = vec3(0.58, 0.28, 0.78) * circle;
gl_FragColor = vec4(color, 1.0);
}
Because the shader runs across millions of GPU cores in parallel, the calculation produces crisp, instantaneous graphics at 60+ FPS.
๐ก What is GLSL?
OpenGL Shading Language (GLSL) is a high-level shading language based on C. It gives graphics programmers direct, low-overhead access to the GPU rendering pipeline.
In standard CPU programming (like JavaScript or Python), loops execute instructions sequentially. On the GPU, GLSL executes your fragment shader program concurrently across thousands of streaming processors for every single pixel on screen.
- Vertex Shaders: Transform 3D geometry, vertices, normals, and model matrices into 2D screen projections.
- Fragment Shaders (Pixel Shaders): Calculate the final RGBA color, lighting, texture lookups, and visual effects for every rasterized pixel. In ShaderShop, you write full fragment shaders.
- Strongly Typed: Types are strictly checked at compile time. Explicit casting is mandatory (e.g., write
1.0instead of1for floating point calculations).
โก Uniform Variables Reference
Uniforms are global read-only variables supplied by ShaderShop to your GLSL shader on every frame. You do not need to register them manuallyโthey are automatically bound to the WebGL context:
| Uniform Name | Type | Description |
|---|---|---|
| u_time | float | Playback time in seconds. Increments during playback, pauses with controls, and scrubs interactively with the timeline slider. |
| u_stime | float | Active playback time in seconds since the shader was first compiled (scrubs and syncs with the timeline). |
| u_resolution | vec2 | Canvas viewport dimensions (width, height) in physical pixels, respecting retina device pixel ratios. |
| u_mouse | vec4 | Interactive cursor state: xy = current normalized coordinate (0.0 to 1.0), zw = last click location. |
| u_frame | float | Monotonically increasing render frame counter (0, 1, 2, ...). |
| u_timedelta | float | Time elapsed between consecutive render frames in seconds (~0.0166s at 60 FPS, 0.0 when paused). Aliased as u_dtime and deltaTime. |
| u_channel0 โ u_channel3 | sampler2D | 4 independent texture buffers for procedural noise presets, uploaded images, video loops, live webcam, or multi-pass ping-pong buffers. |
| u_channelresolution[4] | vec2[4] | Dimensions (width, height) in pixels for each of the 4 active channel texture slots. |
| u_keys | vec4 | Keyboard directional states: x = Left/A, y = Right/D, z = Up/W, w = Down/S (1.0 = active). |
| u_key_space | float | 1.0 when the Spacebar key is pressed or held, 0.0 when released. |
| u_audio | vec4 | Real-time FFT audio spectrum energy bands: x = Bass, y = Mid, z = Treble, w = Overall Energy (normalized 0.0 to 1.0). |
๐ผ๏ธ Using Media Channels (Channels 0โ3)
ShaderShop includes a 4-slot media buffer tray located directly beneath the code editor. Each slot can be bound to any media source:
- Audio Reactivity: Synthetic rhythm loops (Synthwave, Cyberpunk, Ambient), local MP3/WAV uploads, or live microphone input.
- Multi-Pass Buffers: Route double-buffered ping-pong texture outputs from Buffer A, B, C, or D.
- Procedural Presets: White Noise, Perlin Noise (fBm), Voronoi Cellular, Checkerboard, Normal Maps, or Color Spectrum LUT.
- Custom Image Files: PNG, JPG, or WebP images from your computer.
- Video Files: MP4 or WebM looping video clips synced to the editor timeline.
- Live Webcam Stream: Real-time hardware camera feed via
navigator.mediaDevices.getUserMedia.
// Sample texture from Channel 0
vec2 uv = gl_FragCoord.xy / u_resolution.xy;
vec3 baseColor = texture2D(u_channel0, uv).rgb;
// Combine with procedural noise from Channel 1
vec3 noise = texture2D(u_channel1, uv * 2.5).rgb;
vec3 finalColor = baseColor * noise;
gl_FragColor = vec4(finalColor, 1.0);
๐ต Audio Reactivity & FFT Analysis
ShaderShop includes a built-in Web Audio API engine capable of analyzing live microphone audio, custom sound files, or zero-dependency synthetic audio generators:
1. Direct Uniform Access: u_audio
The easiest way to react to sound without sampling textures is through the u_audio uniform:
float bass = u_audio.x; // Low frequencies (20 - 150 Hz)
float mid = u_audio.y; // Mid frequencies (vocals & instruments)
float treble = u_audio.z; // High frequencies (cymbals & sparkle)
float energy = u_audio.w; // Overall RMS audio amplitude
2. ShaderToy 512ร2 Audio Texture
When a channel is bound to audio, it receives a 512ร2 audio data texture matching ShaderToy's specification:
y = 0.25(Row 0): 512 Fast Fourier Transform (FFT) frequency spectrum samples.y = 0.75(Row 1): 512 raw time-domain audio waveform samples.
// Sample frequency spectrum at normalized frequency x
float freq = texture2D(u_channel0, vec2(uv.x, 0.25)).r;
// Sample raw audio waveform
float wave = texture2D(u_channel0, vec2(uv.x, 0.75)).r;
โจ๏ธ Interactive Keyboard Input
Build games, raymarched camera controllers, and interactive installations using real-time keyboard uniforms:
vec2 playerPos = vec2(0.0);
// Horizontal movement: Left / A (-x), Right / D (+x)
playerPos.x += (u_keys.y - u_keys.x) * 0.05;
// Vertical movement: Down / S (-y), Up / W (+y)
playerPos.y += (u_keys.z - u_keys.w) * 0.05;
// Action button via Spacebar
if (u_key_space > 0.5) {
// Trigger particle blast or boost!
}
๐ Multi-Pass Buffers & Ping-Pong FBOs
Create advanced GPU simulationsโincluding fluid dynamics, cellular automata (Conway's Game of Life), motion blur, and reaction-diffusionโusing ShaderShop's Multi-Pass Architecture:
- Pass Tabs (Buffer A, B, C, D, Image): Dynamically add or remove passes using the
+ Pass โพdropdown in the editor toolbar. - Topological Execution: Passes evaluate in strict sequence:
Buffer A โ Buffer B โ Buffer C โ Buffer D โ Image (Canvas Output). - Zero Feedback Loop Hazards: Each buffer pass manages two internal WebGL framebuffers (FBOs) in a double-buffered ping-pong configuration. A pass can safely sample its own texture from the previous frame without WebGL memory corruption or driver warnings.
- The "Common" Tab: Write shared math functions, raymarching distance functions, or color palettes once. ShaderShop automatically injects Common code into every active pass before compilation, preserving accurate line numbers for error highlighting.
vec3 last = texture2D(u_channel0, uv).rgb * 0.96;.
โจ Shader Starter Templates
Kickstart your projects with ready-to-run shaders by clicking the โจ Templates button in the editor toolbar:
Interactive Mouse
Cursor tracking with smooth distance fields, mouse glow, and interactive particle repulsion.
Audio Spectrum
Real-time FFT audio visualizer reacting to bass, mids, and highs with built-in synth rhythm loops.
Texture Sampler
Multi-channel sampling with procedural fractal noise, chromatic aberration, and dynamic UV warping.
Multi-Pass Feedback
Buffer A temporal decay ping-pong feedback loop with interactive trailing cursor motion blur.
Pulsing Waves
Harmonic concentric circular waves with interactive mouse ripples and customizable color gradients.
๐ Exporting & Cross-Platform Transpilers
ShaderShop gives you full portability. Convert your shaders to run across modern game engines, web graphics libraries, and native platforms:
Standalone HTML Webpage
Click Export Webpage to generate a completely self-contained .html file with embedded WebGL canvas, scrubber controls, and keyboard listeners with zero external npm or server dependencies. Runs offline anywhere!
ShaderToy Export
Use the Shader Converter to translate uniforms to ShaderToy format (iTime, iResolution, iMouse, iChannel0..3) and output a clean mainImage() entry block.
Three.js Material
Automatically wraps your code into a ready-to-run THREE.ShaderMaterial with vertex/fragment shaders and includes downloadable HTML scene boilerplate.
WebGPU (WGSL)
Translates GLSL into W3C WebGPU Shading Language (WGSL) with typed structs, @group(0) @binding(0) uniform bindings, and complete WebGPU pipeline HTML boilerplate.
Apple Metal (MSL)
Translates shaders into Apple Metal Shading Language with #include <metal_stdlib>, SIMD vector math (float2, float4), and [[stage_in]] signatures for iOS and macOS.
Unity Engine (URP & Built-in)
Use the ShaderShop to Unity Converter to produce production-ready .shader files with support for Universal Render Pipeline (URP) and Inspector Material properties.
๐ Performance Analytics HUD & GPU Diagnostics
ShaderShop includes a built-in GPU telemetry overlay directly inside the canvas viewport, allowing you to monitor frame times, identify rendering bottlenecks, and scale resolution:
Rolling FPS & Frame Time
A rolling 30-frame window monitors average FPS, delta time in milliseconds, and frame jitter with color-coded status badges.
Resolution Scaling (0.25x โ 2.0x)
Benchmark raymarching shaders by adjusting viewport render resolution dynamically with 0.25x, 0.5x, 1.0x, and 2.0x Retina multipliers.
VRAM & Draw Call Tracking
Tracks active multi-pass render passes, WebGL draw calls, and estimates off-screen framebuffer texture VRAM allocation in megabytes.
HUD Hotkey
Press H on your keyboard or click the floating badge on the canvas at any time to toggle the full diagnostic inspection panel.
๐ฌ Community Comments, Fork Lineage & Embeds
Collaborate with the global graphics community and embed your creations anywhere on the web:
Cloud Comments & Feedback
Discuss algorithms, share optimization techniques, and report issues directly on any published shader.
Fork Lineage & Attribution
When you remix a public shader, a Forked from badge automatically links back to the original creator's tree.
Embed Any Shader Anywhere
Click Share in the editor toolbar to generate a responsive HTML iframe embed code for blogs, documentation, portfolios, and Medium articles: