A high-performance, browser-based visual shader compositor & real-time development environment.
Compose, inspect, and iterate on 3D shaders and materials across WebGPU, WebGL2, and Three.js side-by-side with zero engine overhead.
Shader Studio solves a fundamental bottleneck in graphics development: rapid iteration on shaders and small 3D scenes without the heavyweight overhead and slow compile times of full game engines (Unity, Unreal, Houdini).
With Shader Studio, you can:
- Visually connect Mesh β Material β Post-Process β Output in an interactive node graph.
- Write and edit shader code in your favorite local IDE (VS Code, Cursor, Neovim) with live WebSocket file sync.
- Hot-switch between WebGPU (WGSL), WebGL2 (GLSL ES 3.00), and Three.js in real-time without reloading the page or losing graph state.
- Instantly tweak uniforms via an auto-generated parameter control panel that mutates GPU buffers directly without triggering shader recompilation.
- Build multi-pass post-processing chains with real ping-pong render targets.
- Benefit from bulletproof error resilience: broken shaders never kill your session, thanks to last-good-frame fallback and automatic GPU device-loss recovery.
- Raw WebGPU Adapter (
adapters/webgpu.ts): Direct WGSL pipeline using@groupand@bindingconventions, uniform buffers, and modern GPU rendering passes. - Raw WebGL2 Adapter (
adapters/webgl2.ts): Pure GLSL ES 3.00 pipeline (#version 300 es) with VAOs, VBOs, and uniform location updates. - Three.js Adapter (
adapters/threejs.ts): Interoperability adapter utilizingTHREE.ShaderMaterialand built-in geometries. - Zero Page Reload Backend Switching: Switch dynamically from the toolbar dropdown (
WebGPUβWebGL2βThree.js). Viewport swaps adapters instantly while preserving node graph topology and parameter values. - Independent Adapters: Built without a leaky shared base class, honoring the unique execution models and memory structures of each graphics API.
Compose rendering pipelines with a clean, node-based visual workflow:
- MeshNode: Generates 3D geometries (Cube, Sphere, Plane).
- MaterialNode: Maps geometry to active shader sources (
.wgsl/.glsl) with one-click jump-to-code navigation. - TextureNode: Drag-and-drop image import and GPU texture resource binding.
- UniformNode: Expose custom float, vector, or boolean parameters to the UI before wiring them into shader code.
- TimeNode: Emits real-time elapsed seconds (
u_time) for procedural animation. - PostProcessNode: Stacks chainable post-processing passes (vignette, blur, bloom, chromatic aberration, custom).
- OutputNode: Designates the final render target for screen presentation.
- Graph Compiler (
core/graphCompiler.ts): Validates node connections, topologically sorts backward from the OutputNode, discards disconnected scratch nodes, and generates an optimizedRenderQueue.
Shader Studio prioritizes your native development workflow over constrained in-browser text fields:
- WebSocket Dev-Bridge (Primary & Iframe-Safe): A lightweight Node.js companion script watches your local shader folder and streams changes via WebSockets (
ws://localhost:8642). Works seamlessly even inside sandboxed iframe previews (Lovable, Bolt, Replit). - File System Access API (Secondary): Direct browser folder mounting via
window.showDirectoryPicker()in top-level browser tabs with automatic polling and iframe detection. - Embedded Monaco Editor (Fallback): Built-in Monaco editor with GLSL/WGSL syntax highlighting, 400ms debounced auto-compilation, and offline standalone editing.
- Automatic Uniform Reflection: Regex AST parsers (
parsers/wgslUniforms.ts,parsers/glslUniforms.ts) inspect shader code to discover scalars (float,int,uint,bool), vectors (vec2,vec3,vec4), matrices, arrays, and textures. - Smart Control Inference: Automatically renders color pickers for variables containing
color,tint, oralbedo, sliders for numeric ranges, switches for booleans, and asset drop targets for textures. - Direct GPU Buffer Updates: Adjusting parameters invokes
adapter.updateUniforms()directly, updating GPU memory instantly with zero recompilation overhead.
- Ping-Pong Render Targets: WebGPU textures and WebGL2 Framebuffer Objects (FBOs) chain outputs across consecutive passes.
- Built-in Effects:
- Gaussian Blur (
blur.wgsl/blur.frag) - Vignette (
vignette.wgsl/vignette.frag) - Bloom (
bloom.wgsl/bloom.frag) - Chromatic Aberration (
chromatic_aberration.wgsl/chromatic_aberration.frag) - Passthrough (
passthrough.wgsl/passthrough.frag)
- Gaussian Blur (
- Custom Post-Process Shaders: Dedicated Post-Processing Drawer enables authoring and testing custom post-effect fragment and compute shaders.
- Last-Good-Frame Caching: Compilation errors will never black out your canvas. The viewport retains and presents the last successfully compiled frame.
- Collapsible Error Console: Rich compiler error panel displaying exact shader line, column, and diagnostic messages.
- Device & Context Loss Recovery: Gracefully handles WebGPU
device.lostand WebGL2webglcontextlost/webglcontextrestoredevents, recovering the pipeline automatically without requiring a full browser refresh.
- Project Storage: IndexedDB persistence via Dexie.js for project save, load, and versioning.
- JSON Import / Export: Export entire projects (graph structure, shader sources, and uniform states) as portable JSON files.
- Performance Monitor (
PerfOverlay): Real-time FPS and frame time (ms) counter. - Screenshot Tool: High-resolution one-click PNG viewport capture.
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Shader Studio β
βββββββββββββββββββ¬ββββββββββββββββββββββββββββ¬ββββββββββββββββ€
β Left Panel β Center Workspace β Right Panel β
β β β β
β Node Graph β βββββββββββββββββββββ β Parameters β
β (React Flow) β β Viewport Canvas β β (Reflected UI)β
β β β (WebGPU/GL2/3JS) β β β
β MeshNode β βββββββββββββββββββββ€ βββββββββββββββββ€
β MaterialNode β β Shader Editor β β Asset Drop β
β TextureNode β β (Monaco Fallback) β β & Project DB β
β PostProcessNodeβ βββββββββββββββββββββ β (Dexie.js) β
βββββββββββββββββββ΄ββββββββββββββββββββββββββββ΄ββββββββββββββββ€
β Collapsible Error Diagnostics & Perf Overlay β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
- Independent Render Adapters: WebGPU, WebGL2, and Three.js implement a lightweight common interface (
mount,render,updateUniforms,dispose,recompileShader) without forced inheritance hierarchies. - Native Language Sources: Each material maintains distinct
.wgsland.glslimplementations to leverage backend-specific capabilities and ensure optimal performance without leaky transpilers. - Decoupled Visual State: React Flow retains graph geometry, pan, and zoom, while Zustand manages runtime application state, backend selection, and active uniform buffers.
- Compiled Render Queue: Visual graphs compile into a sequential, validated execution array before reaching the active GPU adapter.
ShaderStudio/
βββ docs/ # Architectural briefs and phase documentation
β βββ phases/ # Phase 0-4 design specifications
βββ public/ # Static assets
βββ scripts/
β βββ bridge.js # Companion WebSocket file watcher bridge
βββ src/
β βββ adapters/ # Graphics backend adapters
β β βββ types.ts # RenderAdapter shared contract
β β βββ webgpu.ts # Raw WebGPU / WGSL adapter
β β βββ webgl2.ts # Raw WebGL2 / GLSL ES 3.00 adapter
β β βββ threejs.ts # Three.js ShaderMaterial adapter
β βββ bridge/ # WebSocket dev-bridge client & message protocol
β β βββ bridgeProtocol.ts # Protocol schemas
β β βββ wsBridgeClient.ts # Client connection manager
β βββ components/ # React UI components
β β βββ nodes/ # React Flow custom node components
β β β βββ MeshNode.tsx
β β β βββ MaterialNode.tsx
β β β βββ TextureNode.tsx
β β β βββ UniformNode.tsx
β β β βββ TimeNode.tsx
β β β βββ PostProcessNode.tsx
β β β βββ OutputNode.tsx
β β βββ panels/ # Resizable panel layouts
β β β βββ Panel.tsx
β β β βββ ResizablePanels.tsx
β β βββ ui/ # UI primitives (Radix UI / Tailwind)
β β βββ ErrorPanel.tsx # Compiler error console
β β βββ FileImporter.tsx # Asset file drag-and-drop
β β βββ NodeGraph.tsx # React Flow visual canvas
β β βββ ParameterPanel.tsx # Auto-generated uniform controls
β β βββ PerfOverlay.tsx # Live FPS / frame time HUD & screenshot
β β βββ PostProcessDrawer.tsx # Custom post-fx editor drawer
β β βββ ProjectPanel.tsx # IndexedDB save/load & JSON export
β β βββ ShaderEditor.tsx # Monaco editor fallback
β β βββ SyncStatusBanner.tsx # IDE sync mode indicator
β β βββ Toolbar.tsx # Top navigation and backend switch
β β βββ Viewport.tsx # Canvas host & lifecycle manager
β βββ core/ # Engine pipeline core
β β βββ graphCompiler.ts # React Flow -> RenderQueue compiler
β β βββ postProcessChain.ts# Ping-pong framebuffer pipeline
β β βββ uniformLayout.ts # Struct byte alignment & GPU buffer layout
β βββ db/ # Dexie.js IndexedDB schema
β βββ parsers/ # WGSL & GLSL uniform reflection parsers
β βββ shaders/ # Default shaders & post-processing filters
β β βββ postprocess/ # Blur, Bloom, Vignette, Chromatic Aberration
β β βββ default.wgsl # Default WebGPU shader
β β βββ default.vert # Default GLSL vertex shader
β β βββ default.frag # Default GLSL fragment shader
β βββ stores/ # Zustand application stores
β β βββ fileSystemStore.ts # Sync status & file handles
β β βββ projectStore.ts # Project state, uniforms, and graph data
β βββ utils/ # Helpers (throttling, formatters)
β βββ App.tsx # Main application layout shell
β βββ main.tsx # Application entry point
βββ tests/ # Comprehensive Vitest test suite
β βββ e2e/ # 5-tier test suites & GPU mocks
βββ index.html # HTML host document
βββ package.json # Dependencies and scripts
βββ vite.config.ts # Vite configuration
- Node.js: v18.0.0 or higher
- Browser: Modern Chromium-based browser with WebGPU support (Chrome 113+, Edge 113+) or modern Firefox / Safari with WebGL2 / WebGPU enabled.
-
Clone the repository:
git clone https://github.com/Binitpyro/ShaderStudio.git cd ShaderStudio -
Install dependencies:
npm install
-
Start the local development server:
npm run dev
Open http://localhost:5173 in your browser.
To edit shader files directly in VS Code, Cursor, or your preferred IDE with live hot-reloading:
-
Launch the bridge companion script, passing the directory containing your shader files:
npm run bridge -- ./src/shaders
(Or specify an optional port:
node scripts/bridge.js ./src/shaders --port 8642) -
Open Shader Studio in your browser. The connection indicator in the toolbar will illuminate green (Synced via local bridge).
-
Any changes saved to
.wgsl,.glsl,.frag, or.vertfiles in that folder will instantly push to Shader Studio and recompile in the viewport.
| Command | Description |
|---|---|
npm run dev |
Starts the Vite development server with hot module reloading. |
npm run build |
Runs TypeScript compilation (tsc -b) and builds production assets with Vite. |
npm run preview |
Previews the production build locally. |
npm run typecheck |
Validates TypeScript types across the entire project without emitting code. |
npm run test |
Executes the Vitest test suite (328 tests across 19 suites). |
npm run bridge |
Starts the WebSocket local IDE file synchronizer script (scripts/bridge.js). |
Shader Studio maintains a rigorous test suite comprising 328 unit, integration, and end-to-end tests organized across 5 distinct tiers:
- Tier 1 (Feature Integrations): GPU uniform buffer alignment (16-byte WGSL rules), topological graph compiler sorting, multi-pass post-processing chains, texture sampler bindings, and render loops.
- Tier 2 (Boundary & Corner Cases): Context/device loss recovery, empty graph states, malformed uniform declarations, invalid texture paths, and rapid backend switching.
- Tier 3 (Cross-Feature Combinations): Simultaneous backend switching with active post-processing chains and animated uniforms.
- Tier 4 (Application Scenarios): Complex multi-node graphs, project serialization round-trips, and project state hydration.
- Tier 5 (Adversarial Stress Testing): Deep uniform nesting, oversized arrays, high-frequency parameter mutations, and concurrent recompile triggers.
Run all tests via:
npm run testDistributed under the MIT License. See LICENSE for full details.
Copyright (c) 2026 Binit Varghese.