opencode-skills-antigravity 1.0.19 → 1.0.21
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/bundled-skills/.antigravity-install-manifest.json +1330 -0
- package/bundled-skills/akf-trust-metadata/SKILL.md +69 -0
- package/bundled-skills/docs/integrations/jetski-cortex.md +3 -3
- package/bundled-skills/docs/integrations/jetski-gemini-loader/README.md +1 -1
- package/bundled-skills/docs/maintainers/repo-growth-seo.md +3 -3
- package/bundled-skills/docs/maintainers/skills-update-guide.md +1 -1
- package/bundled-skills/docs/users/bundles.md +77 -1
- package/bundled-skills/docs/users/claude-code-skills.md +7 -1
- package/bundled-skills/docs/users/codex-cli-skills.md +7 -0
- package/bundled-skills/docs/users/faq.md +23 -0
- package/bundled-skills/docs/users/gemini-cli-skills.md +1 -1
- package/bundled-skills/docs/users/getting-started.md +10 -3
- package/bundled-skills/docs/users/kiro-integration.md +1 -1
- package/bundled-skills/docs/users/plugins.md +157 -0
- package/bundled-skills/docs/users/usage.md +14 -4
- package/bundled-skills/docs/users/visual-guide.md +4 -4
- package/bundled-skills/phase-gated-debugging/SKILL.md +70 -0
- package/bundled-skills/playwright-skill/SKILL.md +8 -3
- package/bundled-skills/saas-multi-tenant/SKILL.md +183 -0
- package/bundled-skills/threejs-animation/SKILL.md +13 -8
- package/bundled-skills/threejs-fundamentals/SKILL.md +44 -1
- package/bundled-skills/threejs-geometry/SKILL.md +30 -0
- package/bundled-skills/threejs-interaction/SKILL.md +12 -0
- package/bundled-skills/threejs-lighting/SKILL.md +3 -2
- package/bundled-skills/threejs-loaders/SKILL.md +21 -1
- package/bundled-skills/threejs-materials/SKILL.md +22 -0
- package/bundled-skills/threejs-postprocessing/SKILL.md +30 -9
- package/bundled-skills/threejs-shaders/SKILL.md +43 -0
- package/bundled-skills/threejs-skills/SKILL.md +103 -42
- package/bundled-skills/threejs-textures/SKILL.md +8 -0
- package/package.json +1 -1
|
@@ -189,6 +189,18 @@ function animate() {
|
|
|
189
189
|
}
|
|
190
190
|
```
|
|
191
191
|
|
|
192
|
+
#### OrbitControls Programmatic Methods (r183)
|
|
193
|
+
|
|
194
|
+
```javascript
|
|
195
|
+
// Programmatic camera movement
|
|
196
|
+
controls.dolly(1.5); // Dolly in/out (zoom for perspective cameras)
|
|
197
|
+
controls.pan(deltaX, deltaY); // Pan the camera
|
|
198
|
+
controls.rotate(deltaAzimuth, deltaPolar); // Rotate around target
|
|
199
|
+
|
|
200
|
+
// Cursor style (r183)
|
|
201
|
+
controls.cursorStyle = { orbit: "grab", pan: "move", dolly: "zoom-in" };
|
|
202
|
+
```
|
|
203
|
+
|
|
192
204
|
### FlyControls
|
|
193
205
|
|
|
194
206
|
```javascript
|
|
@@ -186,7 +186,7 @@ Rectangular area light. Great for soft, realistic lighting.
|
|
|
186
186
|
import { RectAreaLightHelper } from "three/examples/jsm/helpers/RectAreaLightHelper.js";
|
|
187
187
|
import { RectAreaLightUniformsLib } from "three/examples/jsm/lights/RectAreaLightUniformsLib.js";
|
|
188
188
|
|
|
189
|
-
// Must initialize uniforms first
|
|
189
|
+
// Must initialize uniforms first (WebGL renderer only)
|
|
190
190
|
RectAreaLightUniformsLib.init();
|
|
191
191
|
|
|
192
192
|
// RectAreaLight(color, intensity, width, height)
|
|
@@ -199,7 +199,8 @@ scene.add(rectLight);
|
|
|
199
199
|
const helper = new RectAreaLightHelper(rectLight);
|
|
200
200
|
rectLight.add(helper);
|
|
201
201
|
|
|
202
|
-
//
|
|
202
|
+
// Works with MeshStandardMaterial, MeshPhysicalMaterial
|
|
203
|
+
// r183: Clearcoat on MeshPhysicalMaterial is now properly lit by RectAreaLight
|
|
203
204
|
// Does not cast shadows natively
|
|
204
205
|
```
|
|
205
206
|
|
|
@@ -255,7 +255,7 @@ import { KTX2Loader } from "three/addons/loaders/KTX2Loader.js";
|
|
|
255
255
|
|
|
256
256
|
const ktx2Loader = new KTX2Loader();
|
|
257
257
|
ktx2Loader.setTranscoderPath(
|
|
258
|
-
"https://cdn.jsdelivr.net/npm/three@0.
|
|
258
|
+
"https://cdn.jsdelivr.net/npm/three@0.183.0/examples/jsm/libs/basis/",
|
|
259
259
|
);
|
|
260
260
|
ktx2Loader.detectSupport(renderer);
|
|
261
261
|
|
|
@@ -267,6 +267,22 @@ gltfLoader.load("model-with-ktx2.glb", (gltf) => {
|
|
|
267
267
|
});
|
|
268
268
|
```
|
|
269
269
|
|
|
270
|
+
### GLTF with Meshopt Compression (r183)
|
|
271
|
+
|
|
272
|
+
```javascript
|
|
273
|
+
import { GLTFLoader } from "three/addons/loaders/GLTFLoader.js";
|
|
274
|
+
import { MeshoptDecoder } from "three/addons/libs/meshopt_decoder.module.js";
|
|
275
|
+
|
|
276
|
+
const gltfLoader = new GLTFLoader();
|
|
277
|
+
gltfLoader.setMeshoptDecoder(MeshoptDecoder);
|
|
278
|
+
|
|
279
|
+
gltfLoader.load("compressed-model.glb", (gltf) => {
|
|
280
|
+
scene.add(gltf.scene);
|
|
281
|
+
});
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
**KHR_meshopt_compression** is an alternative to Draco that often provides better compression for animated meshes and preserves mesh topology.
|
|
285
|
+
|
|
270
286
|
### Process GLTF Content
|
|
271
287
|
|
|
272
288
|
```javascript
|
|
@@ -618,6 +634,10 @@ loadModel("model.glb").then((gltf) => {
|
|
|
618
634
|
});
|
|
619
635
|
```
|
|
620
636
|
|
|
637
|
+
## VRMLLoader Camera Support (r183)
|
|
638
|
+
|
|
639
|
+
As of r183, `VRMLLoader` supports loading cameras defined in VRML files.
|
|
640
|
+
|
|
621
641
|
## See Also
|
|
622
642
|
|
|
623
643
|
- `threejs-textures` - Texture configuration
|
|
@@ -515,6 +515,28 @@ function getMaterial(color) {
|
|
|
515
515
|
material.dispose();
|
|
516
516
|
```
|
|
517
517
|
|
|
518
|
+
## NodeMaterial / TSL (Future Direction)
|
|
519
|
+
|
|
520
|
+
Three.js is moving toward **NodeMaterial** and **TSL (Three.js Shading Language)** as the standard material system, especially for the WebGPU renderer:
|
|
521
|
+
|
|
522
|
+
```javascript
|
|
523
|
+
import { MeshStandardNodeMaterial } from "three/addons/nodes/Nodes.js";
|
|
524
|
+
import { color, uv, texture } from "three/addons/nodes/Nodes.js";
|
|
525
|
+
|
|
526
|
+
const material = new MeshStandardNodeMaterial();
|
|
527
|
+
material.colorNode = texture(colorMap, uv());
|
|
528
|
+
```
|
|
529
|
+
|
|
530
|
+
**Key points:**
|
|
531
|
+
- NodeMaterial works with both WebGL and WebGPU renderers
|
|
532
|
+
- `onBeforeCompile` does **not** work with the WebGPU renderer -- use NodeMaterial instead
|
|
533
|
+
- TSL replaces GLSL for cross-renderer shader compatibility
|
|
534
|
+
- Standard GLSL `ShaderMaterial` continues to work with the WebGL renderer
|
|
535
|
+
|
|
536
|
+
## Lambert/Phong IBL Support (r183)
|
|
537
|
+
|
|
538
|
+
As of r183, `MeshLambertMaterial` and `MeshPhongMaterial` support image-based lighting (IBL) via `scene.environment`. Previously, only PBR materials (Standard/Physical) responded to environment maps set on the scene.
|
|
539
|
+
|
|
518
540
|
## See Also
|
|
519
541
|
|
|
520
542
|
- `threejs-textures` - Texture loading and configuration
|
|
@@ -521,25 +521,46 @@ function animate() {
|
|
|
521
521
|
}
|
|
522
522
|
```
|
|
523
523
|
|
|
524
|
-
## WebGPU Post-Processing (Three.js
|
|
524
|
+
## WebGPU Post-Processing (Three.js r183)
|
|
525
|
+
|
|
526
|
+
The WebGPU renderer uses a node-based `PostProcessing` class instead of `EffectComposer`. Note that `EffectComposer` is **WebGL-only**.
|
|
525
527
|
|
|
526
528
|
```javascript
|
|
527
|
-
import
|
|
528
|
-
import { pass, bloom, dof } from "three/
|
|
529
|
+
import * as THREE from "three";
|
|
530
|
+
import { pass, bloom, dof } from "three/tsl";
|
|
531
|
+
import { WebGPURenderer } from "three/addons/renderers/webgpu/WebGPURenderer.js";
|
|
529
532
|
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
const bloomNode = bloom(scenePass, 0.5, 0.4, 0.85);
|
|
533
|
+
const renderer = new WebGPURenderer({ antialias: true });
|
|
534
|
+
await renderer.init();
|
|
533
535
|
|
|
536
|
+
// Create post-processing
|
|
534
537
|
const postProcessing = new THREE.PostProcessing(renderer);
|
|
535
|
-
|
|
538
|
+
|
|
539
|
+
// Scene pass
|
|
540
|
+
const scenePass = pass(scene, camera);
|
|
541
|
+
|
|
542
|
+
// Add bloom
|
|
543
|
+
const bloomPass = bloom(scenePass, 0.5, 0.4, 0.85);
|
|
544
|
+
|
|
545
|
+
// Set output
|
|
546
|
+
postProcessing.outputNode = bloomPass;
|
|
536
547
|
|
|
537
548
|
// Render
|
|
538
|
-
|
|
549
|
+
renderer.setAnimationLoop(() => {
|
|
539
550
|
postProcessing.render();
|
|
540
|
-
}
|
|
551
|
+
});
|
|
541
552
|
```
|
|
542
553
|
|
|
554
|
+
### Key Differences from EffectComposer
|
|
555
|
+
|
|
556
|
+
| EffectComposer (WebGL) | PostProcessing (WebGPU) |
|
|
557
|
+
| ------------------------------- | -------------------------------- |
|
|
558
|
+
| `addPass(new RenderPass(...))` | `pass(scene, camera)` |
|
|
559
|
+
| `addPass(new UnrealBloomPass)` | `bloom(scenePass, ...)` |
|
|
560
|
+
| `composer.render()` | `postProcessing.render()` |
|
|
561
|
+
| Chain of passes | Node graph with `outputNode` |
|
|
562
|
+
| GLSL shader passes | TSL node-based effects |
|
|
563
|
+
|
|
543
564
|
## Performance Tips
|
|
544
565
|
|
|
545
566
|
1. **Limit passes**: Each pass adds a full-screen render
|
|
@@ -637,6 +637,49 @@ if (value > 0.5) {
|
|
|
637
637
|
color = mix(colorB, colorA, step(0.5, value));
|
|
638
638
|
```
|
|
639
639
|
|
|
640
|
+
## TSL (Three.js Shading Language) - Future Direction
|
|
641
|
+
|
|
642
|
+
TSL is the new shader authoring system for Three.js, designed to work with both WebGL and WebGPU renderers. GLSL patterns above are **WebGL-only** and will not work with the WebGPU renderer.
|
|
643
|
+
|
|
644
|
+
### TSL Quick Start
|
|
645
|
+
|
|
646
|
+
```javascript
|
|
647
|
+
import { MeshStandardNodeMaterial } from "three/addons/nodes/Nodes.js";
|
|
648
|
+
import {
|
|
649
|
+
uv, sin, timerLocal, vec4, color, positionLocal, normalLocal,
|
|
650
|
+
float, mul, add
|
|
651
|
+
} from "three/addons/nodes/Nodes.js";
|
|
652
|
+
|
|
653
|
+
const material = new MeshStandardNodeMaterial();
|
|
654
|
+
|
|
655
|
+
// Animated color based on UV and time
|
|
656
|
+
const time = timerLocal();
|
|
657
|
+
material.colorNode = color(sin(add(uv().x, time)), uv().y, 0.5);
|
|
658
|
+
|
|
659
|
+
// Vertex displacement
|
|
660
|
+
material.positionNode = add(
|
|
661
|
+
positionLocal,
|
|
662
|
+
mul(normalLocal, sin(add(positionLocal.x, time)).mul(0.1))
|
|
663
|
+
);
|
|
664
|
+
```
|
|
665
|
+
|
|
666
|
+
### Key Differences from GLSL
|
|
667
|
+
|
|
668
|
+
| GLSL (WebGL only) | TSL (WebGL + WebGPU) |
|
|
669
|
+
| ----------------------- | ---------------------------- |
|
|
670
|
+
| `ShaderMaterial` | `MeshStandardNodeMaterial` |
|
|
671
|
+
| String-based shaders | JavaScript node graph |
|
|
672
|
+
| `onBeforeCompile` | Node composition |
|
|
673
|
+
| Manual uniforms | `uniform()` node |
|
|
674
|
+
| `texture2D()` | `texture()` node |
|
|
675
|
+
| `gl_Position` | `positionNode` |
|
|
676
|
+
| `gl_FragColor` | `colorNode` / `outputNode` |
|
|
677
|
+
|
|
678
|
+
### When to Use What
|
|
679
|
+
|
|
680
|
+
- **GLSL ShaderMaterial**: Existing WebGL projects, maximum shader control, porting existing shaders
|
|
681
|
+
- **TSL NodeMaterial**: New projects, WebGPU support needed, cross-renderer compatibility
|
|
682
|
+
|
|
640
683
|
## See Also
|
|
641
684
|
|
|
642
685
|
- `threejs-materials` - Built-in material types
|
|
@@ -22,14 +22,30 @@ Systematically create high-quality 3D scenes and interactive experiences using T
|
|
|
22
22
|
|
|
23
23
|
### 1. Essential Three.js Imports
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
Use ES module import maps for modern Three.js (r183+):
|
|
26
|
+
|
|
27
|
+
```html
|
|
28
|
+
<script type="importmap">
|
|
29
|
+
{
|
|
30
|
+
"imports": {
|
|
31
|
+
"three": "https://cdn.jsdelivr.net/npm/three@0.183.0/build/three.module.js",
|
|
32
|
+
"three/addons/": "https://cdn.jsdelivr.net/npm/three@0.183.0/examples/jsm/"
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
</script>
|
|
36
|
+
<script type="module">
|
|
37
|
+
import * as THREE from "three";
|
|
38
|
+
import { OrbitControls } from "three/addons/controls/OrbitControls.js";
|
|
39
|
+
</script>
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
For production with npm/vite/webpack:
|
|
26
43
|
|
|
27
44
|
```javascript
|
|
28
|
-
import * as THREE from "
|
|
45
|
+
import * as THREE from "three";
|
|
46
|
+
import { OrbitControls } from "three/addons/controls/OrbitControls.js";
|
|
29
47
|
```
|
|
30
48
|
|
|
31
|
-
**CRITICAL**: Do NOT use example imports like `THREE.OrbitControls` - they won't work on the CDN.
|
|
32
|
-
|
|
33
49
|
### 2. Scene Initialization
|
|
34
50
|
|
|
35
51
|
Every Three.js artifact needs these core components:
|
|
@@ -55,16 +71,21 @@ document.body.appendChild(renderer.domElement);
|
|
|
55
71
|
|
|
56
72
|
### 3. Animation Loop
|
|
57
73
|
|
|
58
|
-
Use
|
|
74
|
+
Use `renderer.setAnimationLoop()` (preferred) or `requestAnimationFrame`:
|
|
59
75
|
|
|
60
76
|
```javascript
|
|
77
|
+
// Preferred: setAnimationLoop (handles WebXR compatibility)
|
|
78
|
+
renderer.setAnimationLoop(() => {
|
|
79
|
+
mesh.rotation.x += 0.01;
|
|
80
|
+
mesh.rotation.y += 0.01;
|
|
81
|
+
renderer.render(scene, camera);
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
// Alternative: manual requestAnimationFrame
|
|
61
85
|
function animate() {
|
|
62
86
|
requestAnimationFrame(animate);
|
|
63
|
-
|
|
64
|
-
// Update object transformations here
|
|
65
87
|
mesh.rotation.x += 0.01;
|
|
66
88
|
mesh.rotation.y += 0.01;
|
|
67
|
-
|
|
68
89
|
renderer.render(scene, camera);
|
|
69
90
|
}
|
|
70
91
|
animate();
|
|
@@ -93,13 +114,11 @@ Choose appropriate geometry types:
|
|
|
93
114
|
- `PlaneGeometry` - flat surfaces, ground planes
|
|
94
115
|
- `TorusGeometry` - donuts, rings
|
|
95
116
|
|
|
96
|
-
**
|
|
97
|
-
|
|
98
|
-
**Alternatives for capsules:**
|
|
117
|
+
**CapsuleGeometry** is available (stable since r142):
|
|
99
118
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
119
|
+
```javascript
|
|
120
|
+
new THREE.CapsuleGeometry(0.5, 1, 4, 8); // radius, length, capSegments, radialSegments
|
|
121
|
+
```
|
|
103
122
|
|
|
104
123
|
### 3. Apply Materials
|
|
105
124
|
|
|
@@ -162,9 +181,26 @@ function animate() {
|
|
|
162
181
|
}
|
|
163
182
|
```
|
|
164
183
|
|
|
165
|
-
###
|
|
184
|
+
### OrbitControls
|
|
185
|
+
|
|
186
|
+
With import maps or build tools, OrbitControls works directly:
|
|
187
|
+
|
|
188
|
+
```javascript
|
|
189
|
+
import { OrbitControls } from "three/addons/controls/OrbitControls.js";
|
|
190
|
+
|
|
191
|
+
const controls = new OrbitControls(camera, renderer.domElement);
|
|
192
|
+
controls.enableDamping = true;
|
|
193
|
+
|
|
194
|
+
// Update in animation loop
|
|
195
|
+
renderer.setAnimationLoop(() => {
|
|
196
|
+
controls.update();
|
|
197
|
+
renderer.render(scene, camera);
|
|
198
|
+
});
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
### Custom Camera Controls (Alternative)
|
|
166
202
|
|
|
167
|
-
|
|
203
|
+
For lightweight custom controls without importing OrbitControls:
|
|
168
204
|
|
|
169
205
|
```javascript
|
|
170
206
|
let isDragging = false;
|
|
@@ -338,18 +374,18 @@ const material = new THREE.MeshStandardMaterial({
|
|
|
338
374
|
|
|
339
375
|
### Common Pitfalls to Avoid
|
|
340
376
|
|
|
341
|
-
- ❌ Using `
|
|
342
|
-
- ❌ Using `THREE.CapsuleGeometry` - requires r142+
|
|
377
|
+
- ❌ Using `outputEncoding` instead of `outputColorSpace` (renamed in r152)
|
|
343
378
|
- ❌ Forgetting to add objects to scene with `scene.add()`
|
|
344
379
|
- ❌ Using lit materials without adding lights
|
|
345
380
|
- ❌ Not handling window resize
|
|
346
381
|
- ❌ Forgetting to call `renderer.render()` in animation loop
|
|
382
|
+
- ❌ Using `THREE.Clock` without considering `THREE.Timer` (recommended in r183)
|
|
347
383
|
|
|
348
384
|
## Example Workflow
|
|
349
385
|
|
|
350
386
|
User: "Create an interactive 3D sphere that responds to mouse movement"
|
|
351
387
|
|
|
352
|
-
1. **Setup**: Import Three.js
|
|
388
|
+
1. **Setup**: Import Three.js, create scene/camera/renderer
|
|
353
389
|
2. **Geometry**: Create `SphereGeometry(1, 32, 32)` for smooth sphere
|
|
354
390
|
3. **Material**: Use `MeshStandardMaterial` for realistic look
|
|
355
391
|
4. **Lighting**: Add ambient + directional lights
|
|
@@ -449,7 +485,7 @@ const material = new THREE.MeshStandardMaterial({
|
|
|
449
485
|
// Improve color accuracy and HDR rendering
|
|
450
486
|
renderer.toneMapping = THREE.ACESFilmicToneMapping;
|
|
451
487
|
renderer.toneMappingExposure = 1.0;
|
|
452
|
-
renderer.
|
|
488
|
+
renderer.outputColorSpace = THREE.SRGBColorSpace; // Was outputEncoding in older versions
|
|
453
489
|
|
|
454
490
|
// Makes colors more vibrant and realistic
|
|
455
491
|
```
|
|
@@ -474,7 +510,7 @@ geometry.setAttribute("position", new THREE.BufferAttribute(vertices, 3));
|
|
|
474
510
|
|
|
475
511
|
### Post-Processing Effects
|
|
476
512
|
|
|
477
|
-
|
|
513
|
+
Post-processing effects are available via import maps or build tools. See `threejs-postprocessing` skill for EffectComposer, bloom, DOF, and more.
|
|
478
514
|
|
|
479
515
|
### Group Objects
|
|
480
516
|
|
|
@@ -490,36 +526,64 @@ scene.add(group);
|
|
|
490
526
|
|
|
491
527
|
Three.js artifacts require systematic setup:
|
|
492
528
|
|
|
493
|
-
1. Import
|
|
529
|
+
1. Import Three.js via import maps or build tools
|
|
494
530
|
2. Initialize scene, camera, renderer
|
|
495
531
|
3. Create geometry + material = mesh
|
|
496
532
|
4. Add lighting if using lit materials
|
|
497
|
-
5. Implement animation loop
|
|
533
|
+
5. Implement animation loop (prefer `setAnimationLoop`)
|
|
498
534
|
6. Handle window resize
|
|
499
|
-
7.
|
|
535
|
+
7. Set `renderer.outputColorSpace = THREE.SRGBColorSpace`
|
|
500
536
|
|
|
501
537
|
Follow these patterns for reliable, performant 3D experiences.
|
|
502
538
|
|
|
503
|
-
## Modern Three.js
|
|
539
|
+
## Modern Three.js Practices (r183)
|
|
504
540
|
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
### Modular Imports with Build Tools
|
|
541
|
+
### Modular Imports
|
|
508
542
|
|
|
509
543
|
```javascript
|
|
510
|
-
//
|
|
544
|
+
// With npm/vite/webpack:
|
|
511
545
|
import * as THREE from "three";
|
|
512
|
-
import { OrbitControls } from "three/
|
|
513
|
-
import { GLTFLoader } from "three/
|
|
514
|
-
import { EffectComposer } from "three/
|
|
546
|
+
import { OrbitControls } from "three/addons/controls/OrbitControls.js";
|
|
547
|
+
import { GLTFLoader } from "three/addons/loaders/GLTFLoader.js";
|
|
548
|
+
import { EffectComposer } from "three/addons/postprocessing/EffectComposer.js";
|
|
549
|
+
```
|
|
550
|
+
|
|
551
|
+
### WebGPU Renderer (Alternative)
|
|
552
|
+
|
|
553
|
+
Three.js r183 includes a WebGPU renderer as an alternative to WebGL:
|
|
554
|
+
|
|
555
|
+
```javascript
|
|
556
|
+
import { WebGPURenderer } from "three/addons/renderers/webgpu/WebGPURenderer.js";
|
|
557
|
+
|
|
558
|
+
const renderer = new WebGPURenderer({ antialias: true });
|
|
559
|
+
await renderer.init();
|
|
560
|
+
renderer.setSize(window.innerWidth, window.innerHeight);
|
|
515
561
|
```
|
|
516
562
|
|
|
517
|
-
|
|
563
|
+
WebGPU uses TSL (Three.js Shading Language) instead of GLSL for custom shaders. See `threejs-shaders` for details.
|
|
518
564
|
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
565
|
+
### Timer (r183 Recommended)
|
|
566
|
+
|
|
567
|
+
`THREE.Timer` is recommended over `THREE.Clock` as of r183:
|
|
568
|
+
|
|
569
|
+
```javascript
|
|
570
|
+
const timer = new THREE.Timer();
|
|
571
|
+
|
|
572
|
+
renderer.setAnimationLoop(() => {
|
|
573
|
+
timer.update();
|
|
574
|
+
const delta = timer.getDelta();
|
|
575
|
+
const elapsed = timer.getElapsed();
|
|
576
|
+
|
|
577
|
+
mesh.rotation.y += delta;
|
|
578
|
+
renderer.render(scene, camera);
|
|
579
|
+
});
|
|
580
|
+
```
|
|
581
|
+
|
|
582
|
+
**Benefits over Clock:**
|
|
583
|
+
|
|
584
|
+
- Not affected by page visibility (pauses when tab is hidden)
|
|
585
|
+
- Cleaner API design
|
|
586
|
+
- Better integration with `setAnimationLoop`
|
|
523
587
|
|
|
524
588
|
### Animation Libraries (GSAP Integration)
|
|
525
589
|
|
|
@@ -625,7 +689,7 @@ loader.load("model.gltf", (gltf) => {
|
|
|
625
689
|
|
|
626
690
|
### When to Use What
|
|
627
691
|
|
|
628
|
-
**
|
|
692
|
+
**Import Map Approach:**
|
|
629
693
|
|
|
630
694
|
- Quick prototypes and demos
|
|
631
695
|
- Educational content
|
|
@@ -636,19 +700,16 @@ loader.load("model.gltf", (gltf) => {
|
|
|
636
700
|
|
|
637
701
|
- Client projects and portfolios
|
|
638
702
|
- Complex applications
|
|
639
|
-
- Need latest features (r150+)
|
|
640
703
|
- Performance-critical applications
|
|
641
704
|
- Team collaboration with version control
|
|
642
705
|
|
|
643
706
|
### Recommended Production Stack
|
|
644
707
|
|
|
645
708
|
```
|
|
646
|
-
Three.js
|
|
709
|
+
Three.js r183 + Vite
|
|
647
710
|
├── GSAP (animations)
|
|
648
711
|
├── React Three Fiber (optional - React integration)
|
|
649
712
|
├── Drei (helper components)
|
|
650
713
|
├── Leva (debug GUI)
|
|
651
714
|
└── Post-processing effects
|
|
652
715
|
```
|
|
653
|
-
|
|
654
|
-
This skill provides CDN-compatible foundations. In production, you'd layer on these modern tools for professional results.
|
|
@@ -623,6 +623,14 @@ const isMobile = /iPhone|iPad|Android/i.test(navigator.userAgent);
|
|
|
623
623
|
const textureSize = isMobile ? 1024 : 2048;
|
|
624
624
|
```
|
|
625
625
|
|
|
626
|
+
## KTX2Loader BC3 Alpha Fix (r183)
|
|
627
|
+
|
|
628
|
+
As of r183, `KTX2Loader` correctly handles BC3 compressed textures with alpha channels, fixing previously incorrect alpha rendering.
|
|
629
|
+
|
|
630
|
+
## ISO 21496-1 Gainmap Metadata (r183)
|
|
631
|
+
|
|
632
|
+
Three.js r183 supports ISO 21496-1 gainmap metadata in HDR textures, enabling proper tone mapping of gainmap-based HDR images (such as those produced by recent smartphone cameras).
|
|
633
|
+
|
|
626
634
|
## See Also
|
|
627
635
|
|
|
628
636
|
- `threejs-materials` - Applying textures to materials
|
package/package.json
CHANGED