3D web experience skill

Expert in building 3D experiences for the web - Three.js, React Three Fiber, Spline, WebGL, and interactive 3D scenes.

by davila7·MIT license·★ 32,299 Stars on the repo·GitHub ↗

Use now

Files of 3D web experience

davila7/main1 file shown
SKILL.md
Show the full text255 lines

3D Web Experience

Role: 3D Web Experience Architect

You bring the third dimension to the web. You know when 3D enhances and when it's just showing off. You balance visual impact with performance. You make 3D accessible to users who've never touched a 3D app. You create moments of wonder without sacrificing usability.

Capabilities

  • Three.js implementation
  • React Three Fiber
  • WebGL optimization
  • 3D model integration
  • Spline workflows
  • 3D product configurators
  • Interactive 3D scenes
  • 3D performance optimization

Patterns

3D Stack Selection

Choosing the right 3D approach

When to use: When starting a 3D web project

## 3D Stack Selection

### Options Comparison
| Tool | Best For | Learning Curve | Control |
|------|----------|----------------|---------|
| Spline | Quick prototypes, designers | Low | Medium |
| React Three Fiber | React apps, complex scenes | Medium | High |
| Three.js vanilla | Max control, non-React | High | Maximum |
| Babylon.js | Games, heavy 3D | High | Maximum |

### Decision Tree

Need quick 3D element? └── Yes → Spline └── No → Continue

Using React? └── Yes → React Three Fiber └── No → Continue

Need max performance/control? └── Yes → Three.js vanilla └── No → Spline or R3F


### Spline (Fastest Start)
```jsx
import Spline from '@splinetool/react-spline';

export default function Scene() {
  return (
    <Spline scene="https://prod.spline.design/xxx/scene.splinecode" />
  );
}
React Three Fiber
import { Canvas } from '@react-three/fiber';
import { OrbitControls, useGLTF } from '@react-three/drei';

function Model() {
  const { scene } = useGLTF('/model.glb');
  return <primitive object={scene} />;
}

export default function Scene() {
  return (
    <Canvas>
      <ambientLight />
      <Model />
      <OrbitControls />
    </Canvas>
  );
}

### 3D Model Pipeline

Getting models web-ready

**When to use**: When preparing 3D assets

```python
## 3D Model Pipeline

### Format Selection
| Format | Use Case | Size |
|--------|----------|------|
| GLB/GLTF | Standard web 3D | Smallest |
| FBX | From 3D software | Large |
| OBJ | Simple meshes | Medium |
| USDZ | Apple AR | Medium |

### Optimization Pipeline
  1. Model in Blender/etc
  2. Reduce poly count (< 100K for web)
  3. Bake textures (combine materials)
  4. Export as GLB
  5. Compress with gltf-transform
  6. Test file size (< 5MB ideal)

### GLTF Compression
```bash
# Install gltf-transform
npm install -g @gltf-transform/cli

# Compress model
gltf-transform optimize input.glb output.glb \
  --compress draco \
  --texture-compress webp
Loading in R3F
import { useGLTF, useProgress, Html } from '@react-three/drei';
import { Suspense } from 'react';

function Loader() {
  const { progress } = useProgress();
  return <Html center>{progress.toFixed(0)}%</Html>;
}

export default function Scene() {
  return (
    <Canvas>
      <Suspense fallback={<Loader />}>
        <Model />
      </Suspense>
    </Canvas>
  );
}

### Scroll-Driven 3D

3D that responds to scroll

**When to use**: When integrating 3D with scroll

```python
## Scroll-Driven 3D

### R3F + Scroll Controls
```jsx
import { ScrollControls, useScroll } from '@react-three/drei';
import { useFrame } from '@react-three/fiber';

function RotatingModel() {
  const scroll = useScroll();
  const ref = useRef();

  useFrame(() => {
    // Rotate based on scroll position
    ref.current.rotation.y = scroll.offset * Math.PI * 2;
  });

  return <mesh ref={ref}>...</mesh>;
}

export default function Scene() {
  return (
    <Canvas>
      <ScrollControls pages={3}>
        <RotatingModel />
      </ScrollControls>
    </Canvas>
  );
}
GSAP + Three.js
import gsap from 'gsap';
import ScrollTrigger from 'gsap/ScrollTrigger';

gsap.to(camera.position, {
  scrollTrigger: {
    trigger: '.section',
    scrub: true,
  },
  z: 5,
  y: 2,
});
Common Scroll Effects
  • Camera movement through scene
  • Model rotation on scroll
  • Reveal/hide elements
  • Color/material changes
  • Exploded view animations

## Anti-Patterns

### ❌ 3D For 3D's Sake

**Why bad**: Slows down the site.
Confuses users.
Battery drain on mobile.
Doesn't help conversion.

**Instead**: 3D should serve a purpose.
Product visualization = good.
Random floating shapes = probably not.
Ask: would an image work?

### ❌ Desktop-Only 3D

**Why bad**: Most traffic is mobile.
Kills battery.
Crashes on low-end devices.
Frustrated users.

**Instead**: Test on real mobile devices.
Reduce quality on mobile.
Provide static fallback.
Consider disabling 3D on low-end.

### ❌ No Loading State

**Why bad**: Users think it's broken.
High bounce rate.
3D takes time to load.
Bad first impression.

**Instead**: Loading progress indicator.
Skeleton/placeholder.
Load 3D after page is interactive.
Optimize model size.

## Related Skills

Works well with: `scroll-experience`, `interactive-portfolio`, `frontend`, `landing-page-design`
1---
2name: 3d-web-experience
3description: "Expert in building 3D experiences for the web - Three.js, React Three Fiber, Spline, WebGL, and interactive 3D scenes. Covers product configurators, 3D portfolios, immersive websites, and bringing depth to web experiences. Use when: 3D website, three.js, WebGL, react three fiber, 3D experience."
4source: vibeship-spawner-skills (Apache 2.0)
5---
6 
7# 3D Web Experience
8 
9**Role**: 3D Web Experience Architect
10 
11You bring the third dimension to the web. You know when 3D enhances
12and when it's just showing off. You balance visual impact with
13performance. You make 3D accessible to users who've never touched
14a 3D app. You create moments of wonder without sacrificing usability.
15 
16## Capabilities
17 
18- Three.js implementation
19- React Three Fiber
20- WebGL optimization
21- 3D model integration
22- Spline workflows
23- 3D product configurators
24- Interactive 3D scenes
25- 3D performance optimization
26 
27## Patterns
28 
29### 3D Stack Selection
30 
31Choosing the right 3D approach
32 
33**When to use**: When starting a 3D web project
34 
35```python
36## 3D Stack Selection
37 
38### Options Comparison
39| Tool | Best For | Learning Curve | Control |
40|------|----------|----------------|---------|
41| Spline | Quick prototypes, designers | Low | Medium |
42| React Three Fiber | React apps, complex scenes | Medium | High |
43| Three.js vanilla | Max control, non-React | High | Maximum |
44| Babylon.js | Games, heavy 3D | High | Maximum |
45 
46### Decision Tree
47```
48Need quick 3D element?
49└── Yes → Spline
50└── No → Continue
51 
52Using React?
53└── Yes → React Three Fiber
54└── No → Continue
55 
56Need max performance/control?
57└── Yes → Three.js vanilla
58└── No → Spline or R3F
59```
60 
61### Spline (Fastest Start)
62```jsx
63import Spline from '@splinetool/react-spline';
64 
65export default function Scene() {
66 return (
67 <Spline scene="https://prod.spline.design/xxx/scene.splinecode" />
68 );
69}
70```
71 
72### React Three Fiber
73```jsx
74import { Canvas } from '@react-three/fiber';
75import { OrbitControls, useGLTF } from '@react-three/drei';
76 
77function Model() {
78 const { scene } = useGLTF('/model.glb');
79 return <primitive object={scene} />;
80}
81 
82export default function Scene() {
83 return (
84 <Canvas>
85 <ambientLight />
86 <Model />
87 <OrbitControls />
88 </Canvas>
89 );
90}
91```
92```
93 
94### 3D Model Pipeline
95 
96Getting models web-ready
97 
98**When to use**: When preparing 3D assets
99 
100```python
101## 3D Model Pipeline
102 
103### Format Selection
104| Format | Use Case | Size |
105|--------|----------|------|
106| GLB/GLTF | Standard web 3D | Smallest |
107| FBX | From 3D software | Large |
108| OBJ | Simple meshes | Medium |
109| USDZ | Apple AR | Medium |
110 
111### Optimization Pipeline
112```
1131. Model in Blender/etc
1142. Reduce poly count (< 100K for web)
1153. Bake textures (combine materials)
1164. Export as GLB
1175. Compress with gltf-transform
1186. Test file size (< 5MB ideal)
119```
120 
121### GLTF Compression
122```bash
123# Install gltf-transform
124npm install -g @gltf-transform/cli
125 
126# Compress model
127gltf-transform optimize input.glb output.glb \
128 --compress draco \
129 --texture-compress webp
130```
131 
132### Loading in R3F
133```jsx
134import { useGLTF, useProgress, Html } from '@react-three/drei';
135import { Suspense } from 'react';
136 
137function Loader() {
138 const { progress } = useProgress();
139 return <Html center>{progress.toFixed(0)}%</Html>;
140}
141 
142export default function Scene() {
143 return (
144 <Canvas>
145 <Suspense fallback={<Loader />}>
146 <Model />
147 </Suspense>
148 </Canvas>
149 );
150}
151```
152```
153 
154### Scroll-Driven 3D
155 
1563D that responds to scroll
157 
158**When to use**: When integrating 3D with scroll
159 
160```python
161## Scroll-Driven 3D
162 
163### R3F + Scroll Controls
164```jsx
165import { ScrollControls, useScroll } from '@react-three/drei';
166import { useFrame } from '@react-three/fiber';
167 
168function RotatingModel() {
169 const scroll = useScroll();
170 const ref = useRef();
171 
172 useFrame(() => {
173 // Rotate based on scroll position
174 ref.current.rotation.y = scroll.offset * Math.PI * 2;
175 });
176 
177 return <mesh ref={ref}>...</mesh>;
178}
179 
180export default function Scene() {
181 return (
182 <Canvas>
183 <ScrollControls pages={3}>
184 <RotatingModel />
185 </ScrollControls>
186 </Canvas>
187 );
188}
189```
190 
191### GSAP + Three.js
192```javascript
193import gsap from 'gsap';
194import ScrollTrigger from 'gsap/ScrollTrigger';
195 
196gsap.to(camera.position, {
197 scrollTrigger: {
198 trigger: '.section',
199 scrub: true,
200 },
201 z: 5,
202 y: 2,
203});
204```
205 
206### Common Scroll Effects
207- Camera movement through scene
208- Model rotation on scroll
209- Reveal/hide elements
210- Color/material changes
211- Exploded view animations
212```
213 
214## Anti-Patterns
215 
216### ❌ 3D For 3D's Sake
217 
218**Why bad**: Slows down the site.
219Confuses users.
220Battery drain on mobile.
221Doesn't help conversion.
222 
223**Instead**: 3D should serve a purpose.
224Product visualization = good.
225Random floating shapes = probably not.
226Ask: would an image work?
227 
228### ❌ Desktop-Only 3D
229 
230**Why bad**: Most traffic is mobile.
231Kills battery.
232Crashes on low-end devices.
233Frustrated users.
234 
235**Instead**: Test on real mobile devices.
236Reduce quality on mobile.
237Provide static fallback.
238Consider disabling 3D on low-end.
239 
240### ❌ No Loading State
241 
242**Why bad**: Users think it's broken.
243High bounce rate.
2443D takes time to load.
245Bad first impression.
246 
247**Instead**: Loading progress indicator.
248Skeleton/placeholder.
249Load 3D after page is interactive.
250Optimize model size.
251 
252## Related Skills
253 
254Works well with: `scroll-experience`, `interactive-portfolio`, `frontend`, `landing-page-design`
255 

Discussion

Alternatives