threejs-3d
/threejs-3d
3D web experiences with React Three Fiber — scenes, geometry, materials, lighting, shaders, post-processing, model loading, raycasting. Use when anything is 3D in the browser — scenes, GLTF/GLB models, shaders, WebGL, post-processing, orbit and camera controls, raycasting and object selection, Spline embeds, particle systems, 3D heroes.
- Author
- krishna-modi12 ↗
- Repository
- frontend-design-pro ↗
- Licence
- MIT
- Last repository change
- 20.10.2026
Assessment and security
- Files in this package
- 20
- Scripts
- 15
- HTML comments
- 0
- URLs in SKILL.md
- 0
No signals detected. Repository changed on 20.10.2026, without references to retired models or APIs.
MIT, open: use and modify while retaining author attribution.
- 15 scripts in this package. Review them before installing, as Claude may execute them.
Scripts: examples/_r3f-jsx.d.ts, examples/_stubs.d.ts, examples/bad-3d-practices.tsx, examples/good-3d-interaction.test.tsx, examples/good-3d-interaction.tsx, examples/good-3d-loader.test.tsx, examples/good-3d-loader.tsx, examples/good-3d-scene.test.tsx
What it does and when to use it
3D web experiences with React Three Fiber — scenes, geometry, materials, lighting, shaders, post-processing, model loading, raycasting. Use when anything is 3D in the browser — scenes, GLTF/GLB models, shaders, WebGL, post-processing, orbit and camera controls, raycasting and object selection, Spline embeds, particle systems, 3D heroes.
Original author description
3D web experiences with React Three Fiber — scenes, geometry, materials, lighting, shaders, post-processing, model loading, raycasting. Use when anything is 3D in the browser — scenes, GLTF/GLB models, shaders, WebGL, post-processing, orbit and camera controls, raycasting and object selection, Spline embeds, particle systems, 3D heroes.
How it works
- When to Use
- Stack
- Core Rules
- Patterns
- Examples
- Reference Index
- Constraints
SKILL.md preview
---
name: threejs-3d
description: 3D web experiences with React Three Fiber — scenes, geometry, materials, lighting, shaders, post-processing, model loading, raycasting. Use when anything is 3D in the browser — scenes, GLTF/GLB models, shaders, WebGL, post-processing, orbit and camera controls, raycasting and object selection, Spline embeds, particle systems, 3D heroes.
metadata:
version: "15.0.0"
core-deps:
- core/component-api.md
- core/accessibility-baseline.md
---
# Three.js / R3F
## When to Use
Anything 3D in the browser: scenes, models (GLTF/GLB), shaders, WebGL, post-processing, orbit/camera controls, raycasting and object selection, Spline embeds, particle systems, 3D heroes.
## Stack
React 19 · TypeScript strict · `@react-three/fiber` · `@react-three/drei` · `@react-three/postprocessing` · `three` r160+
## Core Rules
1. **Write R3F, not raw Three.js.** JSX is the scene graph: `<mesh>`, `<boxGeometry args={[w,h,d]}>`, `<meshStandardMaterial>`. Drop to imperative `three` only for enums, `THREE.Color` and types.
2. **Cap the pixel ratio** — `dpr={[1, 2]}`, never `window.devicePixelRatio`. Retina at 3× quadruples fragment cost.
3. **`useFrame((state, delta) => …)` is the loop.** Drive motion by `delta`, never a frame counter. Raw `requestAnimationFrame` in an R3F component is a defect.
4. **Colours are OKLCH** — `new THREE.Color("oklch(60% 0.185 276)")`. Never `new THREE.Color(0x4f46e5)`. Read CSS custom properties to share tokens with the 2D UI.
5. **Memoize anything you construct.** A `new THREE.BoxGeometry()` in a component body is rebuilt every render. `useMemo` it, or declare it as JSX and let R3F own the lifecycle.
6. **Suspense is the loading state.** `useGLTF`/`useTexture` suspend; wrap them and use `useProgress()` for a real progress bar. Never a `setTimeout` loading flag. Wrap the boundary in an error boundary — a 404 on a `.glb` throws.
7. **A canvas is opaque to assistive tech.** The container gets `role="img"` + an `aria-label` describing the *content*, or `aria-hidden="true"` if purely decorative. Selectable 3D objects need a parallel keyboard path.
8. **`prefers-reduced-motion` disables** auto-rotate, camera shake and idle animation — render the scene, just don't move it unprompted.
9. **`touch-action: none`** on the canvas container so gestures aren't stolen for scrolling.
10. **Instance above ~100 copies**; `frameloop="demand"` for static scenes; `<Detailed>` for LOD.
## Patterns
- **Scene shell** — `<Canvas>` with camera, ACES tone mapping, shadows, `<Environment>`, `<OrbitControls enableDamping>`.
- **Pointer selection** — `onPointerOver`/`onClick` with `e.stopPropagation()`, `useCursor` for hover, `emissive` + scale for selection.
- **Model + animation** — `useGLTF` → `useAnimations` → `reset().fadeIn(0.3).play()`.
- **Custom shader** — `<shaderMaterial>` with memoized uniforms, `uTime` advanced by `delta` in `useFrame`.
- **Post-processing** — `<EffectComposer>` wrapping `<Bloom>`/`<DepthOfField>`; composer wraps the scene, it doesn't replace it.
## Examples
`examples/good-3d-scene.tsx` · `examples/good-3d-interaction.tsx` · `examples/good-3d-loader.tsx` · `examples/good-3d-shader.tsx` · `examples/good-3d.tsx` (particles) · `examples/good-hero-spline.tsx` · `examples/bad-3d-practices.tsx` (anti-example).
## Reference Index
Load only for the specific task:
| Task | Load |
|---|---|
| Scene setup, geometry, materials, lighting, textures, perf | `references/threejs-fundamentals.md` |
| Animation, GLSL shaders, post-processing, loaders | `references/threejs-advanced.md` |
| Raycasting, camera controls, selection, 3D a11y | `references/threejs-interaction.md` |
| Spline scene embedding and fallbacks | `references/spline.md` |
## Constraints
`3D-01` Canvas declares `dpr` · `3D-02` no raw `requestAnimationFrame` · `3D-03` constructed geometry/material memoized · `3D-04` canvas container labelled or explicitly decorative · `3D-05` no raw hex in `THREE.Color` · `3D-06` delta-driven `useFrame` · `3D-07` Suspense loading, not `setTimeout` · plus the shared baseline (TypeScript strict, OKLCH, four states, reduced motion).
Files in this package (20)
- SKILL.md 4 KB
- examples/_r3f-jsx.d.ts 2 KB
- examples/_stubs.d.ts 4 KB
- examples/bad-3d-practices.tsx 2 KB
- examples/good-3d-interaction.test.tsx 2 KB
- examples/good-3d-interaction.tsx 5 KB
- examples/good-3d-loader.test.tsx 2 KB
- examples/good-3d-loader.tsx 5 KB
- examples/good-3d-scene.test.tsx 2 KB
- examples/good-3d-scene.tsx 4 KB
- examples/good-3d-shader.test.tsx 2 KB
- examples/good-3d-shader.tsx 5 KB
- examples/good-3d.test.tsx 1 KB
- examples/good-3d.tsx 10 KB
- examples/good-hero-spline.test.tsx 1 KB
- examples/good-hero-spline.tsx 9 KB
- references/spline.md 12 KB
- references/threejs-advanced.md 13 KB
- references/threejs-fundamentals.md 14 KB
- references/threejs-interaction.md 6 KB
Versions
| Repository | Score | Licence |
|---|---|---|
| This page · krishna-modi12/frontend-design-pro | 100 | MIT |
| wrongstack/wrongstack | 90 | MIT |
Database snapshot: 13.11.2026 · package version b0f6e9cea40a (SHA-256 digest of the entire package)
Downloads in the last 30 days: 2 · ranking
Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.
Similar skills
- 90threejs-guide
Use when building or editing 3D scenes in vanilla Three.js for WebGL/WebGPU. Triggers on `.js`/`.ts` files with `three` or `three/*` imports, and on prompts about Scene, Renderer, Mesh, BufferGeometry, materials, lighting, GLTF loaders, raycasting, shaders, post-processing,… - 100threejs
Complete Three.js development guide - scene setup, geometry, materials, lighting, textures, animation, loaders, shaders, post-processing, and interaction. Use when building 3D web applications, creating WebGL scenes, loading 3D models, adding visual effects, or implementing user interaction. - 100threejs
Three.js is a JavaScript library for building interactive 3D graphics in the browser with WebGL and WebGPU. Use it for 3D product configurators, data visualizations, games and creative sites: scenes, cameras, lighting, glTF model loading, performance tuning, and React Three… - 1003d-scene
Use when building 3D scenes for web — Three.js, React Three Fiber (R3F), Spline embeds, GLTF/GLB loading, scroll-linked 3D, camera animations. Covers scene setup, model optimization, and performance budgets. - 100web-3d
Add 3D and WebGL to websites — interactive hero objects, product viewers, particles, shader backgrounds, scroll-driven 3D scenes — with Three.js or React Three Fiber (drei), Spline, or model-viewer, while keeping load time, mobile performance and fallbacks under control. Use… - 100threejs
Real-time 3D on the web by astudio: Three.js (r18x, WebGL and WebGPU/TSL), React Three Fiber + drei, Spline embeds - hero 3D objects, product viewers and configurators, scroll-driven camera stories, particles and points fields, 3D logos extruded from SVG, interactive…