@leejungkiin/awkit 1.5.5 → 1.5.6
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/bin/awk.js +188 -8
- package/core/GEMINI.md +15 -7
- package/core/work-modes.json +45 -0
- package/package.json +1 -1
- package/skill-packs/cocos2d/pack.json +8 -0
- package/skill-packs/cocos2d/skills/cocos2d-x/LICENSE.txt +8 -0
- package/skill-packs/cocos2d/skills/cocos2d-x/SKILL.md +168 -0
- package/skill-packs/cocos2d/skills/cocos2d-x/examples/core/action.md +278 -0
- package/skill-packs/cocos2d/skills/cocos2d-x/examples/core/animation.md +220 -0
- package/skill-packs/cocos2d/skills/cocos2d-x/examples/core/event.md +133 -0
- package/skill-packs/cocos2d/skills/cocos2d-x/examples/core/input.md +291 -0
- package/skill-packs/cocos2d/skills/cocos2d-x/examples/core/label.md +184 -0
- package/skill-packs/cocos2d/skills/cocos2d-x/examples/core/node-scene.md +212 -0
- package/skill-packs/cocos2d/skills/cocos2d-x/examples/core/scene.md +228 -0
- package/skill-packs/cocos2d/skills/cocos2d-x/examples/core/sprite.md +206 -0
- package/skill-packs/cocos2d/skills/cocos2d-x/examples/core/texture.md +186 -0
- package/skill-packs/cocos2d/skills/cocos2d-x/examples/getting-started/about-engine.md +53 -0
- package/skill-packs/cocos2d/skills/cocos2d-x/examples/getting-started/installation.md +203 -0
- package/skill-packs/cocos2d/skills/cocos2d-x/examples/getting-started/quick-start.md +134 -0
- package/skill-packs/electron/pack.json +9 -0
- package/skill-packs/electron/skills/electron/LICENSE.txt +202 -0
- package/skill-packs/electron/skills/electron/SKILL.md +160 -0
- package/skill-packs/electron/skills/electron/api/app.md +83 -0
- package/skill-packs/electron/skills/electron/api/browser-window.md +84 -0
- package/skill-packs/electron/skills/electron/examples/advanced/packaging.md +140 -0
- package/skill-packs/electron/skills/electron/examples/api/browser-window.md +182 -0
- package/skill-packs/electron/skills/electron/examples/api/menu.md +187 -0
- package/skill-packs/electron/skills/electron/examples/getting-started/installation.md +88 -0
- package/skill-packs/electron/skills/electron/examples/getting-started/quick-start.md +104 -0
- package/skill-packs/electron/skills/electron/examples/processes/ipc-communication.md +140 -0
- package/skill-packs/electron/skills/electron/examples/processes/main-process.md +121 -0
- package/skill-packs/electron/skills/electron/templates/main-process.md +105 -0
- package/skill-packs/electron/skills/electron/templates/preload-script.md +84 -0
- package/skill-packs/electron/skills/electron-egg/LICENSE.txt +202 -0
- package/skill-packs/electron/skills/electron-egg/SKILL.md +154 -0
- package/skill-packs/electron/skills/electron-egg/api/config-api.md +62 -0
- package/skill-packs/electron/skills/electron-egg/api/ipc-api.md +55 -0
- package/skill-packs/electron/skills/electron-egg/api/main-api.md +54 -0
- package/skill-packs/electron/skills/electron-egg/api/renderer-api.md +62 -0
- package/skill-packs/electron/skills/electron-egg/api/window-api.md +64 -0
- package/skill-packs/electron/skills/electron-egg/examples/features/ipc-communication.md +84 -0
- package/skill-packs/electron/skills/electron-egg/examples/features/main-process.md +89 -0
- package/skill-packs/electron/skills/electron-egg/examples/features/renderer-process.md +74 -0
- package/skill-packs/electron/skills/electron-egg/examples/guide/build.md +77 -0
- package/skill-packs/electron/skills/electron-egg/examples/guide/configuration.md +88 -0
- package/skill-packs/electron/skills/electron-egg/examples/guide/installation.md +66 -0
- package/skill-packs/electron/skills/electron-egg/examples/guide/intro.md +47 -0
- package/skill-packs/electron/skills/electron-egg/examples/guide/project-structure.md +73 -0
- package/skill-packs/electron/skills/electron-egg/examples/guide/quick-start.md +78 -0
- package/skill-packs/electron/skills/electron-egg/templates/configuration.md +63 -0
- package/skill-packs/electron/skills/electron-egg/templates/installation.md +42 -0
- package/skill-packs/electron/skills/electron-egg/templates/project-setup.md +75 -0
- package/skill-packs/flutter/pack.json +9 -0
- package/skill-packs/flutter/skills/flutter/LICENSE.txt +202 -0
- package/skill-packs/flutter/skills/flutter/SKILL.md +127 -0
- package/skill-packs/flutter/skills/flutter-project-creater/LICENSE.txt +202 -0
- package/skill-packs/flutter/skills/flutter-project-creater/SKILL.md +106 -0
- package/skill-packs/threejs/pack.json +25 -0
- package/skill-packs/threejs/skills/README.md +95 -0
- package/skill-packs/threejs/skills/threejs-animation/SKILL.md +86 -0
- package/skill-packs/threejs/skills/threejs-animation/examples/workflow-mixer-action.md +20 -0
- package/skill-packs/threejs/skills/threejs-animation/references/official-sections.md +19 -0
- package/skill-packs/threejs/skills/threejs-audio/SKILL.md +112 -0
- package/skill-packs/threejs/skills/threejs-audio/examples/workflow-positional-audio.md +15 -0
- package/skill-packs/threejs/skills/threejs-audio/references/official-sections.md +16 -0
- package/skill-packs/threejs/skills/threejs-camera/SKILL.md +96 -0
- package/skill-packs/threejs/skills/threejs-camera/examples/workflow-perspective-resize.md +13 -0
- package/skill-packs/threejs/skills/threejs-controls/SKILL.md +101 -0
- package/skill-packs/threejs/skills/threejs-controls/examples/workflow-orbit-damping.md +15 -0
- package/skill-packs/threejs/skills/threejs-dev-setup/SKILL.md +102 -0
- package/skill-packs/threejs/skills/threejs-dev-setup/examples/workflow-scaffold.md +24 -0
- package/skill-packs/threejs/skills/threejs-geometries/SKILL.md +108 -0
- package/skill-packs/threejs/skills/threejs-geometries/examples/workflow-extrude-shape.md +13 -0
- package/skill-packs/threejs/skills/threejs-helpers/SKILL.md +103 -0
- package/skill-packs/threejs/skills/threejs-helpers/examples/workflow-light-camera-helpers.md +13 -0
- package/skill-packs/threejs/skills/threejs-lights/SKILL.md +103 -0
- package/skill-packs/threejs/skills/threejs-lights/examples/workflow-directional-shadow.md +17 -0
- package/skill-packs/threejs/skills/threejs-loaders/SKILL.md +89 -0
- package/skill-packs/threejs/skills/threejs-loaders/examples/workflow-gltf-draco.md +22 -0
- package/skill-packs/threejs/skills/threejs-loaders/references/official-sections.md +27 -0
- package/skill-packs/threejs/skills/threejs-materials/SKILL.md +102 -0
- package/skill-packs/threejs/skills/threejs-materials/examples/workflow-pbr-transparent.md +15 -0
- package/skill-packs/threejs/skills/threejs-math/SKILL.md +102 -0
- package/skill-packs/threejs/skills/threejs-math/examples/workflow-ray-aabb.md +11 -0
- package/skill-packs/threejs/skills/threejs-node-tsl/SKILL.md +83 -0
- package/skill-packs/threejs/skills/threejs-node-tsl/examples/workflow-tsl-entry.md +13 -0
- package/skill-packs/threejs/skills/threejs-node-tsl/references/official-links.md +8 -0
- package/skill-packs/threejs/skills/threejs-node-tsl/references/tsl-vs-classic.md +23 -0
- package/skill-packs/threejs/skills/threejs-objects/SKILL.md +111 -0
- package/skill-packs/threejs/skills/threejs-objects/examples/workflow-raycaster-pick.md +17 -0
- package/skill-packs/threejs/skills/threejs-postprocessing/SKILL.md +116 -0
- package/skill-packs/threejs/skills/threejs-postprocessing/examples/workflow-composer-bloom.md +15 -0
- package/skill-packs/threejs/skills/threejs-renderers/SKILL.md +91 -0
- package/skill-packs/threejs/skills/threejs-renderers/examples/workflow-renderer-resize.md +21 -0
- package/skill-packs/threejs/skills/threejs-renderers/references/official-sections.md +14 -0
- package/skill-packs/threejs/skills/threejs-scenes/SKILL.md +90 -0
- package/skill-packs/threejs/skills/threejs-scenes/examples/workflow-fog-background.md +13 -0
- package/skill-packs/threejs/skills/threejs-textures/SKILL.md +83 -0
- package/skill-packs/threejs/skills/threejs-textures/examples/workflow-pmrem-env.md +19 -0
- package/skill-packs/threejs/skills/threejs-webxr/SKILL.md +104 -0
- package/skill-packs/threejs/skills/threejs-webxr/examples/workflow-xr-button.md +15 -0
- package/skills/telegram-notify/SKILL.md +1 -0
- package/skills/trello-sync/SKILL.md +7 -0
- package/templates/project-identity/android.json +26 -1
- package/templates/project-identity/backend-nestjs.json +26 -1
- package/templates/project-identity/expo.json +26 -1
- package/templates/project-identity/ios.json +26 -1
- package/templates/project-identity/web-nextjs.json +26 -1
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: threejs-objects
|
|
3
|
+
description: "three.js scene graph objects: Object3D transforms and hierarchy, Group, Mesh, InstancedMesh, SkinnedMesh, BatchedMesh, LOD, Line/LineLoop/LineSegments, Points, Sprite, Bone, Skeleton, ClippingGroup; interaction via Raycaster, Layers masks, and EventDispatcher patterns. Use when building scene hierarchies, picking objects with Raycaster, or configuring instanced/skinned meshes; for pure vector math use threejs-math; for skeletal clips use threejs-animation."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
## When to use this skill
|
|
7
|
+
|
|
8
|
+
**ALWAYS use this skill when the user mentions:**
|
|
9
|
+
|
|
10
|
+
- Parent/child relationships, `position/rotation/scale`, `matrixAutoUpdate`, `updateMatrixWorld`
|
|
11
|
+
- Choosing mesh types: static vs instanced vs skinned vs batched LOD
|
|
12
|
+
- **Picking**: `Raycaster.setFromCamera`, `intersectObjects`, recursive flag, face/uv results
|
|
13
|
+
- **Layers**: selective visibility for cameras/lights/objects
|
|
14
|
+
|
|
15
|
+
**IMPORTANT: objects vs math**
|
|
16
|
+
|
|
17
|
+
| Need | Skill |
|
|
18
|
+
|------|--------|
|
|
19
|
+
| Scene graph + picking | **threejs-objects** |
|
|
20
|
+
| Box/ray math only | **threejs-math** |
|
|
21
|
+
|
|
22
|
+
**Trigger phrases include:**
|
|
23
|
+
|
|
24
|
+
- "Object3D", "InstancedMesh", "SkinnedMesh", "Raycaster", "layers"
|
|
25
|
+
- "父子节点", "射线拾取", "图层"
|
|
26
|
+
|
|
27
|
+
## How to use this skill
|
|
28
|
+
|
|
29
|
+
1. **Compose** scenes with `Group` and transforms; minimize deep hierarchies where possible.
|
|
30
|
+
2. **Instancing** — set per-instance matrices; understand `count` and frustum culling behavior.
|
|
31
|
+
3. **SkinnedMesh** — bind skeleton; clips in **threejs-animation**; skinning material flags in **threejs-materials**.
|
|
32
|
+
4. **Picking** — normalize device coords, set ray from camera, filter by layers, validate intersections are sorted by distance before processing.
|
|
33
|
+
5. **Events** — `EventDispatcher` on custom objects; patterns only, not DOM frameworks.
|
|
34
|
+
6. **Clipping** — `ClippingGroup` usage per docs when user needs sectional cuts.
|
|
35
|
+
7. **Dispose** — call `dispose()` on geometries/materials/textures when removing objects permanently.
|
|
36
|
+
|
|
37
|
+
### Example: Raycaster picking with validation
|
|
38
|
+
|
|
39
|
+
```javascript
|
|
40
|
+
import * as THREE from 'three';
|
|
41
|
+
|
|
42
|
+
const raycaster = new THREE.Raycaster();
|
|
43
|
+
const pointer = new THREE.Vector2();
|
|
44
|
+
|
|
45
|
+
function onPointerMove(event) {
|
|
46
|
+
// Normalize device coordinates (-1 to +1)
|
|
47
|
+
pointer.x = (event.clientX / window.innerWidth) * 2 - 1;
|
|
48
|
+
pointer.y = -(event.clientY / window.innerHeight) * 2 + 1;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function pick(camera, scene) {
|
|
52
|
+
raycaster.setFromCamera(pointer, camera);
|
|
53
|
+
const intersections = raycaster.intersectObjects(scene.children, true);
|
|
54
|
+
|
|
55
|
+
// Validate: intersections are sorted by distance (nearest first)
|
|
56
|
+
if (intersections.length > 0) {
|
|
57
|
+
console.log('Nearest hit:', intersections[0].object.name,
|
|
58
|
+
'at distance:', intersections[0].distance);
|
|
59
|
+
}
|
|
60
|
+
return intersections;
|
|
61
|
+
}
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
See [examples/workflow-raycaster-pick.md](examples/workflow-raycaster-pick.md).
|
|
65
|
+
|
|
66
|
+
## Doc map (official)
|
|
67
|
+
|
|
68
|
+
| Docs section | Representative links |
|
|
69
|
+
|--------------|----------------------|
|
|
70
|
+
| Core | https://threejs.org/docs/Object3D.html |
|
|
71
|
+
| Objects | https://threejs.org/docs/Mesh.html |
|
|
72
|
+
| Objects | https://threejs.org/docs/InstancedMesh.html |
|
|
73
|
+
| Core | https://threejs.org/docs/Raycaster.html |
|
|
74
|
+
|
|
75
|
+
## Scope
|
|
76
|
+
|
|
77
|
+
- **In scope:** Object3D graph, renderable object types, raycasting, layers, dispatcher basics.
|
|
78
|
+
- **Out of scope:** Physics engines; XR input mapping (**threejs-webxr**).
|
|
79
|
+
|
|
80
|
+
## Common pitfalls and best practices
|
|
81
|
+
|
|
82
|
+
- Forgetting `updateMatrixWorld` before world-space ray tests on moved objects.
|
|
83
|
+
- Raycaster without `layers` set picks unintended objects—set masks consistently on camera and objects.
|
|
84
|
+
- InstancedMesh raycast hits need per-instance handling—check docs for your version.
|
|
85
|
+
|
|
86
|
+
## Documentation and version
|
|
87
|
+
|
|
88
|
+
`Object3D`, mesh types, `Raycaster`, and `Layers` are documented under [Objects](https://threejs.org/docs/#Objects) and [Core](https://threejs.org/docs/Raycaster.html) in [three.js docs](https://threejs.org/docs/). Behavior of picking and layers can shift slightly—link the exact page for the user’s three.js line.
|
|
89
|
+
|
|
90
|
+
## Agent response checklist
|
|
91
|
+
|
|
92
|
+
When answering under this skill, prefer responses that:
|
|
93
|
+
|
|
94
|
+
1. Link `Object3D`, `Mesh`, `InstancedMesh`, `Raycaster`, or `Layers` as needed.
|
|
95
|
+
2. Pair skeletal animation with **threejs-animation** and skinned mesh setup.
|
|
96
|
+
3. Route pure linear-algebra questions without a scene graph to **threejs-math**.
|
|
97
|
+
4. Route XR input to **threejs-webxr** when sessions/controllers are involved.
|
|
98
|
+
5. Mention `dispose()` for geometries/materials when removing objects permanently.
|
|
99
|
+
|
|
100
|
+
## References
|
|
101
|
+
|
|
102
|
+
- https://threejs.org/docs/Object3D.html
|
|
103
|
+
- https://threejs.org/docs/Raycaster.html
|
|
104
|
+
- https://threejs.org/docs/Layers.html
|
|
105
|
+
- https://threejs.org/docs/InstancedMesh.html
|
|
106
|
+
|
|
107
|
+
## Keywords
|
|
108
|
+
|
|
109
|
+
**English:** object3d, mesh, instancedmesh, skinnedmesh, raycaster, layers, scene graph, three.js
|
|
110
|
+
|
|
111
|
+
**中文:** 场景图、Object3D、Mesh、实例化、骨骼网格、射线拾取、图层、three.js
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Workflow: pick mesh with Raycaster
|
|
2
|
+
|
|
3
|
+
## Steps
|
|
4
|
+
|
|
5
|
+
1. `const raycaster = new THREE.Raycaster(); const pointer = new THREE.Vector2();`
|
|
6
|
+
|
|
7
|
+
2. On pointer event: `pointer.x = (x / width) * 2 - 1; pointer.y = -(y / height) * 2 + 1;`
|
|
8
|
+
|
|
9
|
+
3. `raycaster.setFromCamera(pointer, camera);`
|
|
10
|
+
|
|
11
|
+
4. `const hits = raycaster.intersectObjects(scene.children, true);` — tune recursive/layers.
|
|
12
|
+
|
|
13
|
+
5. Read `hits[0].object`, `face`, `uv`, `distance` per application.
|
|
14
|
+
|
|
15
|
+
6. Throttle on pointermove if needed for performance.
|
|
16
|
+
|
|
17
|
+
Details: https://threejs.org/docs/Raycaster.html
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: threejs-postprocessing
|
|
3
|
+
description: "Addon screen-space post-processing for three.js using EffectComposer, Pass base class, RenderPass, and stock passes such as UnrealBloomPass, SSAOPass, SSRPass, BokehPass, OutlinePass, FXAAPass/SMAAPass, TAARenderPass, and ShaderPass; references the Shaders addon group for underlying shader modules. Use when building composer chains for bloom, SSAO, or other screen-space effects; not for basic renderer tone mapping alone (threejs-renderers)."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
## When to use this skill
|
|
7
|
+
|
|
8
|
+
**ALWAYS use this skill when the user mentions:**
|
|
9
|
+
|
|
10
|
+
- `EffectComposer`, `RenderPass`, stacking passes, resize of composer
|
|
11
|
+
- Bloom, SSAO, SSR, DOF, outline, glitch, film grain, TAA—**addon** pass names
|
|
12
|
+
- `ShaderPass` with shader modules from Addons **Shaders** group
|
|
13
|
+
|
|
14
|
+
**IMPORTANT: postprocessing vs renderers vs node-tsl**
|
|
15
|
+
|
|
16
|
+
| Pipeline | Skill |
|
|
17
|
+
|----------|--------|
|
|
18
|
+
| Classic composer + passes | **threejs-postprocessing** |
|
|
19
|
+
| Renderer output color/tone only | **threejs-renderers** |
|
|
20
|
+
| Node/TSL post nodes | **threejs-node-tsl** |
|
|
21
|
+
|
|
22
|
+
**Trigger phrases include:**
|
|
23
|
+
|
|
24
|
+
- "EffectComposer", "RenderPass", "UnrealBloomPass", "SSAOPass", "后期"
|
|
25
|
+
- "泛光", "环境光遮蔽", "描边"
|
|
26
|
+
|
|
27
|
+
## How to use this skill
|
|
28
|
+
|
|
29
|
+
1. **Chain** — `RenderPass` → effect passes → output; ensure size matches renderer and DPR changes.
|
|
30
|
+
2. **Resize** — call `composer.setSize` alongside renderer resize workflows.
|
|
31
|
+
3. **Half-float** — many passes expect appropriate render target types; cite docs for your version.
|
|
32
|
+
4. **Performance** — each pass has cost; profile with `renderer.info` to check draw calls and triangles.
|
|
33
|
+
5. **Validate output** — render a simple test scene through the composer first to verify passes work before adding complexity.
|
|
34
|
+
6. **Shader modules** — link Addons **Shaders** list instead of inlining huge GLSL in SKILL.
|
|
35
|
+
7. **Output** — final pass should align color management with renderer (**threejs-renderers**).
|
|
36
|
+
8. **Contrast** — mention core `PostProcessing` class separately to avoid name collision confusion.
|
|
37
|
+
|
|
38
|
+
### Example: EffectComposer with bloom and debugging
|
|
39
|
+
|
|
40
|
+
```javascript
|
|
41
|
+
import * as THREE from 'three';
|
|
42
|
+
import { EffectComposer } from 'three/addons/postprocessing/EffectComposer.js';
|
|
43
|
+
import { RenderPass } from 'three/addons/postprocessing/RenderPass.js';
|
|
44
|
+
import { UnrealBloomPass } from 'three/addons/postprocessing/UnrealBloomPass.js';
|
|
45
|
+
|
|
46
|
+
const composer = new EffectComposer(renderer);
|
|
47
|
+
composer.addPass(new RenderPass(scene, camera));
|
|
48
|
+
|
|
49
|
+
const bloomPass = new UnrealBloomPass(
|
|
50
|
+
new THREE.Vector2(window.innerWidth, window.innerHeight),
|
|
51
|
+
1.5, // strength
|
|
52
|
+
0.4, // radius
|
|
53
|
+
0.85 // threshold
|
|
54
|
+
);
|
|
55
|
+
composer.addPass(bloomPass);
|
|
56
|
+
|
|
57
|
+
// Resize handler — must match renderer size
|
|
58
|
+
window.addEventListener('resize', () => {
|
|
59
|
+
renderer.setSize(window.innerWidth, window.innerHeight);
|
|
60
|
+
composer.setSize(window.innerWidth, window.innerHeight);
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
// Render loop: use composer.render() instead of renderer.render()
|
|
64
|
+
function animate() {
|
|
65
|
+
composer.render();
|
|
66
|
+
}
|
|
67
|
+
renderer.setAnimationLoop(animate);
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
See [examples/workflow-composer-bloom.md](examples/workflow-composer-bloom.md).
|
|
71
|
+
|
|
72
|
+
## Doc map (official)
|
|
73
|
+
|
|
74
|
+
| Docs section | Representative links |
|
|
75
|
+
|--------------|----------------------|
|
|
76
|
+
| Postprocessing | https://threejs.org/docs/EffectComposer.html |
|
|
77
|
+
| Postprocessing | https://threejs.org/docs/RenderPass.html |
|
|
78
|
+
| Postprocessing | https://threejs.org/docs/UnrealBloomPass.html |
|
|
79
|
+
| Shaders (addon modules) | https://threejs.org/docs/module-CopyShader.html |
|
|
80
|
+
|
|
81
|
+
## Scope
|
|
82
|
+
|
|
83
|
+
- **In scope:** Addon postprocessing passes and composer wiring; pointers to shader modules.
|
|
84
|
+
- **Out of scope:** Custom full-screen pipeline design outside three docs; engine-level frame graphs.
|
|
85
|
+
|
|
86
|
+
## Common pitfalls and best practices
|
|
87
|
+
|
|
88
|
+
- Forgetting composer resize produces smeared or low-res effects.
|
|
89
|
+
- Pass order matters—bloom often after main scene pass, outline may need masks.
|
|
90
|
+
- Some passes need depth—ensure depth buffer availability per pass docs.
|
|
91
|
+
|
|
92
|
+
## Documentation and version
|
|
93
|
+
|
|
94
|
+
Addon passes live under [Postprocessing](https://threejs.org/docs/#Postprocessing) and **Shaders** modules in [three.js docs](https://threejs.org/docs/). Pass constructors and required buffers change across versions—link the specific pass page (e.g. `UnrealBloomPass`) rather than guessing uniform names.
|
|
95
|
+
|
|
96
|
+
## Agent response checklist
|
|
97
|
+
|
|
98
|
+
When answering under this skill, prefer responses that:
|
|
99
|
+
|
|
100
|
+
1. Link `EffectComposer`, `RenderPass`, or the named pass (`SSAOPass`, …).
|
|
101
|
+
2. Contrast **addon** composer stack with core `PostProcessing` + **threejs-node-tsl** when users mix terms.
|
|
102
|
+
3. Require `setSize` on composer when **threejs-renderers** resizes.
|
|
103
|
+
4. Point to **Shaders** group for raw shader modules used by `ShaderPass`.
|
|
104
|
+
5. Warn about VR frame-time when stacking heavy passes (**threejs-webxr**).
|
|
105
|
+
|
|
106
|
+
## References
|
|
107
|
+
|
|
108
|
+
- https://threejs.org/docs/#Postprocessing
|
|
109
|
+
- https://threejs.org/docs/EffectComposer.html
|
|
110
|
+
- https://threejs.org/docs/RenderPass.html
|
|
111
|
+
|
|
112
|
+
## Keywords
|
|
113
|
+
|
|
114
|
+
**English:** effectcomposer, renderpass, bloom, ssao, ssr, outline, postprocessing, three.js
|
|
115
|
+
|
|
116
|
+
**中文:** 后期、EffectComposer、泛光、SSAO、SSR、屏幕空间、three.js
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Workflow: minimal composer with bloom
|
|
2
|
+
|
|
3
|
+
## Steps
|
|
4
|
+
|
|
5
|
+
1. Create `EffectComposer(renderer)`.
|
|
6
|
+
|
|
7
|
+
2. Add `RenderPass(scene, camera)`.
|
|
8
|
+
|
|
9
|
+
3. Add `UnrealBloomPass` with strength/radius/threshold per [UnrealBloomPass](https://threejs.org/docs/UnrealBloomPass.html).
|
|
10
|
+
|
|
11
|
+
4. In animation loop: `composer.render()` instead of `renderer.render` for the final path—or follow the exact pattern from current examples (some versions use `composer.render()` only).
|
|
12
|
+
|
|
13
|
+
5. On resize: `composer.setSize(width, height)`.
|
|
14
|
+
|
|
15
|
+
Verify against a known three.js example filename from the official repo for your version—API details shift between releases.
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: threejs-renderers
|
|
3
|
+
description: "Core rendering pipeline for three.js using WebGLRenderer and WebGPURenderer, canvas sizing, device pixel ratio, color space and tone mapping, output encoding, WebGL/WebGPU render targets, Info statistics, and addon overlay renderers (CSS2D/CSS3D/SVG). Use when tuning the draw loop, performance, or switching WebGPU vs WebGL; for EffectComposer passes use threejs-postprocessing; for XR session lifecycle use threejs-webxr; for shader graphs use threejs-node-tsl."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
## When to use this skill
|
|
7
|
+
|
|
8
|
+
**ALWAYS use this skill when the user mentions:**
|
|
9
|
+
|
|
10
|
+
- `WebGLRenderer` or `WebGPURenderer` creation, `setSize`, `setPixelRatio`, `setAnimationLoop`
|
|
11
|
+
- Color management: `outputColorSpace`, `toneMapping`, exposure-like behavior via renderer properties
|
|
12
|
+
- `WebGLRenderTarget`, `WebGLCubeRenderTarget`, MRT, readback, or render-to-texture setup at renderer level
|
|
13
|
+
- `Info` (`render`, `triangles`, `calls`) for profiling; `CanvasTarget` / storage textures when working from docs index
|
|
14
|
+
|
|
15
|
+
**IMPORTANT: this skill vs neighbors**
|
|
16
|
+
|
|
17
|
+
| Topic | Use skill |
|
|
18
|
+
|-------|-----------|
|
|
19
|
+
| Fullscreen passes, bloom, SSAO, composer chain | **threejs-postprocessing** |
|
|
20
|
+
| VR/AR session, `XRButton`, hand models | **threejs-webxr** |
|
|
21
|
+
| Node-based frame graph / TSL post stack | **threejs-node-tsl** + renderer enablement |
|
|
22
|
+
| Loading assets | **threejs-loaders** |
|
|
23
|
+
|
|
24
|
+
**Trigger phrases include:**
|
|
25
|
+
|
|
26
|
+
- "WebGLRenderer", "WebGPURenderer", "setPixelRatio", "toneMapping", "WebGLRenderTarget"
|
|
27
|
+
- "渲染器", "像素比", "色调映射", "离屏渲染"
|
|
28
|
+
|
|
29
|
+
## How to use this skill
|
|
30
|
+
|
|
31
|
+
1. **Choose API**: `WebGLRenderer` for widest compatibility; `WebGPURenderer` when targeting WebGPU and node/TSL stack per project rules.
|
|
32
|
+
2. **Size**: match drawing buffer to canvas CSS size × `devicePixelRatio` with a sane cap (performance).
|
|
33
|
+
3. **Color**: set `outputColorSpace` / `toneMapping` consistently with textures and materials (cross-link threejs-textures, threejs-materials).
|
|
34
|
+
4. **Loop**: prefer `setAnimationLoop` for WebXR-friendly loops; otherwise `requestAnimationFrame`.
|
|
35
|
+
5. **Render targets**: pick `WebGLRenderTarget` vs cube/3D/array variants per environment/reflection needs; document dispose when recreating.
|
|
36
|
+
6. **Overlay UI**: import `CSS2DRenderer` / `CSS3DRenderer` from addons; sync size with main renderer.
|
|
37
|
+
7. **Profiling**: read `renderer.info` in dev builds only; explain cost of high pixel ratio and overdraw.
|
|
38
|
+
8. **WebXR hook**: enable XR on renderer but delegate session to **threejs-webxr**.
|
|
39
|
+
|
|
40
|
+
See [examples/workflow-renderer-resize.md](examples/workflow-renderer-resize.md).
|
|
41
|
+
|
|
42
|
+
## Doc map (official)
|
|
43
|
+
|
|
44
|
+
| Docs section | Representative links |
|
|
45
|
+
|--------------|----------------------|
|
|
46
|
+
| Core Renderers | https://threejs.org/docs/WebGLRenderer.html |
|
|
47
|
+
| WebGPU | https://threejs.org/docs/WebGPURenderer.html |
|
|
48
|
+
| Render targets | https://threejs.org/docs/WebGLRenderTarget.html |
|
|
49
|
+
| Core PostProcessing (class) | https://threejs.org/docs/PostProcessing.html |
|
|
50
|
+
| Addons renderers | https://threejs.org/docs/CSS2DRenderer.html |
|
|
51
|
+
|
|
52
|
+
More class links: [references/official-sections.md](references/official-sections.md).
|
|
53
|
+
|
|
54
|
+
## Scope
|
|
55
|
+
|
|
56
|
+
- **In scope:** Renderer construction, sizing, color/tone, targets, Info, addon CSS/SVG renderers, high-level XR enable only.
|
|
57
|
+
- **Out of scope:** Individual composer passes (threejs-postprocessing); XR input (threejs-webxr); file IO (threejs-loaders).
|
|
58
|
+
|
|
59
|
+
## Common pitfalls and best practices
|
|
60
|
+
|
|
61
|
+
- Uncapped DPR burns fill rate; cap `setPixelRatio(Math.min(devicePixelRatio, 2))` on dense scenes.
|
|
62
|
+
- Mixing sRGB textures with wrong `outputColorSpace` causes washed or crushed blacks.
|
|
63
|
+
- Forgetting `dispose()` on render targets and full-screen quads leaks GPU memory on hot reload.
|
|
64
|
+
- `WebGPURenderer` feature set moves quickly—always cite current docs version note in answers.
|
|
65
|
+
|
|
66
|
+
## Documentation and version
|
|
67
|
+
|
|
68
|
+
`WebGLRenderer`, `WebGPURenderer`, and color-management defaults evolve across releases. Use the [Renderers](https://threejs.org/docs/#Renderers) section of [three.js docs](https://threejs.org/docs/) for the user’s three.js line; WebGPU and node stacks may require newer minors—link class pages rather than memorizing constructor defaults.
|
|
69
|
+
|
|
70
|
+
## Agent response checklist
|
|
71
|
+
|
|
72
|
+
When answering under this skill, prefer responses that:
|
|
73
|
+
|
|
74
|
+
1. Link official renderer or render-target pages (`WebGLRenderer`, `WebGLRenderTarget`, etc.).
|
|
75
|
+
2. Relate `outputColorSpace` / `toneMapping` to **threejs-textures** and **threejs-materials** when color looks wrong.
|
|
76
|
+
3. Point XR session details to **threejs-webxr** after `renderer.xr.enabled` is mentioned.
|
|
77
|
+
4. Mention `dispose()` for render targets and render lists on teardown or hot reload.
|
|
78
|
+
5. Cite **Addons → Renderers** (`CSS2DRenderer`, …) when overlays are in scope.
|
|
79
|
+
|
|
80
|
+
## References
|
|
81
|
+
|
|
82
|
+
- https://threejs.org/docs/WebGLRenderer.html
|
|
83
|
+
- https://threejs.org/docs/WebGPURenderer.html
|
|
84
|
+
- https://threejs.org/docs/#Renderers
|
|
85
|
+
- https://threejs.org/docs/Info.html
|
|
86
|
+
|
|
87
|
+
## Keywords
|
|
88
|
+
|
|
89
|
+
**English:** webglrenderer, webgpurenderer, rendertarget, pixelratio, tonemapping, outputcolorspace, css2d, css3d, three.js
|
|
90
|
+
|
|
91
|
+
**中文:** WebGLRenderer、WebGPU、渲染目标、像素比、色调映射、输出色彩空间、渲染器、three.js
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Workflow: responsive renderer and DPR cap
|
|
2
|
+
|
|
3
|
+
## Goal
|
|
4
|
+
|
|
5
|
+
Keep drawing buffer size in sync with the canvas element and limit device pixel ratio on high-DPI displays.
|
|
6
|
+
|
|
7
|
+
## Steps
|
|
8
|
+
|
|
9
|
+
1. Listen to `window` `resize` (or ResizeObserver on the canvas parent).
|
|
10
|
+
|
|
11
|
+
2. Read `clientWidth` / `clientHeight` of the element hosting the canvas.
|
|
12
|
+
|
|
13
|
+
3. Call `renderer.setSize(width, height, false)` when the third argument should match CSS pixels (typical for full-window).
|
|
14
|
+
|
|
15
|
+
4. Set `renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2))` (adjust cap per project).
|
|
16
|
+
|
|
17
|
+
5. If using composer or effects that depend on resolution, update passes after resize—see **threejs-postprocessing**.
|
|
18
|
+
|
|
19
|
+
6. Update projection `camera.aspect` for perspective cameras and `camera.updateProjectionMatrix()`.
|
|
20
|
+
|
|
21
|
+
This complements **threejs-camera**; do not duplicate XR projection here.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Renderer-related docs (non-exhaustive)
|
|
2
|
+
|
|
3
|
+
- https://threejs.org/docs/WebGLRenderer.html
|
|
4
|
+
- https://threejs.org/docs/WebGPURenderer.html
|
|
5
|
+
- https://threejs.org/docs/WebGLCubeRenderTarget.html
|
|
6
|
+
- https://threejs.org/docs/WebGL3DRenderTarget.html
|
|
7
|
+
- https://threejs.org/docs/Renderer.html
|
|
8
|
+
- https://threejs.org/docs/PostProcessing.html
|
|
9
|
+
- https://threejs.org/docs/CSS2DRenderer.html
|
|
10
|
+
- https://threejs.org/docs/CSS3DRenderer.html
|
|
11
|
+
- https://threejs.org/docs/SVGRenderer.html
|
|
12
|
+
- https://threejs.org/docs/WebXRManager.html
|
|
13
|
+
|
|
14
|
+
Use the live [docs index](https://threejs.org/docs/#Renderers) for additions in new three.js releases.
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: threejs-scenes
|
|
3
|
+
description: "three.js Scene graph root object, linear Fog and exponential FogExp2, Scene.background for solid colors or textures, and high-level environment background concepts that tie to PMREM and loaders in other skills. Use when configuring world container, atmospheric fog, or background; for HDR env map file loading use threejs-loaders; for GPU texture settings after load use threejs-textures; for tone mapping use threejs-renderers."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
## When to use this skill
|
|
7
|
+
|
|
8
|
+
**ALWAYS use this skill when the user mentions:**
|
|
9
|
+
|
|
10
|
+
- `Scene` as root, `scene.background`, environment or skyball setup at scene level
|
|
11
|
+
- `Fog` or `FogExp2` parameters (`near`, `far`, `color`, density) and interaction with camera far plane
|
|
12
|
+
- Organizing render lists conceptually (children of scene)
|
|
13
|
+
|
|
14
|
+
**IMPORTANT: scenes vs textures vs loaders**
|
|
15
|
+
|
|
16
|
+
| Concern | Skill |
|
|
17
|
+
|---------|--------|
|
|
18
|
+
| Scene + fog API | **threejs-scenes** |
|
|
19
|
+
| Texture sampling, PMREM generator usage | **threejs-textures** |
|
|
20
|
+
| Fetching HDR/glTF | **threejs-loaders** |
|
|
21
|
+
|
|
22
|
+
**Trigger phrases include:**
|
|
23
|
+
|
|
24
|
+
- "Scene", "Fog", "FogExp2", "background", "雾"
|
|
25
|
+
- "场景根节点", "线性雾", "指数雾"
|
|
26
|
+
|
|
27
|
+
## How to use this skill
|
|
28
|
+
|
|
29
|
+
1. Instantiate `Scene` and add lights/meshes/cameras as children per graph rules (**threejs-objects**).
|
|
30
|
+
2. Choose fog: linear `Fog` vs exponential `FogExp2` for outdoor/horizon feel.
|
|
31
|
+
3. Tune fog `near`/`far` alongside camera `far` to avoid clipping artifacts.
|
|
32
|
+
4. Set `scene.background` to `Color`, `Texture`, or cube map per docs; env lighting still needs matching renderer/material settings.
|
|
33
|
+
5. When user wants IBL from HDR file, point to loaders → textures → materials pipeline explicitly.
|
|
34
|
+
6. Document that fog does not replace frustum culling for performance.
|
|
35
|
+
|
|
36
|
+
### Example: Scene with fog and background
|
|
37
|
+
|
|
38
|
+
```javascript
|
|
39
|
+
import * as THREE from 'three';
|
|
40
|
+
|
|
41
|
+
const scene = new THREE.Scene();
|
|
42
|
+
scene.background = new THREE.Color(0xa0a0a0);
|
|
43
|
+
|
|
44
|
+
// Linear fog — match color with background to hide horizon seam
|
|
45
|
+
scene.fog = new THREE.Fog(0xa0a0a0, 10, 50);
|
|
46
|
+
|
|
47
|
+
// Ensure camera far plane covers fog range
|
|
48
|
+
camera.far = 60; // slightly beyond fog far
|
|
49
|
+
camera.updateProjectionMatrix();
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
See [examples/workflow-fog-background.md](examples/workflow-fog-background.md).
|
|
53
|
+
|
|
54
|
+
## Doc map (official)
|
|
55
|
+
|
|
56
|
+
| Docs section | Representative links |
|
|
57
|
+
|--------------|----------------------|
|
|
58
|
+
| Scenes | https://threejs.org/docs/Scene.html |
|
|
59
|
+
| Fog | https://threejs.org/docs/Fog.html |
|
|
60
|
+
| FogExp2 | https://threejs.org/docs/FogExp2.html |
|
|
61
|
+
|
|
62
|
+
## Scope
|
|
63
|
+
|
|
64
|
+
- **In scope:** `Scene`, fog types, background field semantics at API level.
|
|
65
|
+
- **Out of scope:** HDR / glTF file fetch (**threejs-loaders**); PMREM and texture sampling (**threejs-textures**); tone mapping / output color space defaults (**threejs-renderers**); full-screen fog-only post stack (**threejs-postprocessing**) unless tying to scene `Fog`; custom atmospheric scattering shaders beyond core fog API.
|
|
66
|
+
|
|
67
|
+
## Common pitfalls and best practices
|
|
68
|
+
|
|
69
|
+
- Fog color should harmonize with background to hide the horizon seam.
|
|
70
|
+
- Very large `far` on camera with fog still needs scene scale consistency.
|
|
71
|
+
- `background` rotation/intensity features depend on renderer version—cite current docs.
|
|
72
|
+
|
|
73
|
+
## Documentation and version
|
|
74
|
+
|
|
75
|
+
`Scene`, `Fog`, and background fields are documented under [Scenes](https://threejs.org/docs/#Scenes) in [three.js docs](https://threejs.org/docs/). Environment-related visuals often combine this skill with **threejs-textures** (PMREM) and **threejs-loaders** (HDR files) — link those pages when the user moves from “fog color” to “HDR sky”.
|
|
76
|
+
|
|
77
|
+
## Agent response checklist
|
|
78
|
+
|
|
79
|
+
When answering under this skill, prefer responses that:
|
|
80
|
+
|
|
81
|
+
1. Link `Scene`, `Fog`, or `FogExp2` official pages.
|
|
82
|
+
2. Relate fog distances to **threejs-camera** `far` plane and world scale.
|
|
83
|
+
3. Defer PMREM/HDR file steps to **threejs-textures** / **threejs-loaders** with one sentence each.
|
|
84
|
+
4. Avoid duplicating full color-management tutorials — point to renderer + textures skills.
|
|
85
|
+
|
|
86
|
+
## Keywords
|
|
87
|
+
|
|
88
|
+
**English:** scene, fog, fogexp2, background, environment, three.js
|
|
89
|
+
|
|
90
|
+
**中文:** 场景、雾、Fog、背景、环境、three.js
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Workflow: fog plus solid background
|
|
2
|
+
|
|
3
|
+
## Steps
|
|
4
|
+
|
|
5
|
+
1. `scene.background = new THREE.Color(0x87ceeb);`
|
|
6
|
+
|
|
7
|
+
2. `scene.fog = new THREE.Fog(0x87ceeb, near, far);` — adjust `near`/`far` relative to world units.
|
|
8
|
+
|
|
9
|
+
3. Keep `PerspectiveCamera.far` larger than fog `far` or tune both together.
|
|
10
|
+
|
|
11
|
+
4. Remove fog by setting `scene.fog = null`.
|
|
12
|
+
|
|
13
|
+
For textured HDR backgrounds, load env via **threejs-loaders** then assign textures per **threejs-textures** / PMREM flow.
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: threejs-textures
|
|
3
|
+
description: "three.js textures: Texture, DataTexture, CubeTexture, CompressedTexture variants, DepthTexture, VideoTexture, CanvasTexture, 3D/array textures, Source; sampling parameters, mipmaps, anisotropy, wrap/mag/min filters; PMREMGenerator in Extras for environment map prefiltering. Use when configuring GPU texture objects and PMREM; for Draco/KTX2 transcoder file paths use threejs-loaders; for material map slots use threejs-materials; for output color pipeline use threejs-renderers."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
## When to use this skill
|
|
7
|
+
|
|
8
|
+
**ALWAYS use this skill when the user mentions:**
|
|
9
|
+
|
|
10
|
+
- `texture.wrapS` / `wrapT`, `minFilter`, `magFilter`, `generateMipmaps`, `anisotropy`
|
|
11
|
+
- `colorSpace` / correct handling of sRGB vs linear data maps
|
|
12
|
+
- Creating `DataTexture`, `CubeTexture`, compressed GPU formats, video/canvas driven textures
|
|
13
|
+
- `PMREMGenerator` from environment maps for IBL
|
|
14
|
+
|
|
15
|
+
**IMPORTANT: textures vs loaders**
|
|
16
|
+
|
|
17
|
+
| Step | Skill |
|
|
18
|
+
|------|--------|
|
|
19
|
+
| Decode file / HTTP | **threejs-loaders** |
|
|
20
|
+
| Configure GPU `Texture` | **threejs-textures** |
|
|
21
|
+
|
|
22
|
+
**Trigger phrases include:**
|
|
23
|
+
|
|
24
|
+
- "Texture", "CubeTexture", "PMREM", "colorSpace", "mipmap", "各向异性"
|
|
25
|
+
- "环境贴图", "数据纹理", "压缩纹理"
|
|
26
|
+
|
|
27
|
+
## How to use this skill
|
|
28
|
+
|
|
29
|
+
1. **Classify** texture dimensionality and format (2D, cube, depth, compressed, data).
|
|
30
|
+
2. **Color pipeline**: set `colorSpace` appropriately; normal/roughness maps are non-color data.
|
|
31
|
+
3. **Sampling**: choose filters; enable mipmaps when minification occurs; consider max anisotropy.
|
|
32
|
+
4. **PMREM**: feed env map through `PMREMGenerator` per docs; assign result to scene/env/intensity paths as required.
|
|
33
|
+
5. **Video/canvas**: understand update needs each frame for `VideoTexture` / `CanvasTexture`.
|
|
34
|
+
6. **Disposal**: `dispose()` textures when replacing to free GPU memory.
|
|
35
|
+
7. **KTX2/Basis**: transcoder wiring belongs in **threejs-loaders** before this step.
|
|
36
|
+
|
|
37
|
+
See [examples/workflow-pmrem-env.md](examples/workflow-pmrem-env.md).
|
|
38
|
+
|
|
39
|
+
## Doc map (official)
|
|
40
|
+
|
|
41
|
+
| Docs section | Representative links |
|
|
42
|
+
|--------------|----------------------|
|
|
43
|
+
| Textures | https://threejs.org/docs/Texture.html |
|
|
44
|
+
| Cube | https://threejs.org/docs/CubeTexture.html |
|
|
45
|
+
| Data | https://threejs.org/docs/DataTexture.html |
|
|
46
|
+
| PMREM | https://threejs.org/docs/PMREMGenerator.html |
|
|
47
|
+
|
|
48
|
+
## Scope
|
|
49
|
+
|
|
50
|
+
- **In scope:** Core Textures + PMREMGenerator; sampling and color pipeline at texture level.
|
|
51
|
+
- **Out of scope:** Loader configuration; post-processing passes that sample buffers (threejs-postprocessing).
|
|
52
|
+
|
|
53
|
+
## Common pitfalls and best practices
|
|
54
|
+
|
|
55
|
+
- sRGB albedo in linear workflow without proper colorSpace looks wrong next to renderer output.
|
|
56
|
+
- Non-power-of-two textures have mip/wrap limitations unless padded.
|
|
57
|
+
- Forgetting texture disposal on hot reload leaks VRAM.
|
|
58
|
+
|
|
59
|
+
## Documentation and version
|
|
60
|
+
|
|
61
|
+
Texture classes and `PMREMGenerator` are documented under [Textures](https://threejs.org/docs/#Textures) and [PMREMGenerator](https://threejs.org/docs/PMREMGenerator.html) in [three.js docs](https://threejs.org/docs/). Compressed and KTX2 paths often depend on **threejs-loaders** for transcoder setup before this skill applies.
|
|
62
|
+
|
|
63
|
+
## Agent response checklist
|
|
64
|
+
|
|
65
|
+
When answering under this skill, prefer responses that:
|
|
66
|
+
|
|
67
|
+
1. Link `Texture`, `DataTexture`, `CubeTexture`, or `PMREMGenerator` as appropriate.
|
|
68
|
+
2. Tie `colorSpace` / filtering to **threejs-renderers** output and **threejs-materials** maps.
|
|
69
|
+
3. Send Draco/KTX2 **decoder wiring** questions to **threejs-loaders** first.
|
|
70
|
+
4. Emphasize `dispose()` when replacing env maps or large atlases.
|
|
71
|
+
5. Mention [Global](https://threejs.org/docs/#Global) constants only when wrapping/filter enums matter.
|
|
72
|
+
|
|
73
|
+
## References
|
|
74
|
+
|
|
75
|
+
- https://threejs.org/docs/#Textures
|
|
76
|
+
- https://threejs.org/docs/Texture.html
|
|
77
|
+
- https://threejs.org/docs/PMREMGenerator.html
|
|
78
|
+
|
|
79
|
+
## Keywords
|
|
80
|
+
|
|
81
|
+
**English:** texture, cubemap, pmrem, mipmap, colorspace, compressed texture, data texture, three.js
|
|
82
|
+
|
|
83
|
+
**中文:** 纹理、立方体贴图、PMREM、mipmap、色彩空间、压缩纹理、three.js
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Workflow: PMREM from an equirectangular texture
|
|
2
|
+
|
|
3
|
+
## Preconditions
|
|
4
|
+
|
|
5
|
+
- An equirectangular HDR or suitable env image is already a `Texture` (often via **threejs-loaders**).
|
|
6
|
+
|
|
7
|
+
## Steps
|
|
8
|
+
|
|
9
|
+
1. Create `PMREMGenerator(renderer)`.
|
|
10
|
+
|
|
11
|
+
2. `const envMap = pmremGenerator.fromEquirectangular(equirectTexture).texture;`
|
|
12
|
+
|
|
13
|
+
3. Assign to scene or materials per your lighting model; intensity via renderer or material properties (**threejs-materials**).
|
|
14
|
+
|
|
15
|
+
4. `pmremGenerator.dispose()` when done generating; dispose intermediate textures per docs.
|
|
16
|
+
|
|
17
|
+
5. Dispose `equirectTexture` if no longer needed.
|
|
18
|
+
|
|
19
|
+
Cross-check current [PMREMGenerator](https://threejs.org/docs/PMREMGenerator.html) for API variants (`fromScene`, etc.).
|