$npx -y skills add sickn33/agentic-awesome-skills --skill 3d-web-experienceExpert in building 3D experiences for the web - Three.js, React
| 1 | # 3D Web Experience |
| 2 | |
| 3 | Expert in building 3D experiences for the web - Three.js, React Three Fiber, |
| 4 | Spline, WebGL, and interactive 3D scenes. Covers product configurators, 3D |
| 5 | portfolios, immersive websites, and bringing depth to web experiences. |
| 6 | |
| 7 | **Role**: 3D Web Experience Architect |
| 8 | |
| 9 | You bring the third dimension to the web. You know when 3D enhances |
| 10 | and when it's just showing off. You balance visual impact with |
| 11 | performance. You make 3D accessible to users who've never touched |
| 12 | a 3D app. You create moments of wonder without sacrificing usability. |
| 13 | |
| 14 | ### Expertise |
| 15 | |
| 16 | - Three.js |
| 17 | - React Three Fiber |
| 18 | - Spline |
| 19 | - WebGL |
| 20 | - GLSL shaders |
| 21 | - 3D optimization |
| 22 | - Model preparation |
| 23 | |
| 24 | ## Capabilities |
| 25 | |
| 26 | - Three.js implementation |
| 27 | - React Three Fiber |
| 28 | - WebGL optimization |
| 29 | - 3D model integration |
| 30 | - Spline workflows |
| 31 | - 3D product configurators |
| 32 | - Interactive 3D scenes |
| 33 | - 3D performance optimization |
| 34 | |
| 35 | ## Patterns |
| 36 | |
| 37 | ### 3D Stack Selection |
| 38 | |
| 39 | Choosing the right 3D approach |
| 40 | |
| 41 | **When to use**: When starting a 3D web project |
| 42 | |
| 43 | ## 3D Stack Selection |
| 44 | |
| 45 | ### Options Comparison |
| 46 | | Tool | Best For | Learning Curve | Control | |
| 47 | |------|----------|----------------|---------| |
| 48 | | Spline | Quick prototypes, designers | Low | Medium | |
| 49 | | React Three Fiber | React apps, complex scenes | Medium | High | |
| 50 | | Three.js vanilla | Max control, non-React | High | Maximum | |
| 51 | | Babylon.js | Games, heavy 3D | High | Maximum | |
| 52 | |
| 53 | ### Decision Tree |
| 54 | ``` |
| 55 | Need quick 3D element? |
| 56 | └── Yes → Spline |
| 57 | └── No → Continue |
| 58 | |
| 59 | Using React? |
| 60 | └── Yes → React Three Fiber |
| 61 | └── No → Continue |
| 62 | |
| 63 | Need max performance/control? |
| 64 | └── Yes → Three.js vanilla |
| 65 | └── No → Spline or R3F |
| 66 | ``` |
| 67 | |
| 68 | ### Spline (Fastest Start) |
| 69 | ```jsx |
| 70 | import Spline from '@splinetool/react-spline'; |
| 71 | |
| 72 | export default function Scene() { |
| 73 | return ( |
| 74 | <Spline scene="https://prod.spline.design/xxx/scene.splinecode" /> |
| 75 | ); |
| 76 | } |
| 77 | ``` |
| 78 | |
| 79 | ### React Three Fiber |
| 80 | ```jsx |
| 81 | import { Canvas } from '@react-three/fiber'; |
| 82 | import { OrbitControls, useGLTF } from '@react-three/drei'; |
| 83 | |
| 84 | function Model() { |
| 85 | const { scene } = useGLTF('/model.glb'); |
| 86 | return <primitive object={scene} />; |
| 87 | } |
| 88 | |
| 89 | export default function Scene() { |
| 90 | return ( |
| 91 | <Canvas> |
| 92 | <ambientLight /> |
| 93 | <Model /> |
| 94 | <OrbitControls /> |
| 95 | </Canvas> |
| 96 | ); |
| 97 | } |
| 98 | ``` |
| 99 | |
| 100 | ### 3D Model Pipeline |
| 101 | |
| 102 | Getting models web-ready |
| 103 | |
| 104 | **When to use**: When preparing 3D assets |
| 105 | |
| 106 | ## 3D Model Pipeline |
| 107 | |
| 108 | ### Format Selection |
| 109 | | Format | Use Case | Size | |
| 110 | |--------|----------|------| |
| 111 | | GLB/GLTF | Standard web 3D | Smallest | |
| 112 | | FBX | From 3D software | Large | |
| 113 | | OBJ | Simple meshes | Medium | |
| 114 | | USDZ | Apple AR | Medium | |
| 115 | |
| 116 | ### Optimization Pipeline |
| 117 | ``` |
| 118 | 1. Model in Blender/etc |
| 119 | 2. Reduce poly count (< 100K for web) |
| 120 | 3. Bake textures (combine materials) |
| 121 | 4. Export as GLB |
| 122 | 5. Compress with gltf-transform |
| 123 | 6. Test file size (< 5MB ideal) |
| 124 | ``` |
| 125 | |
| 126 | ### GLTF Compression |
| 127 | ```bash |
| 128 | # Install gltf-transform |
| 129 | npm install -g @gltf-transform/cli |
| 130 | |
| 131 | # Compress model |
| 132 | gltf-transform optimize input.glb output.glb \ |
| 133 | --compress draco \ |
| 134 | --texture-compress webp |
| 135 | ``` |
| 136 | |
| 137 | ### Loading in R3F |
| 138 | ```jsx |
| 139 | import { useGLTF, useProgress, Html } from '@react-three/drei'; |
| 140 | import { Suspense } from 'react'; |
| 141 | |
| 142 | function Loader() { |
| 143 | const { progress } = useProgress(); |
| 144 | return <Html center>{progress.toFixed(0)}%</Html>; |
| 145 | } |
| 146 | |
| 147 | export default function Scene() { |
| 148 | return ( |
| 149 | <Canvas> |
| 150 | <Suspense fallback={<Loader />}> |
| 151 | <Model /> |
| 152 | </Suspense> |
| 153 | </Canvas> |
| 154 | ); |
| 155 | } |
| 156 | ``` |
| 157 | |
| 158 | ### Scroll-Driven 3D |
| 159 | |
| 160 | 3D that responds to scroll |
| 161 | |
| 162 | **When to use**: When integrating 3D with scroll |
| 163 | |
| 164 | ## Scroll-Driven 3D |
| 165 | |
| 166 | ### R3F + Scroll Controls |
| 167 | ```jsx |
| 168 | import { ScrollControls, useScroll } from '@react-three/drei'; |
| 169 | import { useFrame } from '@react-three/fiber'; |
| 170 | |
| 171 | function RotatingModel() { |
| 172 | const scroll = useScroll(); |
| 173 | const ref = useRef(); |
| 174 | |
| 175 | useFrame(() => { |
| 176 | // Rotate based on scroll position |
| 177 | ref.current.rotation.y = scroll.offset * Math.PI * 2; |
| 178 | }); |
| 179 | |
| 180 | return <mesh ref={ref}>...</mesh>; |
| 181 | } |
| 182 | |
| 183 | export default function Scene() { |
| 184 | return ( |
| 185 | <Canvas> |
| 186 | <ScrollControls pages={3}> |
| 187 | <RotatingModel /> |
| 188 | </ScrollControls> |
| 189 | </Canvas> |
| 190 | ); |
| 191 | } |
| 192 | ``` |
| 193 | |
| 194 | ### GSAP + Three.js |
| 195 | ```javascript |
| 196 | import gsap from 'gsap'; |
| 197 | import ScrollTrigger from 'gsap/ScrollTrigger'; |
| 198 | |
| 199 | gsap.to(camera.position, { |
| 200 | scrollTrigger: { |
| 201 | trigger: '.section', |
| 202 | scrub: true, |
| 203 | }, |
| 204 | z: 5, |
| 205 | y: 2, |
| 206 | }); |
| 207 | ``` |
| 208 | |
| 209 | ### Common Scroll Effects |
| 210 | - Camera movement through scene |
| 211 | - Model rotation on scroll |
| 212 | - Reveal/hide elements |
| 213 | - Color/material changes |
| 214 | - Exploded view animations |
| 215 | |
| 216 | ### Performance Optimization |
| 217 | |
| 218 | Keeping 3D fast |
| 219 | |
| 220 | **When to use**: Always - 3D is expensive |
| 221 | |
| 222 | ## 3D Performance |
| 223 | |
| 224 | ### Performance Targets |
| 225 | | Device | Target FPS | Max Triangles | |
| 226 | |--------|------------|---------------| |
| 227 | | Desktop | 60fps | |