three-agent-skills 1.1.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/skills/r3f-best-practices/SKILL.md +33 -2
- package/skills/r3f-best-practices/rules/_sections.md +2 -0
- package/skills/r3f-best-practices/rules/perf-r3f-perf.md +87 -0
- package/skills/r3f-best-practices/rules/perf-visibility-toggle.md +95 -0
- package/skills/r3f-best-practices.zip +0 -0
- package/skills/three-best-practices/SKILL.md +109 -43
- package/skills/three-best-practices/rules/_sections.md +71 -19
- package/skills/three-best-practices/rules/asset-compression.md +99 -0
- package/skills/three-best-practices/rules/core-web-vitals.md +157 -0
- package/skills/three-best-practices/rules/debug-devtools.md +211 -0
- package/skills/three-best-practices/rules/draw-call-optimization.md +122 -0
- package/skills/three-best-practices/rules/lighting-shadows-advanced.md +165 -0
- package/skills/three-best-practices/rules/object-pooling.md +125 -0
- package/skills/three-best-practices/rules/postprocessing-optimization.md +140 -0
- package/skills/three-best-practices/rules/shader-mobile.md +136 -0
- package/skills/three-best-practices/rules/webgpu-renderer.md +112 -0
- package/skills/three-best-practices.zip +0 -0
package/package.json
CHANGED
|
@@ -4,12 +4,16 @@ description: React Three Fiber (R3F) and Poimandres ecosystem best practices. Us
|
|
|
4
4
|
license: MIT
|
|
5
5
|
metadata:
|
|
6
6
|
author: three-agent-skills
|
|
7
|
-
version: "1.
|
|
7
|
+
version: "1.1.0"
|
|
8
8
|
---
|
|
9
9
|
|
|
10
10
|
# React Three Fiber Best Practices
|
|
11
11
|
|
|
12
|
-
Comprehensive guide for React Three Fiber and the Poimandres ecosystem. Contains
|
|
12
|
+
Comprehensive guide for React Three Fiber and the Poimandres ecosystem. Contains 70+ rules across 12 categories, prioritized by impact.
|
|
13
|
+
|
|
14
|
+
## Sources & Credits
|
|
15
|
+
|
|
16
|
+
> Additional tips from [100 Three.js Tips](https://www.utsubo.com/blog/threejs-best-practices-100-tips) by [Utsubo](https://www.utsubo.com)
|
|
13
17
|
|
|
14
18
|
## When to Apply
|
|
15
19
|
|
|
@@ -57,6 +61,8 @@ Reference these guidelines when:
|
|
|
57
61
|
- `perf-keys-for-lists` - Use stable keys for dynamic lists
|
|
58
62
|
- `perf-avoid-inline-objects` - Avoid creating objects/arrays in JSX
|
|
59
63
|
- `perf-dispose-auto` - Understand R3F auto-dispose behavior
|
|
64
|
+
- `perf-visibility-toggle` - Toggle visibility instead of remounting
|
|
65
|
+
- `perf-r3f-perf` - Use r3f-perf for performance monitoring
|
|
60
66
|
|
|
61
67
|
### 2. useFrame & Animation (CRITICAL)
|
|
62
68
|
|
|
@@ -228,3 +234,28 @@ function App() {
|
|
|
228
234
|
);
|
|
229
235
|
}
|
|
230
236
|
```
|
|
237
|
+
|
|
238
|
+
### r3f-perf Monitoring
|
|
239
|
+
|
|
240
|
+
```jsx
|
|
241
|
+
import { Perf } from 'r3f-perf';
|
|
242
|
+
|
|
243
|
+
function App() {
|
|
244
|
+
return (
|
|
245
|
+
<Canvas>
|
|
246
|
+
<Perf position="top-left" />
|
|
247
|
+
<Scene />
|
|
248
|
+
</Canvas>
|
|
249
|
+
);
|
|
250
|
+
}
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
### Toggle Visibility (Not Remounting)
|
|
254
|
+
|
|
255
|
+
```jsx
|
|
256
|
+
// BAD: Remounting destroys and recreates
|
|
257
|
+
{showModel && <Model />}
|
|
258
|
+
|
|
259
|
+
// GOOD: Toggle visibility, keeps instance alive
|
|
260
|
+
<Model visible={showModel} />
|
|
261
|
+
```
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# r3f-perf for Performance Monitoring
|
|
2
|
+
|
|
3
|
+
> Source: [100 Three.js Tips - Utsubo](https://www.utsubo.com/blog/threejs-best-practices-100-tips)
|
|
4
|
+
|
|
5
|
+
Use r3f-perf for comprehensive React Three Fiber performance monitoring.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install r3f-perf
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Basic Usage
|
|
14
|
+
|
|
15
|
+
```jsx
|
|
16
|
+
import { Perf } from 'r3f-perf';
|
|
17
|
+
|
|
18
|
+
function App() {
|
|
19
|
+
return (
|
|
20
|
+
<Canvas>
|
|
21
|
+
<Perf position="top-left" />
|
|
22
|
+
<Scene />
|
|
23
|
+
</Canvas>
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Available Props
|
|
29
|
+
|
|
30
|
+
```jsx
|
|
31
|
+
<Perf
|
|
32
|
+
position="top-left" // Position: top-left, top-right, bottom-left, bottom-right
|
|
33
|
+
minimal={false} // Minimal mode (just FPS)
|
|
34
|
+
showGraph={true} // Show performance graph
|
|
35
|
+
matrixUpdate={true} // Show matrix updates
|
|
36
|
+
deepAnalyze={false} // Deep analysis (more CPU intensive)
|
|
37
|
+
overClock={false} // Over-clock mode for high refresh rate monitors
|
|
38
|
+
logsPerSecond={10} // Logs per second
|
|
39
|
+
/>
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## What It Monitors
|
|
43
|
+
|
|
44
|
+
- **FPS** - Frames per second
|
|
45
|
+
- **MS** - Milliseconds per frame
|
|
46
|
+
- **CPU** - JavaScript execution time
|
|
47
|
+
- **GPU** - WebGL draw time (estimated)
|
|
48
|
+
- **Memory** - Geometries, textures, draw calls
|
|
49
|
+
- **Matrix Updates** - Number of matrix recalculations
|
|
50
|
+
|
|
51
|
+
## Conditional Rendering for Production
|
|
52
|
+
|
|
53
|
+
```jsx
|
|
54
|
+
import { Perf } from 'r3f-perf';
|
|
55
|
+
|
|
56
|
+
function App() {
|
|
57
|
+
const isDev = process.env.NODE_ENV === 'development';
|
|
58
|
+
|
|
59
|
+
return (
|
|
60
|
+
<Canvas>
|
|
61
|
+
{isDev && <Perf position="top-left" />}
|
|
62
|
+
<Scene />
|
|
63
|
+
</Canvas>
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Deep Analyze Mode
|
|
69
|
+
|
|
70
|
+
For detailed per-object analysis:
|
|
71
|
+
|
|
72
|
+
```jsx
|
|
73
|
+
<Perf
|
|
74
|
+
deepAnalyze={true}
|
|
75
|
+
className="custom-perf"
|
|
76
|
+
/>
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Shows render times for individual objects but has higher CPU overhead.
|
|
80
|
+
|
|
81
|
+
## Best Practices
|
|
82
|
+
|
|
83
|
+
1. **Remove in production** - Always hide in production builds
|
|
84
|
+
2. **Use sparingly** - Performance monitor itself has overhead
|
|
85
|
+
3. **Check draw calls** - Target under 100 draw calls
|
|
86
|
+
4. **Monitor memory** - Watch for leaking geometries/textures
|
|
87
|
+
5. **Use alongside renderer.info** - For detailed WebGL stats
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
# Toggle Visibility Instead of Remounting
|
|
2
|
+
|
|
3
|
+
> Source: [100 Three.js Tips - Utsubo](https://www.utsubo.com/blog/threejs-best-practices-100-tips)
|
|
4
|
+
|
|
5
|
+
Toggle the `visible` prop instead of conditionally mounting/unmounting components.
|
|
6
|
+
|
|
7
|
+
## Why It Matters
|
|
8
|
+
|
|
9
|
+
Remounting a component:
|
|
10
|
+
1. Destroys the Three.js object
|
|
11
|
+
2. Triggers disposal (if configured)
|
|
12
|
+
3. Creates new geometry/material
|
|
13
|
+
4. Uploads new data to GPU
|
|
14
|
+
5. Recompiles shaders
|
|
15
|
+
|
|
16
|
+
Toggling visibility:
|
|
17
|
+
1. Sets `object.visible = false`
|
|
18
|
+
2. That's it - object stays in memory
|
|
19
|
+
|
|
20
|
+
## BAD: Conditional Mounting
|
|
21
|
+
|
|
22
|
+
```jsx
|
|
23
|
+
function Scene({ showModel }) {
|
|
24
|
+
return (
|
|
25
|
+
<>
|
|
26
|
+
{showModel && <ExpensiveModel />}
|
|
27
|
+
</>
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Every toggle destroys and recreates the entire model.
|
|
33
|
+
|
|
34
|
+
## GOOD: Visibility Toggle
|
|
35
|
+
|
|
36
|
+
```jsx
|
|
37
|
+
function Scene({ showModel }) {
|
|
38
|
+
return (
|
|
39
|
+
<ExpensiveModel visible={showModel} />
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Model stays in memory, just skipped during render.
|
|
45
|
+
|
|
46
|
+
## When to Use Each
|
|
47
|
+
|
|
48
|
+
### Use Visibility Toggle When:
|
|
49
|
+
- Frequent show/hide (e.g., UI state)
|
|
50
|
+
- Object is expensive to create
|
|
51
|
+
- Object is needed again soon
|
|
52
|
+
- Object count is manageable
|
|
53
|
+
|
|
54
|
+
### Use Conditional Mounting When:
|
|
55
|
+
- Object is rarely shown
|
|
56
|
+
- Memory is constrained
|
|
57
|
+
- Object is cheap to create
|
|
58
|
+
- Large number of potential objects
|
|
59
|
+
|
|
60
|
+
## With Refs
|
|
61
|
+
|
|
62
|
+
```jsx
|
|
63
|
+
function ToggleableModel() {
|
|
64
|
+
const meshRef = useRef();
|
|
65
|
+
const [visible, setVisible] = useState(true);
|
|
66
|
+
|
|
67
|
+
// Direct mutation for animations
|
|
68
|
+
useFrame(() => {
|
|
69
|
+
if (meshRef.current) {
|
|
70
|
+
meshRef.current.visible = shouldBeVisible;
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
return <mesh ref={meshRef} visible={visible} />;
|
|
75
|
+
}
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Visibility vs Layers
|
|
79
|
+
|
|
80
|
+
For complex visibility logic, consider using Three.js layers:
|
|
81
|
+
|
|
82
|
+
```jsx
|
|
83
|
+
function SelectiveRendering() {
|
|
84
|
+
const meshRef = useRef();
|
|
85
|
+
|
|
86
|
+
useEffect(() => {
|
|
87
|
+
// Set to layer 1 (not rendered by default camera)
|
|
88
|
+
meshRef.current.layers.set(1);
|
|
89
|
+
}, []);
|
|
90
|
+
|
|
91
|
+
return <mesh ref={meshRef} />;
|
|
92
|
+
}
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
Layers allow camera-selective rendering without changing visibility.
|
|
Binary file
|
|
@@ -4,15 +4,19 @@ description: Three.js performance optimization and best practices guidelines. Us
|
|
|
4
4
|
license: MIT
|
|
5
5
|
metadata:
|
|
6
6
|
author: three-agent-skills
|
|
7
|
-
version: "2.
|
|
7
|
+
version: "2.1.0"
|
|
8
8
|
three-version: "0.182.0+"
|
|
9
9
|
---
|
|
10
10
|
|
|
11
11
|
# Three.js Best Practices
|
|
12
12
|
|
|
13
|
-
Comprehensive performance optimization guide for Three.js applications. Contains
|
|
13
|
+
Comprehensive performance optimization guide for Three.js applications. Contains 120+ rules across 18 categories, prioritized by impact.
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
## Sources & Credits
|
|
16
|
+
|
|
17
|
+
> This skill compiles best practices from multiple authoritative sources:
|
|
18
|
+
> - Official guidelines from Three.js `llms` branch maintained by [mrdoob](https://github.com/mrdoob)
|
|
19
|
+
> - [100 Three.js Tips](https://www.utsubo.com/blog/threejs-best-practices-100-tips) by [Utsubo](https://www.utsubo.com) - Excellent comprehensive guide covering WebGPU, asset optimization, and performance tips
|
|
16
20
|
|
|
17
21
|
## When to Apply
|
|
18
22
|
|
|
@@ -33,21 +37,26 @@ Reference these guidelines when:
|
|
|
33
37
|
| 0 | Modern Setup & Imports | FUNDAMENTAL | `setup-` |
|
|
34
38
|
| 1 | Memory Management & Dispose | CRITICAL | `memory-` |
|
|
35
39
|
| 2 | Render Loop Optimization | CRITICAL | `render-` |
|
|
36
|
-
| 3 |
|
|
37
|
-
| 4 |
|
|
38
|
-
| 5 |
|
|
39
|
-
| 6 |
|
|
40
|
-
| 7 |
|
|
41
|
-
| 8 |
|
|
42
|
-
| 9 |
|
|
43
|
-
| 10 |
|
|
44
|
-
| 11 |
|
|
45
|
-
| 12 |
|
|
46
|
-
| 13 |
|
|
47
|
-
| 14 |
|
|
48
|
-
| 15 |
|
|
49
|
-
| 16 |
|
|
50
|
-
| 17 |
|
|
40
|
+
| 3 | Draw Call Optimization | CRITICAL | `drawcall-` |
|
|
41
|
+
| 4 | Geometry & Buffer Management | HIGH | `geometry-` |
|
|
42
|
+
| 5 | Material & Texture Optimization | HIGH | `material-` |
|
|
43
|
+
| 6 | Asset Compression | HIGH | `asset-` |
|
|
44
|
+
| 7 | Lighting & Shadows | MEDIUM-HIGH | `lighting-` |
|
|
45
|
+
| 8 | Scene Graph Organization | MEDIUM | `scene-` |
|
|
46
|
+
| 9 | Shader Best Practices (GLSL) | MEDIUM | `shader-` |
|
|
47
|
+
| 10 | TSL (Three.js Shading Language) | MEDIUM | `tsl-` |
|
|
48
|
+
| 11 | WebGPU Renderer | MEDIUM | `webgpu-` |
|
|
49
|
+
| 12 | Loading & Assets | MEDIUM | `loading-` |
|
|
50
|
+
| 13 | Core Web Vitals | MEDIUM-HIGH | `vitals-` |
|
|
51
|
+
| 14 | Camera & Controls | LOW-MEDIUM | `camera-` |
|
|
52
|
+
| 15 | Animation System | MEDIUM | `animation-` |
|
|
53
|
+
| 16 | Physics Integration | MEDIUM | `physics-` |
|
|
54
|
+
| 17 | WebXR / VR / AR | MEDIUM | `webxr-` |
|
|
55
|
+
| 18 | Audio | LOW-MEDIUM | `audio-` |
|
|
56
|
+
| 19 | Post-Processing | MEDIUM | `postpro-` |
|
|
57
|
+
| 20 | Mobile Optimization | HIGH | `mobile-` |
|
|
58
|
+
| 21 | Production | HIGH | `error-`, `migration-` |
|
|
59
|
+
| 22 | Debug & DevTools | LOW | `debug-` |
|
|
51
60
|
|
|
52
61
|
## Quick Reference
|
|
53
62
|
|
|
@@ -81,7 +90,14 @@ Reference these guidelines when:
|
|
|
81
90
|
- `render-pixel-ratio` - Limit pixel ratio to 2
|
|
82
91
|
- `render-antialias-wisely` - Use antialiasing judiciously
|
|
83
92
|
|
|
84
|
-
### 3.
|
|
93
|
+
### 3. Draw Call Optimization (CRITICAL)
|
|
94
|
+
|
|
95
|
+
- `draw-call-optimization` - Target under 100 draw calls per frame
|
|
96
|
+
- `geometry-instanced-mesh` - Use InstancedMesh for identical objects
|
|
97
|
+
- `geometry-batched-mesh` - Use BatchedMesh for varied geometries (same material)
|
|
98
|
+
- `geometry-merge-static` - Merge static geometries with BufferGeometryUtils
|
|
99
|
+
|
|
100
|
+
### 4. Geometry (HIGH)
|
|
85
101
|
|
|
86
102
|
- `geometry-buffer-geometry` - Always use BufferGeometry
|
|
87
103
|
- `geometry-merge-static` - Merge static geometries
|
|
@@ -92,7 +108,7 @@ Reference these guidelines when:
|
|
|
92
108
|
- `geometry-attributes-typed` - Use appropriate typed arrays
|
|
93
109
|
- `geometry-interleaved` - Consider interleaved buffers
|
|
94
110
|
|
|
95
|
-
###
|
|
111
|
+
### 5. Materials & Textures (HIGH)
|
|
96
112
|
|
|
97
113
|
- `material-reuse` - Reuse materials across meshes
|
|
98
114
|
- `material-simplest-sufficient` - Use simplest material that works
|
|
@@ -104,37 +120,51 @@ Reference these guidelines when:
|
|
|
104
120
|
- `material-avoid-transparency` - Minimize transparent materials
|
|
105
121
|
- `material-onbeforecompile` - Use onBeforeCompile for shader mods (or TSL)
|
|
106
122
|
|
|
107
|
-
###
|
|
123
|
+
### 6. Asset Compression (HIGH)
|
|
124
|
+
|
|
125
|
+
- `asset-compression` - Draco, Meshopt, KTX2 compression guide
|
|
126
|
+
- `asset-draco` - 90-95% geometry size reduction
|
|
127
|
+
- `asset-ktx2` - GPU-compressed textures (UASTC vs ETC1S)
|
|
128
|
+
- `asset-meshopt` - Alternative to Draco with faster decompression
|
|
129
|
+
- `asset-lod` - Level of Detail for 30-40% frame rate improvement
|
|
130
|
+
|
|
131
|
+
### 7. Lighting & Shadows (MEDIUM-HIGH)
|
|
108
132
|
|
|
109
|
-
- `lighting-limit-lights` -
|
|
133
|
+
- `lighting-limit-lights` - Limit to 3 or fewer active lights
|
|
134
|
+
- `lighting-shadows-advanced` - PointLight cost, CSM, fake shadows
|
|
110
135
|
- `lighting-bake-static` - Bake lighting for static scenes
|
|
111
136
|
- `lighting-shadow-camera-tight` - Fit shadow camera tightly
|
|
112
|
-
- `lighting-shadow-map-size` - Choose appropriate shadow resolution
|
|
137
|
+
- `lighting-shadow-map-size` - Choose appropriate shadow resolution (512-4096)
|
|
113
138
|
- `lighting-shadow-selective` - Enable shadows selectively
|
|
114
139
|
- `lighting-shadow-cascade` - Use CSM for large scenes
|
|
140
|
+
- `lighting-shadow-auto-update` - Disable autoUpdate for static scenes
|
|
115
141
|
- `lighting-probe` - Use Light Probes
|
|
142
|
+
- `lighting-environment` - Environment maps for ambient light
|
|
143
|
+
- `lighting-fake-shadows` - Gradient planes for budget contact shadows
|
|
116
144
|
|
|
117
|
-
###
|
|
145
|
+
### 8. Scene Graph (MEDIUM)
|
|
118
146
|
|
|
119
147
|
- `scene-group-objects` - Use Groups for organization
|
|
120
148
|
- `scene-layers` - Use Layers for selective rendering
|
|
121
149
|
- `scene-visible-toggle` - Use visible flag, not add/remove
|
|
122
150
|
- `scene-flatten-static` - Flatten static hierarchies
|
|
123
151
|
- `scene-name-objects` - Name objects for debugging
|
|
124
|
-
- `
|
|
152
|
+
- `object-pooling` - Reuse objects instead of create/destroy
|
|
125
153
|
|
|
126
|
-
###
|
|
154
|
+
### 9. Shaders GLSL (MEDIUM)
|
|
127
155
|
|
|
128
|
-
- `shader-precision` - Use
|
|
129
|
-
- `shader-
|
|
156
|
+
- `shader-precision` - Use mediump for mobile (~2x faster)
|
|
157
|
+
- `shader-mobile` - Mobile-specific optimizations (varyings, branching)
|
|
158
|
+
- `shader-avoid-branching` - Replace conditionals with mix/step
|
|
130
159
|
- `shader-precompute-cpu` - Precompute on CPU
|
|
131
160
|
- `shader-avoid-discard` - Avoid discard, use alphaTest
|
|
132
161
|
- `shader-texture-lod` - Use textureLod for known mip levels
|
|
133
162
|
- `shader-uniform-arrays` - Prefer uniform arrays
|
|
134
|
-
- `shader-varying-interpolation` -
|
|
163
|
+
- `shader-varying-interpolation` - Limit varyings to 3 for mobile
|
|
164
|
+
- `shader-pack-data` - Pack data into RGBA channels
|
|
135
165
|
- `shader-chunk-injection` - Use Three.js shader chunks
|
|
136
166
|
|
|
137
|
-
###
|
|
167
|
+
### 10. TSL - Three.js Shading Language (MEDIUM)
|
|
138
168
|
|
|
139
169
|
- `tsl-why-use` - Use TSL instead of onBeforeCompile
|
|
140
170
|
- `tsl-setup-webgpu` - WebGPU setup for TSL
|
|
@@ -145,11 +175,22 @@ Reference these guidelines when:
|
|
|
145
175
|
- `tsl-functions` - Creating TSL functions with Fn()
|
|
146
176
|
- `tsl-conditionals` - If, select, loops in TSL
|
|
147
177
|
- `tsl-textures` - Textures and triplanar mapping
|
|
178
|
+
- `tsl-noise` - Built-in noise functions (mx_noise_float, mx_fractal_noise)
|
|
148
179
|
- `tsl-post-processing` - bloom, blur, dof, ao
|
|
149
180
|
- `tsl-compute-shaders` - GPGPU and compute operations
|
|
150
181
|
- `tsl-glsl-to-tsl` - GLSL to TSL translation
|
|
151
182
|
|
|
152
|
-
###
|
|
183
|
+
### 11. WebGPU Renderer (MEDIUM)
|
|
184
|
+
|
|
185
|
+
- `webgpu-renderer` - Setup, browser support, migration guide
|
|
186
|
+
- `webgpu-render-async` - Use renderAsync for compute-heavy scenes
|
|
187
|
+
- `webgpu-feature-detection` - Check adapter features
|
|
188
|
+
- `webgpu-instanced-array` - GPU-persistent buffers
|
|
189
|
+
- `webgpu-storage-textures` - Read-write compute textures
|
|
190
|
+
- `webgpu-workgroup-memory` - Shared memory (10-100x faster)
|
|
191
|
+
- `webgpu-indirect-draws` - GPU-driven rendering
|
|
192
|
+
|
|
193
|
+
### 12. Loading & Assets (MEDIUM)
|
|
153
194
|
|
|
154
195
|
- `loading-draco-compression` - Use Draco for large meshes
|
|
155
196
|
- `loading-gltf-preferred` - Use glTF format
|
|
@@ -160,7 +201,18 @@ Reference these guidelines when:
|
|
|
160
201
|
- `loading-cache-assets` - Enable caching
|
|
161
202
|
- `loading-dispose-unused` - Unload unused assets
|
|
162
203
|
|
|
163
|
-
###
|
|
204
|
+
### 13. Core Web Vitals (MEDIUM-HIGH)
|
|
205
|
+
|
|
206
|
+
- `core-web-vitals` - LCP, FID, CLS optimization for 3D
|
|
207
|
+
- `vitals-lazy-load` - Lazy load 3D below the fold with IntersectionObserver
|
|
208
|
+
- `vitals-code-split` - Dynamic import Three.js modules
|
|
209
|
+
- `vitals-preload` - Preload critical assets with link tags
|
|
210
|
+
- `vitals-progressive-loading` - Low-res to high-res progressive load
|
|
211
|
+
- `vitals-placeholders` - Show placeholder geometry during load
|
|
212
|
+
- `vitals-web-workers` - Offload heavy work to workers
|
|
213
|
+
- `vitals-streaming` - Stream large scenes by chunks
|
|
214
|
+
|
|
215
|
+
### 14. Camera & Controls (LOW-MEDIUM)
|
|
164
216
|
|
|
165
217
|
- `camera-near-far` - Set tight near/far planes
|
|
166
218
|
- `camera-fov` - Choose appropriate FOV
|
|
@@ -168,38 +220,52 @@ Reference these guidelines when:
|
|
|
168
220
|
- `camera-resize-handler` - Handle resize properly
|
|
169
221
|
- `camera-orbit-limits` - Set orbit control limits
|
|
170
222
|
|
|
171
|
-
###
|
|
223
|
+
### 15. Animation (MEDIUM)
|
|
172
224
|
|
|
173
225
|
- `animation-system` - AnimationMixer, blending, morph targets, skeletal
|
|
174
226
|
|
|
175
|
-
###
|
|
227
|
+
### 16. Physics (MEDIUM)
|
|
176
228
|
|
|
177
229
|
- `physics-integration` - Rapier, Cannon-es integration patterns
|
|
230
|
+
- `physics-compute-shaders` - GPU physics with compute shaders
|
|
178
231
|
|
|
179
|
-
###
|
|
232
|
+
### 17. WebXR (MEDIUM)
|
|
180
233
|
|
|
181
234
|
- `webxr-setup` - VR/AR buttons, controllers, hit testing
|
|
182
235
|
|
|
183
|
-
###
|
|
236
|
+
### 18. Audio (LOW-MEDIUM)
|
|
184
237
|
|
|
185
238
|
- `audio-spatial` - PositionalAudio, HRTF, spatial sound
|
|
186
239
|
|
|
187
|
-
###
|
|
240
|
+
### 19. Post-Processing (MEDIUM)
|
|
241
|
+
|
|
242
|
+
- `postprocessing-optimization` - pmndrs/postprocessing guide
|
|
243
|
+
- `postpro-renderer-config` - Disable AA, stencil, depth for post
|
|
244
|
+
- `postpro-merge-effects` - Combine effects in single pass
|
|
245
|
+
- `postpro-selective-bloom` - Selective bloom for performance
|
|
246
|
+
- `postpro-resolution-scaling` - Half resolution for 2x FPS
|
|
247
|
+
- `postpro-webgpu-native` - TSL-based post for WebGPU
|
|
248
|
+
|
|
249
|
+
### 20. Optimization (HIGH)
|
|
188
250
|
|
|
189
251
|
- `mobile-optimization` - Mobile-specific optimizations and checklist
|
|
190
252
|
- `raycasting-optimization` - BVH, layers, GPU picking
|
|
191
253
|
|
|
192
|
-
###
|
|
254
|
+
### 21. Production (HIGH)
|
|
193
255
|
|
|
194
256
|
- `error-handling-recovery` - WebGL context loss and recovery
|
|
195
257
|
- `migration-checklist` - Breaking changes by version
|
|
196
258
|
|
|
197
|
-
###
|
|
259
|
+
### 22. Debug & DevTools (LOW)
|
|
198
260
|
|
|
199
|
-
- `debug-
|
|
200
|
-
- `debug-
|
|
201
|
-
- `debug-gui` -
|
|
202
|
-
- `debug-
|
|
261
|
+
- `debug-devtools` - Complete debugging toolkit
|
|
262
|
+
- `debug-stats-gl` - stats-gl for WebGL/WebGPU monitoring
|
|
263
|
+
- `debug-lil-gui` - lil-gui for live parameter tweaking
|
|
264
|
+
- `debug-spector` - Spector.js for WebGL frame capture
|
|
265
|
+
- `debug-renderer-info` - Monitor draw calls and memory
|
|
266
|
+
- `debug-three-mesh-bvh` - Fast raycasting with BVH
|
|
267
|
+
- `debug-context-lost` - Handle WebGL context loss
|
|
268
|
+
- `debug-animation-loop-profiling` - Profile render loop sections
|
|
203
269
|
- `debug-conditional` - Remove debug code in production
|
|
204
270
|
|
|
205
271
|
## How to Use
|
|
@@ -27,7 +27,13 @@
|
|
|
27
27
|
- render-pixel-ratio
|
|
28
28
|
- render-antialias-wisely
|
|
29
29
|
|
|
30
|
-
## Priority 3:
|
|
30
|
+
## Priority 3: Draw Call Optimization (CRITICAL)
|
|
31
|
+
- draw-call-optimization
|
|
32
|
+
- geometry-instanced-mesh
|
|
33
|
+
- geometry-batched-mesh
|
|
34
|
+
- geometry-merge-static
|
|
35
|
+
|
|
36
|
+
## Priority 4: Geometry & Buffer Management (HIGH)
|
|
31
37
|
- geometry-buffer-geometry
|
|
32
38
|
- geometry-merge-static
|
|
33
39
|
- geometry-instanced-mesh
|
|
@@ -37,7 +43,7 @@
|
|
|
37
43
|
- geometry-attributes-typed
|
|
38
44
|
- geometry-interleaved
|
|
39
45
|
|
|
40
|
-
## Priority
|
|
46
|
+
## Priority 5: Material & Texture Optimization (HIGH)
|
|
41
47
|
- material-reuse
|
|
42
48
|
- material-simplest-sufficient
|
|
43
49
|
- material-texture-size-power-of-two
|
|
@@ -48,34 +54,47 @@
|
|
|
48
54
|
- material-avoid-transparency
|
|
49
55
|
- material-onbeforecompile
|
|
50
56
|
|
|
51
|
-
## Priority
|
|
57
|
+
## Priority 6: Asset Compression (HIGH)
|
|
58
|
+
- asset-compression
|
|
59
|
+
- asset-draco
|
|
60
|
+
- asset-ktx2
|
|
61
|
+
- asset-meshopt
|
|
62
|
+
- asset-lod
|
|
63
|
+
|
|
64
|
+
## Priority 7: Lighting & Shadows (MEDIUM-HIGH)
|
|
52
65
|
- lighting-limit-lights
|
|
66
|
+
- lighting-shadows-advanced
|
|
53
67
|
- lighting-bake-static
|
|
54
68
|
- lighting-shadow-camera-tight
|
|
55
69
|
- lighting-shadow-map-size
|
|
56
70
|
- lighting-shadow-selective
|
|
57
71
|
- lighting-shadow-cascade
|
|
72
|
+
- lighting-shadow-auto-update
|
|
58
73
|
- lighting-probe
|
|
74
|
+
- lighting-environment
|
|
75
|
+
- lighting-fake-shadows
|
|
59
76
|
|
|
60
|
-
## Priority
|
|
77
|
+
## Priority 8: Scene Graph Organization (MEDIUM)
|
|
61
78
|
- scene-group-objects
|
|
62
79
|
- scene-layers
|
|
63
80
|
- scene-visible-toggle
|
|
64
81
|
- scene-flatten-static
|
|
65
82
|
- scene-name-objects
|
|
66
|
-
-
|
|
83
|
+
- object-pooling
|
|
67
84
|
|
|
68
|
-
## Priority
|
|
85
|
+
## Priority 9: Shader Best Practices GLSL (MEDIUM)
|
|
69
86
|
- shader-precision
|
|
87
|
+
- shader-mobile
|
|
70
88
|
- shader-avoid-branching
|
|
71
89
|
- shader-precompute-cpu
|
|
72
90
|
- shader-avoid-discard
|
|
73
91
|
- shader-texture-lod
|
|
74
92
|
- shader-uniform-arrays
|
|
75
93
|
- shader-varying-interpolation
|
|
94
|
+
- shader-pack-data
|
|
76
95
|
- shader-chunk-injection
|
|
77
96
|
|
|
78
|
-
## Priority
|
|
97
|
+
## Priority 10: TSL - Three.js Shading Language (MEDIUM)
|
|
79
98
|
- tsl-why-use
|
|
80
99
|
- tsl-setup-webgpu
|
|
81
100
|
- tsl-complete-reference
|
|
@@ -86,11 +105,21 @@
|
|
|
86
105
|
- tsl-functions
|
|
87
106
|
- tsl-conditionals
|
|
88
107
|
- tsl-textures
|
|
108
|
+
- tsl-noise
|
|
89
109
|
- tsl-post-processing
|
|
90
110
|
- tsl-compute-shaders
|
|
91
111
|
- tsl-glsl-to-tsl
|
|
92
112
|
|
|
93
|
-
## Priority
|
|
113
|
+
## Priority 11: WebGPU Renderer (MEDIUM)
|
|
114
|
+
- webgpu-renderer
|
|
115
|
+
- webgpu-render-async
|
|
116
|
+
- webgpu-feature-detection
|
|
117
|
+
- webgpu-instanced-array
|
|
118
|
+
- webgpu-storage-textures
|
|
119
|
+
- webgpu-workgroup-memory
|
|
120
|
+
- webgpu-indirect-draws
|
|
121
|
+
|
|
122
|
+
## Priority 12: Loading & Assets (MEDIUM)
|
|
94
123
|
- loading-draco-compression
|
|
95
124
|
- loading-gltf-preferred
|
|
96
125
|
- gltf-loading-optimization
|
|
@@ -100,36 +129,59 @@
|
|
|
100
129
|
- loading-cache-assets
|
|
101
130
|
- loading-dispose-unused
|
|
102
131
|
|
|
103
|
-
## Priority
|
|
132
|
+
## Priority 13: Core Web Vitals (MEDIUM-HIGH)
|
|
133
|
+
- core-web-vitals
|
|
134
|
+
- vitals-lazy-load
|
|
135
|
+
- vitals-code-split
|
|
136
|
+
- vitals-preload
|
|
137
|
+
- vitals-progressive-loading
|
|
138
|
+
- vitals-placeholders
|
|
139
|
+
- vitals-web-workers
|
|
140
|
+
- vitals-streaming
|
|
141
|
+
|
|
142
|
+
## Priority 14: Camera & Controls (LOW-MEDIUM)
|
|
104
143
|
- camera-near-far
|
|
105
144
|
- camera-fov
|
|
106
145
|
- camera-controls-damping
|
|
107
146
|
- camera-resize-handler
|
|
108
147
|
- camera-orbit-limits
|
|
109
148
|
|
|
110
|
-
## Priority
|
|
149
|
+
## Priority 15: Animation System (MEDIUM)
|
|
111
150
|
- animation-system
|
|
112
151
|
|
|
113
|
-
## Priority
|
|
152
|
+
## Priority 16: Physics Integration (MEDIUM)
|
|
114
153
|
- physics-integration
|
|
154
|
+
- physics-compute-shaders
|
|
115
155
|
|
|
116
|
-
## Priority
|
|
156
|
+
## Priority 17: WebXR / VR / AR (MEDIUM)
|
|
117
157
|
- webxr-setup
|
|
118
158
|
|
|
119
|
-
## Priority
|
|
159
|
+
## Priority 18: Audio (LOW-MEDIUM)
|
|
120
160
|
- audio-spatial
|
|
121
161
|
|
|
122
|
-
## Priority
|
|
162
|
+
## Priority 19: Post-Processing (MEDIUM)
|
|
163
|
+
- postprocessing-optimization
|
|
164
|
+
- postpro-renderer-config
|
|
165
|
+
- postpro-merge-effects
|
|
166
|
+
- postpro-selective-bloom
|
|
167
|
+
- postpro-resolution-scaling
|
|
168
|
+
- postpro-webgpu-native
|
|
169
|
+
|
|
170
|
+
## Priority 20: Mobile Optimization (HIGH)
|
|
123
171
|
- mobile-optimization
|
|
124
172
|
- raycasting-optimization
|
|
125
173
|
|
|
126
|
-
## Priority
|
|
174
|
+
## Priority 21: Production (HIGH)
|
|
127
175
|
- error-handling-recovery
|
|
128
176
|
- migration-checklist
|
|
129
177
|
|
|
130
|
-
## Priority
|
|
131
|
-
- debug-
|
|
132
|
-
- debug-
|
|
133
|
-
- debug-gui
|
|
178
|
+
## Priority 22: Debug & DevTools (LOW)
|
|
179
|
+
- debug-devtools
|
|
180
|
+
- debug-stats-gl
|
|
181
|
+
- debug-lil-gui
|
|
182
|
+
- debug-spector
|
|
134
183
|
- debug-renderer-info
|
|
184
|
+
- debug-three-mesh-bvh
|
|
185
|
+
- debug-context-lost
|
|
186
|
+
- debug-animation-loop-profiling
|
|
135
187
|
- debug-conditional
|