NEW Browse AI tools across categories — updated daily. See what's new →

Ralph Gpu

Minimal WebGPU shader library for creative coding and real-time graphics. Provides fullscreen passes, particles, compute shaders, render targets, and ping-pong…

Authorvercel
Version1.0.0
LicenseMIT
Token count~2,218
UpdatedJun 5, 2026

Install

Quick install

via npx skills · works with 57+ agents
npx skills add https://github.com/vercel-labs/ralph-gpu/tree/HEAD/SKILLS/ralph-gpu
Or pick agent:
npx skills add vercel-labs/ralph-gpu --skill ralph-gpu --agent claude-code
npx skills add vercel-labs/ralph-gpu --skill ralph-gpu --agent cursor
npx skills add vercel-labs/ralph-gpu --skill ralph-gpu --agent codex
npx skills add vercel-labs/ralph-gpu --skill ralph-gpu --agent opencode
npx skills add vercel-labs/ralph-gpu --skill ralph-gpu --agent github-copilot
npx skills add vercel-labs/ralph-gpu --skill ralph-gpu --agent windsurf
More install options

Shorthand — useful for multi-skill repos:

npx skills add vercel-labs/ralph-gpu --skill ralph-gpu

Manual — clone the repo and drop the folder into your agent's skills directory:

git clone https://github.com/vercel-labs/ralph-gpu.git
cp -r ralph-gpu/SKILLS/ralph-gpu ~/.claude/skills/
How to use: Once installed, ask your agent to "use the ralph-gpu skill" or describe what you want (e.g. "Minimal WebGPU shader library for creative coding and real-time graphics. Provid"). Requires Node.js 18+.

ralph-gpu

Minimal WebGPU shader library for creative coding and real-time graphics. Provides fullscreen passes, particles, compute shaders, render targets, and ping-pong…

ralph-gpuby vercel

Minimal WebGPU shader library for creative coding and real-time graphics. Provides fullscreen passes, particles, compute shaders, render targets, and ping-pong…

npx skills add https://github.com/vercel-labs/ralph-gpu --skill ralph-gpuDownload ZIPGitHub

ralph-gpu

A minimal WebGPU shader library for creative coding and real-time graphics.

When to Use

Use this skill when:

  • Building WebGPU shader effects, creative coding projects, or real-time graphics
  • Working with fullscreen shader passes, particle systems, or compute shaders
  • Need guidance on ralph-gpu API, render targets, or WGSL shader patterns
  • Implementing GPU-accelerated simulations or visual effects

Installation

`npm install ralph-gpu
# For TypeScript support:
npm install -D @webgpu/types
`

Core Concepts

ConceptDescriptiongpuModule entry point for initializationctxGPU context — manages state and renderingpassFullscreen shader (fragment only, uses internal quad)materialShader with custom vertex code (particles, geometry)targetRender target (offscreen texture)pingPongPair of render targets for iterative effectscomputeCompute shader for GPU-parallel computationstorageStorage buffer for large data (particles, simulations)samplerCustom texture sampler with explicit filtering/wrappingtextureLoad images, canvases, video, or raw data as GPU textures

Auto-Injected Globals

Every shader automatically has access to these uniforms:

`struct Globals {
resolution: vec2f, // Current render target size in pixels
time: f32, // Seconds since init
deltaTime: f32, // Seconds since last frame
frame: u32, // Frame count since init
aspect: f32, // resolution.x / resolution.y
}
@group(0) @binding(0) var<uniform> globals: Globals;
`

Quick Start

`import { gpu } from "ralph-gpu";

// Check support
if (!gpu.isSupported()) {
console.error("WebGPU not supported");
return;
}

// Initialize
const ctx = await gpu.init(canvas, { autoResize: true });

// Create fullscreen shader pass
const pass = ctx.pass(\`
@fragment
fn main(@builtin(position) pos: vec4f) -> @location(0) vec4f {
let uv = pos.xy / globals.resolution;
return vec4f(uv, sin(globals.time) * 0.5 + 0.5, 1.0);
}
\`);

// Render loop
function frame() {
pass.draw();
requestAnimationFrame(frame);
}
frame();
`

API Overview

Context Creation

`const ctx = await gpu.init(canvas, {
autoResize?: boolean, // Auto-handle canvas sizing (default: false)
dpr?: number, // Device pixel ratio
debug?: boolean, // Enable debug mode
events?: { // Event tracking
enabled: boolean,
types?: string[],
historySize?: number
}
});
`

Fullscreen Passes

`// Simple mode (auto-generated bindings)
const pass = ctx.pass(wgslCode, {
uTexture: someTarget,
color: [1, 0, 0],
intensity: 0.5
});
pass.set("intensity", 0.8); // Update uniforms

// Manual mode (explicit bindings)
const pass = ctx.pass(wgslCode, {
uniforms: {
myValue: { value: 1.0 }
}
});
pass.uniforms.myValue.value = 2.0;
`

Render Targets

`const target = ctx.target(512, 512, {
format?: "rgba8unorm" | "rgba16float" | "r16float" | "rg16float",
filter?: "linear" | "nearest",
wrap?: "clamp" | "repeat" | "mirror",
usage?: "render" | "storage" | "both"
});

ctx.setTarget(target); // Render to target
ctx.setTarget(null); // Render to screen
`

Ping-Pong Buffers

`const simulation = ctx.pingPong(128, 128, {
format: "rgba16float"
});

// In render loop:
uniforms.inputTex.value = simulation.read;
ctx.setTarget(simulation.write);
processPass.draw();
simulation.swap();
`

Particles (Instanced Quads)

`const particles = ctx.particles(1000, {
shader: wgslCode, // Full vertex + fragment shader
bufferSize: 1000 * 16, // Buffer size in bytes
blend: "additive"
});

particles.write(particleData); // Float32Array
particles.draw();
`

Compute Shaders

`const compute = ctx.compute(\`
@compute @workgroup_size(64)
fn main(@builtin(global_invocation_id) id: vec3<u32>) {
// GPU computation
}
\`);

compute.storage("buffer", storageBuffer);
compute.dispatch(Math.ceil(count / 64));
`

Storage Buffers

`const buffer = ctx.storage(byteSize);
buffer.write(new Float32Array([...]));

// Bind to shader
pass.storage("dataBuffer", buffer);
`

Texture Loading

`// From URL (async)
const tex = await ctx.texture("image.png");

// From canvas / video / ImageBitmap (sync)
const tex = ctx.texture(canvas);

// From raw pixel data (sync)
const tex = ctx.texture(new Uint8Array(data), { width: 256, height: 256 });

// Options
const tex = await ctx.texture("photo.jpg", {
filter: "linear", // "linear" | "nearest"
wrap: "repeat", // "clamp" | "repeat" | "mirror"
format: "rgba8unorm", // GPU texture format
flipY: true, // Flip vertically on load
});

// Bind to shader (manual mode)
const pass = ctx.pass(shader, {
uniforms: {
uTex: { value: tex }, // .texture and .sampler auto-bound
}
});

// Update from live source (canvas, video)
tex.update(videoElement);

// Clean up
tex.dispose();
`

Important Notes

WGSL Alignment: array<vec3f> has 16-byte stride, not 12. Always pad to 16 bytes:

`// Correct: [x, y, z, 0.0] per element
const buffer = ctx.storage(count * 16);
`

Particle Rendering: Use instanced quads, not point-list (WebGPU points are always 1px)

Texture References: Target references stay valid after resize — no need to update uniforms

Screen Readback: Cannot read pixels from screen, only from render targets

Examples

Full working examples extracted from the docs app:

  • Simple Gradient — The simplest possible shader — map UV coordinates to colors. This creates a gradient from black (bottom-left) to cyan (top-right).
  • Animated Wave — A glowing sine wave with custom uniforms. The wave animates over time using globals.time.
  • Time-Based Color Cycling — A hypnotic pattern that cycles through colors over time. Combines time, distance, and angle for a mesmerizing effect.
  • Raymarching Sphere — A basic 3D sphere rendered using raymarching. This demonstrates how to create 3D shapes and lighting entirely within a fragment shader.
  • Perlin-style Noise — Layered fractional Brownian motion (fBm) noise. This technique is fundamental for generating procedural textures, terrain, and natural-looking patterns.
  • Metaballs — Organic-looking "blobs" that merge together based on an implicit surface. This effect uses a distance-based field and a threshold to create smooth blending.
  • Mandelbrot Set — The classic complex number fractal. This shader computes the set by iterating z = z² + c and mapping the escape time to vibrant colors.
  • Alien Planet — A procedurally generated alien world with atmospheric scattering and an orbiting moon. Uses raymarching with fBm noise for terrain detail.
  • Fluid Simulation — Real-time Navier-Stokes fluid simulation using ping-pong buffers, vorticity confinement, and pressure projection.
  • Triangle Particles — GPU-driven particle system with SDF-based physics. 30,000 particles spawn on triangle edges and flow along a signed distance field with chromatic aberration postprocessing.

Resources

  • GitHub Repository
  • API Documentation
  • WebGPU Specification

More skills from vercel

agent-friendly-apisby vercelCompanion skill for the Agent-Friendly APIs course on Vercel Academy. Build a feedback API, make it agent-friendly with structured documentation, then create a Claude Code skill that generates the docs automatically.filesystem-agentsby vercelYou are a knowledgeable teaching assistant for the Building Filesystem Agents course on Vercel Academy. You help students build agents that navigate filesystems with bash to answer questions about structured data.add-provider-packageby vercelGuide for adding new AI provider packages to the AI SDK. Use when creating a new @ai-sdk/<provider> package to integrate an AI service into the SDK.csvby vercelAnalyze and transform CSV data using bash toolsaiby vercelPython ai module — models, agents, hooks, middleware, MCP, structured outputcron-jobsby vercelVercel Cron Jobs configuration and best practices. Use when adding, editing, or debugging scheduled tasks in vercel.json.frontend-designby vercelCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, artifacts,…vercel-react-best-practicesby vercelReact and Next.js performance optimization guidelines from Vercel Engineering. This skill should be used when writing, reviewing, or refactoring React/Next.js…

---

Source: https://github.com/vercel-labs/ralph-gpu/tree/HEAD/SKILLS/ralph-gpu
Author: vercel
Discovered via: mcpservers.org

SKILL.md source

---
name: ralph-gpu
description: Minimal WebGPU shader library for creative coding and real-time graphics. Provides fullscreen passes, particles, compute shaders, render targets, and ping-pong…
---

# ralph-gpu

Minimal WebGPU shader library for creative coding and real-time graphics. Provides fullscreen passes, particles, compute shaders, render targets, and ping-pong…

# ralph-gpuby vercel
Minimal WebGPU shader library for creative coding and real-time graphics. Provides fullscreen passes, particles, compute shaders, render targets, and ping-pong…

`npx skills add https://github.com/vercel-labs/ralph-gpu --skill ralph-gpu`Download ZIPGitHub

## ralph-gpu

A minimal WebGPU shader library for creative coding and real-time graphics.

## When to Use

Use this skill when:

* Building WebGPU shader effects, creative coding projects, or real-time graphics

* Working with fullscreen shader passes, particle systems, or compute shaders

* Need guidance on ralph-gpu API, render targets, or WGSL shader patterns

* Implementing GPU-accelerated simulations or visual effects

## Installation

```
`npm install ralph-gpu
# For TypeScript support:
npm install -D @webgpu/types
`
```

## Core Concepts

ConceptDescription`gpu`Module entry point for initialization`ctx`GPU context — manages state and rendering`pass`Fullscreen shader (fragment only, uses internal quad)`material`Shader with custom vertex code (particles, geometry)`target`Render target (offscreen texture)`pingPong`Pair of render targets for iterative effects`compute`Compute shader for GPU-parallel computation`storage`Storage buffer for large data (particles, simulations)`sampler`Custom texture sampler with explicit filtering/wrapping`texture`Load images, canvases, video, or raw data as GPU textures

## Auto-Injected Globals

Every shader automatically has access to these uniforms:

```
`struct Globals {
resolution: vec2f, // Current render target size in pixels
time: f32, // Seconds since init
deltaTime: f32, // Seconds since last frame
frame: u32, // Frame count since init
aspect: f32, // resolution.x / resolution.y
}
@group(0) @binding(0) var<uniform> globals: Globals;
`
```

## Quick Start

```
`import { gpu } from "ralph-gpu";

// Check support
if (!gpu.isSupported()) {
console.error("WebGPU not supported");
return;
}

// Initialize
const ctx = await gpu.init(canvas, { autoResize: true });

// Create fullscreen shader pass
const pass = ctx.pass(\`
@fragment
fn main(@builtin(position) pos: vec4f) -> @location(0) vec4f {
let uv = pos.xy / globals.resolution;
return vec4f(uv, sin(globals.time) * 0.5 + 0.5, 1.0);
}
\`);

// Render loop
function frame() {
pass.draw();
requestAnimationFrame(frame);
}
frame();
`
```

## API Overview

### Context Creation

```
`const ctx = await gpu.init(canvas, {
autoResize?: boolean, // Auto-handle canvas sizing (default: false)
dpr?: number, // Device pixel ratio
debug?: boolean, // Enable debug mode
events?: { // Event tracking
enabled: boolean,
types?: string[],
historySize?: number
}
});
`
```

### Fullscreen Passes

```
`// Simple mode (auto-generated bindings)
const pass = ctx.pass(wgslCode, {
uTexture: someTarget,
color: [1, 0, 0],
intensity: 0.5
});
pass.set("intensity", 0.8); // Update uniforms

// Manual mode (explicit bindings)
const pass = ctx.pass(wgslCode, {
uniforms: {
myValue: { value: 1.0 }
}
});
pass.uniforms.myValue.value = 2.0;
`
```

### Render Targets

```
`const target = ctx.target(512, 512, {
format?: "rgba8unorm" | "rgba16float" | "r16float" | "rg16float",
filter?: "linear" | "nearest",
wrap?: "clamp" | "repeat" | "mirror",
usage?: "render" | "storage" | "both"
});

ctx.setTarget(target); // Render to target
ctx.setTarget(null); // Render to screen
`
```

### Ping-Pong Buffers

```
`const simulation = ctx.pingPong(128, 128, {
format: "rgba16float"
});

// In render loop:
uniforms.inputTex.value = simulation.read;
ctx.setTarget(simulation.write);
processPass.draw();
simulation.swap();
`
```

### Particles (Instanced Quads)

```
`const particles = ctx.particles(1000, {
shader: wgslCode, // Full vertex + fragment shader
bufferSize: 1000 * 16, // Buffer size in bytes
blend: "additive"
});

particles.write(particleData); // Float32Array
particles.draw();
`
```

### Compute Shaders

```
`const compute = ctx.compute(\`
@compute @workgroup_size(64)
fn main(@builtin(global_invocation_id) id: vec3<u32>) {
// GPU computation
}
\`);

compute.storage("buffer", storageBuffer);
compute.dispatch(Math.ceil(count / 64));
`
```

### Storage Buffers

```
`const buffer = ctx.storage(byteSize);
buffer.write(new Float32Array([...]));

// Bind to shader
pass.storage("dataBuffer", buffer);
`
```

### Texture Loading

```
`// From URL (async)
const tex = await ctx.texture("image.png");

// From canvas / video / ImageBitmap (sync)
const tex = ctx.texture(canvas);

// From raw pixel data (sync)
const tex = ctx.texture(new Uint8Array(data), { width: 256, height: 256 });

// Options
const tex = await ctx.texture("photo.jpg", {
filter: "linear", // "linear" | "nearest"
wrap: "repeat", // "clamp" | "repeat" | "mirror"
format: "rgba8unorm", // GPU texture format
flipY: true, // Flip vertically on load
});

// Bind to shader (manual mode)
const pass = ctx.pass(shader, {
uniforms: {
uTex: { value: tex }, // .texture and .sampler auto-bound
}
});

// Update from live source (canvas, video)
tex.update(videoElement);

// Clean up
tex.dispose();
`
```

## Important Notes

WGSL Alignment: `array<vec3f>` has 16-byte stride, not 12. Always pad to 16 bytes:

```
`// Correct: [x, y, z, 0.0] per element
const buffer = ctx.storage(count * 16);
`
```

Particle Rendering: Use instanced quads, not point-list (WebGPU points are always 1px)

Texture References: Target references stay valid after resize — no need to update uniforms

Screen Readback: Cannot read pixels from screen, only from render targets

## Examples

Full working examples extracted from the docs app:

* Simple Gradient — The simplest possible shader — map UV coordinates to colors. This creates a gradient from black (bottom-left) to cyan (top-right).

* Animated Wave — A glowing sine wave with custom uniforms. The wave animates over time using globals.time.

* Time-Based Color Cycling — A hypnotic pattern that cycles through colors over time. Combines time, distance, and angle for a mesmerizing effect.

* Raymarching Sphere — A basic 3D sphere rendered using raymarching. This demonstrates how to create 3D shapes and lighting entirely within a fragment shader.

* Perlin-style Noise — Layered fractional Brownian motion (fBm) noise. This technique is fundamental for generating procedural textures, terrain, and natural-looking patterns.

* Metaballs — Organic-looking "blobs" that merge together based on an implicit surface. This effect uses a distance-based field and a threshold to create smooth blending.

* Mandelbrot Set — The classic complex number fractal. This shader computes the set by iterating z = z² + c and mapping the escape time to vibrant colors.

* Alien Planet — A procedurally generated alien world with atmospheric scattering and an orbiting moon. Uses raymarching with fBm noise for terrain detail.

* Fluid Simulation — Real-time Navier-Stokes fluid simulation using ping-pong buffers, vorticity confinement, and pressure projection.

* Triangle Particles — GPU-driven particle system with SDF-based physics. 30,000 particles spawn on triangle edges and flow along a signed distance field with chromatic aberration postprocessing.

## Resources

* GitHub Repository

* API Documentation

* WebGPU Specification

## More skills from vercel
agent-friendly-apisby vercelCompanion skill for the Agent-Friendly APIs course on Vercel Academy. Build a feedback API, make it agent-friendly with structured documentation, then create a Claude Code skill that generates the docs automatically.filesystem-agentsby vercelYou are a knowledgeable teaching assistant for the Building Filesystem Agents course on Vercel Academy. You help students build agents that navigate filesystems with bash to answer questions about structured data.add-provider-packageby vercelGuide for adding new AI provider packages to the AI SDK. Use when creating a new @ai-sdk/<provider> package to integrate an AI service into the SDK.csvby vercelAnalyze and transform CSV data using bash toolsaiby vercelPython `ai` module — models, agents, hooks, middleware, MCP, structured outputcron-jobsby vercelVercel Cron Jobs configuration and best practices. Use when adding, editing, or debugging scheduled tasks in vercel.json.frontend-designby vercelCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, artifacts,…vercel-react-best-practicesby vercelReact and Next.js performance optimization guidelines from Vercel Engineering. This skill should be used when writing, reviewing, or refactoring React/Next.js…

---

**Source**: https://github.com/vercel-labs/ralph-gpu/tree/HEAD/SKILLS/ralph-gpu
**Author**: vercel
**Discovered via**: mcpservers.org

Related skills 6

caveman

★ Featured

Ultra-compressed communication mode. Cuts token usage ~75% by speaking like caveman while keeping full technical accuracy. Supports intensity levels: lite, full (default), ultra, wenyan-lite, wenyan-full, wenyan-ultra. Use when user says "caveman mode", "talk like caveman", "use caveman", "less tokens", "be brief", or invokes /caveman. Also auto-triggers when token efficiency is requested.

juliusbrussee 167k
Development

secure-linux-web-hosting

★ Featured

Use when setting up, hardening, or reviewing a cloud server for self-hosting, including DNS, SSH, firewalls, Nginx, static-site hosting, reverse-proxying an app, HTTPS with Let's Encrypt or ACME clients, safe HTTP-to-HTTPS redirects, or optional post-launch network tuning such as BBR.

xixu-me 155k
Development

readme-i18n

★ Featured

Use when the user wants to translate a repository README, make a repo multilingual, localize docs, add a language switcher, internationalize the README, or update localized README variants in a GitHub-style repository.

xixu-me 155k
Development

lark-shared

★ Featured

Use when first setting up lark-cli, running auth login, switching user/bot identity (--as), handling permission denied or scope errors, needing to update lark-cli, or seeing _notice in JSON output.

larksuite 155k
Development

improve-codebase-architecture

★ Featured

Find deepening opportunities in a codebase, informed by the domain language in CONTEXT.md and the decisions in docs/adr/. Use when the user wants to improve architecture, find refactoring opportunities, consolidate tightly-coupled modules, or make a codebase more testable and AI-navigable.

mattpocock 151k
Development

paper-context-resolver

★ Featured

Optional RigorPilot helper for README-first deep learning repo reproduction. Use only when the README and repository files leave a narrow reproduction-critical gap and the task is to resolve a specific paper detail such as dataset split, preprocessing, evaluation protocol, checkpoint mapping, or runtime assumption from primary paper sources while recording conflicts. Do not use for general paper summary, repo scanning, environment setup, command execution, title-only paper lookup, or replacin...

lllllllama 127k
Development