Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Comprehensive guide for developing WebGPU-enabled Three.js applications using TSL (Three.js Shading Language). Covers WebGPU renderer setup, TSL syntax and node materials, compute shaders, post-processing effects, and WGSL integration. Use this skill when working with Three.js WebGPU, TSL shaders, node materials, or GPU compute in Three.js.
| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-01 | ✗→✓ | ▲ Improved | -5% | 0% |
| case-02 | ✗→✓ | ▲ Improved | -4% | 0% |
| case-03 | ✗→✓ | ▲ Improved | 5% | 0% |
| case-09 | ✗→✓ | ▲ Improved | 12% | 0% |
| case-10 | ✗→✓ | ▲ Improved | -11% | 0% |
<!-- source: webgpu-threejs-tsl — https://raw.githubusercontent.com/dgreenheck/webgpu-claude-skill/main/skills/webgpu-threejs-tsl/SKILL.md -->
TSL (Three.js Shading Language) is a node-based shader abstraction that lets you write GPU shaders in JavaScript instead of GLSL/WGSL strings.
javascriptimport * as THREE from 'three/webgpu'; import { color, time, oscSine } from 'three/tsl'; const renderer = new THREE.WebGPURenderer(); await renderer.init(); const material = new THREE.MeshStandardNodeMaterial(); material.colorNode = color(0xff0000).mul(oscSine(time));
docs/core-concepts.md - Types, operators, uniforms, control flowdocs/materials.md - Node materials and all propertiesdocs/compute-shaders.md - GPU compute with instanced arraysdocs/post-processing.md - Built-in and custom effectsdocs/wgsl-integration.md - Custom WGSL functionsdocs/device-loss.md - Handling GPU device loss and recoverydocs/limits-and-features.md - WebGPU device limits and optional featuresexamples/basic-setup.js - Minimal WebGPU projectexamples/custom-material.js - Custom shader materialexamples/particle-system.js - GPU compute particlesexamples/post-processing.js - Effect pipelineexamples/earth-shader.js - Complete Earth with atmospheretemplates/webgpu-project.js - Starter project templatetemplates/compute-shader.js - Compute shader templateREFERENCE.md - Quick reference cheatsheetjavascript// Always use the WebGPU entry point import * as THREE from 'three/webgpu'; import { /* TSL functions */ } from 'three/tsl';
Replace standard material properties with TSL nodes:
javascriptmaterial.colorNode = texture(map); // instead of material.map material.roughnessNode = float(0.5); // instead of material.roughness material.positionNode = displaced; // vertex displacement
TSL uses method chaining for operations:
javascript// Instead of: sin(time * 2.0 + offset) * 0.5 + 0.5 time.mul(2.0).add(offset).sin().mul(0.5).add(0.5)
Use Fn() for reusable shader logic:
javascriptconst fresnel = Fn(([power = 2.0]) => { const nDotV = normalWorld.dot(viewDir).saturate(); return float(1.0).sub(nDotV).pow(power); });
webgpu_)Other measured skills in the registry, with their headline benchmark lift.