Loading...
Loading...
Builds 3D web experiences with Three.js, WebGPU rendering, TSL shaders, and React Three Fiber. Covers scene setup, asset optimization, performance tuning, and React 19 integration. Use when creating 3D scenes, setting up WebGPU rendering, writing TSL shaders, optimizing draw calls, or integrating Three.js with React and Next.js.
npx skill4agent add oakoss/agent-skills threejs| Pattern | API / Approach | Key Points |
|---|---|---|
| WebGPU renderer | | Must |
| R3F canvas | | Wrap in |
| Frame updates | | Mutate refs directly; never use |
| TSL shaders | | Node-based; compiles to WGSL or GLSL |
| Instancing | | Single draw call for repeated geometry |
| Batched mesh | | Different geometries sharing one material |
| Draco compression | | Up to 90% geometry size reduction |
| KTX2 textures | Basis Universal via | Stays compressed in VRAM |
| LOD | | Swap detail levels by camera distance |
| On-demand render | | Only render when scene state changes |
| Cleanup | | Geometries, materials, and textures |
| Compute shaders | | GPU-side physics, particles, flocking |
| Lighting | | Enable |
| GLTF loading | | Draco for geometry compression; traverse for shadows |
| Animation | | Update with |
| Crossfade | | Weight-based blending between walk/run/idle |
| Environment maps | | Set |
| Raycasting | | Mouse/touch picking; use |
| Morph targets | | Facial animation, blend shapes from GLTF |
| Mistake | Correct Pattern |
|---|---|
Allocating | Pre-allocate outside the loop to avoid GC pressure every frame |
Using | Use R3F's |
Not awaiting | Always |
Loading assets without | Wrap |
| Using high-poly models for background or distant elements | Use LOD (Level of Detail) or Impostors to reduce draw calls |
Using | Mutate refs directly via |
Speed tied to frame rate ( | Multiply by |
Not using | Always pass delta time to |
| Forgetting to dispose loaded GLTF models | Traverse and dispose geometries, materials, and textures on removal |
| Shadow map enabled on renderer but not on the light | Set both |
Large | Keep ratio small to avoid z-fighting; set |
ExploreTaskPlan