/qadri-motion:threejs-impl-webgpufrom qadri-motion
Use when using the Three.js WebGPU renderer, node-based materials, TSL (Three Shading Language), or compute shaders. Prevents the common mistake of not checking browser support, missing async init, or using GLSL with WebGPU. Covers WebGPURenderer, node materials, TSL, compute shaders, WebGL fallback, migration guide. Keywords: WebGPU, WebGPURenderer, TSL, Three Shading Language, node material, compute shader, WGSL, MeshStandardNodeMaterial, next-gen rendering, modern GPU, WebGPU setup.
Ships in qadri-motion. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
EXPERIMENTAL — The WebGPU renderer and TSL are under active development. API surfaces may change between Three.js releases. Pin your Three.js version.
import * as THREE from 'three/webgpu';
const renderer = new THREE.WebGPURenderer({ antialias: true });
await renderer.init(); // MUST await before first render
renderer.setSize(window.innerWidth, window.innerHeight);
renderer.setAnimationLoop(animate);
document.body.appendChild(renderer.domElement);
ALWAYS call await renderer.init() before the first renderer.render() call.
ALWAYS use renderer.setAnimationLoop(callback) instead of requestAnimationFrame.
NEVER call renderer.render() before init() resolves — this throws a runtime error.
| Browser | Version | Status |
|---|---|---|
| Chrome | 113+ | Full support |
| Edge | 113+ | Full support |
| Safari | 18+ | Supported |
| Firefox | Experimental | Behind flag (dom.webgpu.enabled) |
import { WebGPU } from 'three/webgpu';
if (WebGPU.isAvailable()) {
const renderer = new THREE.WebGPURenderer({ antialias: true });
await renderer.init();
} else {
const renderer = new THREE.WebGLRenderer({ antialias: true });
}
ALWAYS check WebGPU.isAvailable() before creating a WebGPURenderer.
ALWAYS provide a WebGLRenderer fallback for unsupported browsers.
NEVER write raw GLSL or WGSL strings — ALWAYS use TSL functions. WebGPU compiles TSL to WGSL automatically. GLSL is NOT supported by the WebGPU backend.
NEVER use ShaderMaterial with WebGPURenderer — use NodeMaterial with TSL instead.
NEVER use requestAnimationFrame with WebGPURenderer — ALWAYS use renderer.setAnimationLoop().
NEVER use EffectComposer (three/examples) with WebGPURenderer — use the PostProcessing class with TSL nodes instead.
Every classic Three.js material has a node-based equivalent. Classic materials auto-convert when used with WebGPURenderer, but node materials provide full TSL customization.
| Classic Material | Node Material |
|---|---|
MeshBasicMaterial | MeshBasicNodeMaterial |
MeshStandardMaterial | MeshStandardNodeMaterial |
MeshPhysicalMaterial | MeshPhysicalNodeMaterial |
MeshPhongMaterial | MeshPhongNodeMaterial |
MeshLambertMaterial | MeshLambertNodeMaterial |
LineBasicMaterial | LineBasicNodeMaterial |
LineDashedMaterial | LineDashedNodeMaterial |
PointsMaterial | PointsNodeMaterial |
SpriteMaterial | SpriteNodeMaterial |
ALWAYS import node materials from 'three/webgpu', not from 'three'.
All properties accept TSL node values. All are optional and override defaults.
Common inputs (all node materials):
| Property | TSL Type | Purpose |
|---|---|---|
.colorNode | vec4 | Base color |
.opacityNode | float | Opacity |
.normalNode | vec3 | Normal map replacement |
.emissiveNode | color | Emissive output |
.positionNode | vec3 | Vertex displacement |
.fragmentNode | vec4 | Full fragment shader replacement |
.vertexNode | vec4 | Full vertex shader replacement |
.outputNode | vec4 | Final output override |
.aoNode | float | Ambient occlusion |
.alphaTestNode | float | Alpha test threshold |
.depthNode | float | Custom depth |
.castShadowNode | vec4 | Shadow casting override |
Standard/Physical inputs:
| Property | TSL Type | Purpose |
|---|---|---|
.metalnessNode | float | Metalness |
.roughnessNode | float | Roughness |
.envNode | color | Environment map |
.lightsNode | — | Lighting model override |
Physical-only inputs: .clearcoatNode, .clearcoatRoughnessNode, .clearcoatNormalNode, .sheenNode, .iridescenceNode, .iridescenceIORNode, .iridescenceThicknessNode, .specularIntensityNode, .specularColorNode, .iorNode, .transmissionNode, .thicknessNode, .attenuationDistanceNode, .attenuationColorNode, .dispersionNode, .anisotropyNode.
TSL is a JavaScript-based node graph system that compiles to GLSL (WebGL2) and WGSL (WebGPU). It replaces raw shader strings entirely.
| Category | Functions |
|---|---|
| Scalars | float(), int(), uint(), bool() |
| Vectors | vec2(), vec3(), vec4(), ivec2(), ivec3(), ivec4(), uvec2(), uvec3(), uvec4() |
| Matrices | mat2(), mat3(), mat4() |
| Color | color() |
| Conversion | .toFloat(), .toVec3(), .toColor() |
| Function | Purpose |
|---|---|
uniform(value) | GPU-side dynamic value |
toVar(node) | Reusable shader variable |
toConst(node) | Inline constant |
varying(node) | Vertex-to-fragment interpolation |
vertexStage(node) | Force computation in vertex shader |
attribute(name, type) | Access buffer attributes |
Uniforms support callbacks: .onRenderUpdate(fn), .onFrameUpdate(fn), .onObjectUpdate(fn).
All operators are chainable on TSL nodes:
.add(), .sub(), .mul(), .div(), .mod().equal(), .notEqual(), .lessThan(), .greaterThan(), .lessThanEqual(), .greaterThanEqual().and(), .or(), .not(), .xor().assign(), .addAssign(), .subAssign(), .mulAssign(), .divAssign().bitAnd(), .bitOr(), .bitXor(), .shiftLeft(), .shiftRight()| Category | Nodes |
|---|---|
| Position | positionGeometry, positionLocal, positionWorld, positionView, positionWorldDirection, positionViewDirection |
| Normal | normalGeometry, normalLocal, normalView, normalWorld |
| Tangent | tangentGeometry, tangentLocal, tangentView, tangentWorld |
| UV | uv(index) |
| Screen | screenUV, screenCoordinate, screenSize |
| Viewport | viewportUV, viewportCoordinate, viewportSize |
cameraNear, cameraFar, cameraPosition, cameraProjectionMatrix, cameraViewMatrix, cameraWorldMatrix, cameraNormalMatrixmodelViewMatrix, modelNormalMatrix, modelWorldMatrix, modelPosition, modelScale, modelDirection| Node | Purpose |
|---|---|
time | Elapsed seconds since start |
deltaTime | Frame delta in seconds |
oscSine(timer) | Sine oscillator (0-1) |
oscSquare(timer) | Square wave oscillator |
oscTriangle(timer) | Triangle wave oscillator |
oscSawtooth(timer) | Sawtooth oscillator |
| Function | Purpose |
|---|---|
texture(tex, uv, level) | Sample with interpolation |
textureLoad(tex, uv, level) | Sample without interpolation |
textureStore(tex, uv, value) | Write to storage texture |
textureSize(tex, level) | Get texture dimensions |
cubeTexture(tex, uvw, level) | Sample cube map |
triplanarTexture(texX, texY, texZ, scale, position, normal) | Triplanar mapping |
ALWAYS use capital If — lowercase if is JavaScript, not TSL.
If(condition, () => {
// true branch
}).ElseIf(otherCondition, () => {
// else-if branch
}).Else(() => {
// false branch
});
select(condition, trueVal, falseVal) — ternary operatorLoop(count, ({ i }) => { }) — GPU loop, supports Break(), Continue()Switch(value).Case(val, fn).Default(fn) — no fallthroughDiscard() — discard fragmentReturn() — early returnconst myFn = Fn(([param1, param2]) => {
return param1.add(param2);
});
// Call: myFn(nodeA, nodeB)
WebGPU enables general-purpose GPU compute via TSL. Compute shaders are NOT available in WebGL fallback mode.
import { compute, storage } from 'three/webgpu';
const computeNode = compute(shaderFn, count, workgroupSize);
await renderer.computeAsync(computeNode);
ALWAYS use await renderer.computeAsync() — compute dispatch is asynchronous.
storage(attribute, type, count), storageTexture(texture)atomicAdd(), atomicSub(), atomicMax(), atomicMin(), atomicAnd(), atomicOr(), atomicXor(), atomicStore(), atomicLoad()workgroupBarrier(), storageBarrier(), textureBarrier()workgroupId, localId, globalId, numWorkgroups, subgroupSizeNEVER use the WebGL EffectComposer with WebGPURenderer. Use the PostProcessing class instead.
import { PostProcessing } from 'three/webgpu';
import { bloom, renderOutput } from 'three/tsl';
const postProcessing = new PostProcessing(renderer);
const scenePass = renderOutput(scene, camera);
postProcessing.outputNode = bloom(scenePass);
bloom(), dof(), fxaa(), smaa(), gaussianBlur(), ssr(), ssgi(), ao(), chromaticAberration(), film(), dotScreen(), sobel(), afterImage(), anamorphic(), denoise(), lut3D(), motionBlur(), outline(), rgbShift(), transition(), traa(), renderOutput()
luminance(), saturation(), vibrance(), hue(), posterize(), grayscale(), sepia()
blendBurn(), blendDodge(), blendOverlay(), blendScreen(), blendColor()
| Step | Action |
|---|---|
| 1 | Replace import * as THREE from 'three' with import * as THREE from 'three/webgpu' |
| 2 | Replace new WebGLRenderer() with new WebGPURenderer() and add await renderer.init() |
| 3 | Replace classic materials with NodeMaterial equivalents (or keep classic — they auto-convert) |
| 4 | Replace EffectComposer with PostProcessing class and TSL post-processing nodes |
| 5 | Replace raw GLSL ShaderMaterial with TSL-based NodeMaterial |
| 6 | Replace requestAnimationFrame with renderer.setAnimationLoop() |
ALWAYS make the entry point async when using WebGPURenderer — renderer.init() returns a Promise.
What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub qadri-uk/claude-skills --plugin qadri-motion149 skills in this plugin
/60fps-animationThis skill should be used when the user asks to "fix janky CSS animation", "make animation 60fps", "stop layout thrashing", "animate width/height/top/left smoothly", "convert animation to transform", "animate box-shadow performantly", "animate height auto", "FLIP animation", or "why is my scroll/hover animation choppy"./accessible-animationThis skill should be used when the user asks to "respect prefers-reduced-motion", "honor reduced motion", "make my animations accessible", "fix vestibular / motion-sickness issues", "add a useReducedMotion hook", "gate GSAP / Framer Motion / Lenis for reduced motion", or "meet WCAG 2.3.3 / C39". Provides tiered (not all-or-nothing) reduced-motion patterns in CSS and JS./aframe-webxrDeclarative web framework for building browser-based 3D, VR, and AR experiences using HTML and entity-component architecture. Use this skill when creating WebXR applications, VR experiences, AR experiences, 360-degree media viewers, or immersive web content with minimal JavaScript. Triggers on tasks involving A-Frame, WebXR, VR development, AR development, entity-component-system, declarative 3D, or HTML-based 3D scenes. Built on Three.js with accessible HTML-first approach./after-effectsThis skill should be used when the user asks anything about Adobe After Effects — to "write an After Effects expression", "make a wiggle / loopOut / inertial bounce", "rig a control with a slider / null", "build a MOGRT / Essential Graphics template", "export AE to Lottie or Media Encoder"; OR to "export from After Effects", "export with transparency / an alpha channel", "fix a black background on export", "choose ProRes vs H.264", "which codec / what bitrate for 1080p / 4K", "stop H.264 disappearing from the Render Queue"; OR when "After Effects is slow / laggy / crashing / froze", "RAM preview won't play in real time", "AE is using all my memory / render takes forever", "how do I speed up After Effects"; OR to "organize my After Effects project", "relink missing footage", "fix broken links after moving files", "set a folder structure / naming conventions", "batch rename layers", or "write an ExtendScript / .jsx script". Covers expressions & rigging, export recipes, performance triage, and project hygiene./algorithmic-artCreating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code, generative art, algorithmic art, flow fields, or particle systems. Create original algorithmic art rather than copying existing artists' work to avoid copyright violations./alpha-cutoutTurns an AI-generated (or filmed) clip of a character or product into a transparent, web-ready animation by shooting it on a flat chroma plate and keying it with per-frame plate measurement and edge unmixing. Delivers stacked-alpha MP4 that plays with transparency in every browser including Safari, VP9 alpha WebM, or keyed WebP frame sequences for scroll scrubbing. Use when an animated subject has to sit over page content, between layers of type, or over a 3D scene, when someone asks for "transparent video", "video with alpha", "remove the background from this clip", or when a generated video has a background that should not be there.