← ClaudeAtlas

webgpu-tsl-3dlisted

Use Three.js WebGPURenderer and TSL (Three Shading Language) node materials to build next-generation web 3D — compute-shader particles (millions), GPU simulations, node-based materials that compile to WGSL and GLSL, post-processing with the node pipeline, and graceful WebGL fallback. Use when a 3D site needs effects beyond WebGL limits, massive particle counts, GPU compute, or when the user asks for WebGPU/TSL.
RaveenDi/Skilloadout · ★ 0 · AI & Automation · score 78
Install: claude install-skill RaveenDi/Skilloadout
# WebGPU & TSL for Next-Gen Web 3D WebGPU unlocks **compute shaders** — millions of particles, fluid/cloth simulations, GPU culling — while TSL lets you write shaders once in JavaScript that compile to WGSL (WebGPU) and GLSL (WebGL 2 fallback). ## Setup ```js import * as THREE from "three/webgpu"; // WebGPU build (includes node materials) import { color, uv, time, sin, positionLocal, mix, vec3, uniform, Fn, instanceIndex, storage, hash } from "three/tsl"; const renderer = new THREE.WebGPURenderer({ antialias: true }); await renderer.init(); // required before first render/compute renderer.setPixelRatio(Math.min(devicePixelRatio, 1.5)); // Automatically falls back to a WebGL 2 backend when WebGPU is unavailable. ``` Check `renderer.backend.isWebGPUBackend` to enable compute-heavy features only on WebGPU. ## TSL node materials ```js const uProgress = uniform(0); // drive from scroll const mat = new THREE.MeshStandardNodeMaterial(); const wave = sin(positionLocal.y.mul(6).add(time.mul(2))).mul(0.05).mul(uProgress); mat.positionNode = positionLocal.add(vec3(wave, 0, wave)); mat.colorNode = mix(color("#1b1f3a"), color("#ff7a45"), uv().y.add(wave.mul(4))); mat.roughnessNode = uProgress.oneMinus().mul(0.6).add(0.2); ``` - Nodes are composable functions: build a small library (`noise3`, `fresnel`, `dissolveMask`) and reuse them across materials. - Update uniforms from JS each frame (`uProgress.value = damped`), never reb