@leejungkiin/awkit 1.7.6 → 1.7.7
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 +44 -23
- package/bin/codex-generators.js +32 -3
- package/core/GEMINI.md +10 -5
- package/core/GEMINI.md.bak +2 -2
- package/package.json +1 -1
- package/scripts/exec-progress.js +116 -0
- package/skills/generate-gui-assets/SKILL.md +5 -5
- package/skills/hatch-pet/SKILL.md +2 -2
- package/skills/threejs-animation/SKILL.md +86 -0
- package/skills/threejs-animation/examples/workflow-mixer-action.md +20 -0
- package/skills/threejs-animation/references/official-sections.md +19 -0
- package/skills/threejs-audio/SKILL.md +112 -0
- package/skills/threejs-audio/examples/workflow-positional-audio.md +15 -0
- package/skills/threejs-audio/references/official-sections.md +16 -0
- package/skills/threejs-camera/SKILL.md +96 -0
- package/skills/threejs-camera/examples/workflow-perspective-resize.md +13 -0
- package/skills/threejs-controls/SKILL.md +101 -0
- package/skills/threejs-controls/examples/workflow-orbit-damping.md +15 -0
- package/skills/threejs-dev-setup/SKILL.md +102 -0
- package/skills/threejs-dev-setup/examples/workflow-scaffold.md +24 -0
- package/skills/threejs-geometries/SKILL.md +108 -0
- package/skills/threejs-geometries/examples/workflow-extrude-shape.md +13 -0
- package/skills/threejs-helpers/SKILL.md +103 -0
- package/skills/threejs-helpers/examples/workflow-light-camera-helpers.md +13 -0
- package/skills/threejs-lights/SKILL.md +103 -0
- package/skills/threejs-lights/examples/workflow-directional-shadow.md +17 -0
- package/skills/threejs-loaders/SKILL.md +89 -0
- package/skills/threejs-loaders/examples/workflow-gltf-draco.md +22 -0
- package/skills/threejs-loaders/references/official-sections.md +27 -0
- package/skills/threejs-materials/SKILL.md +102 -0
- package/skills/threejs-materials/examples/workflow-pbr-transparent.md +15 -0
- package/skills/threejs-math/SKILL.md +102 -0
- package/skills/threejs-math/examples/workflow-ray-aabb.md +11 -0
- package/skills/threejs-node-tsl/SKILL.md +83 -0
- package/skills/threejs-node-tsl/examples/workflow-tsl-entry.md +13 -0
- package/skills/threejs-node-tsl/references/official-links.md +8 -0
- package/skills/threejs-node-tsl/references/tsl-vs-classic.md +23 -0
- package/skills/threejs-objects/SKILL.md +111 -0
- package/skills/threejs-objects/examples/workflow-raycaster-pick.md +17 -0
- package/skills/threejs-postprocessing/SKILL.md +116 -0
- package/skills/threejs-postprocessing/examples/workflow-composer-bloom.md +15 -0
- package/skills/threejs-renderers/SKILL.md +91 -0
- package/skills/threejs-renderers/examples/workflow-renderer-resize.md +21 -0
- package/skills/threejs-renderers/references/official-sections.md +14 -0
- package/skills/threejs-scenes/SKILL.md +90 -0
- package/skills/threejs-scenes/examples/workflow-fog-background.md +13 -0
- package/skills/threejs-textures/SKILL.md +83 -0
- package/skills/threejs-textures/examples/workflow-pmrem-env.md +19 -0
- package/skills/threejs-webxr/SKILL.md +104 -0
- package/skills/threejs-webxr/examples/workflow-xr-button.md +15 -0
- package/workflows/_uncategorized/goal.md +86 -0
- package/workflows/ui/generate-gui-assets.md +111 -0
- package/workflows/ui/hatch-pet.md +116 -0
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: threejs-node-tsl
|
|
3
|
+
description: "three.js node-based shading: Nodes API surface, NodeMaterial and MeshStandardNodeMaterial-style families, TSL (Three.js Shading Language) entry at TSL.html, WebGPURenderer pairing, and core PostProcessing (class) versus addon EffectComposer at a high level. Use when authoring shaders as graphs, using TSL builtins, compute-oriented nodes, or modern WebGPU pipelines; for classic ShaderMaterial GLSL use threejs-materials; for stock EffectComposer passes use threejs-postprocessing; for WebGLRenderer-only tuning use threejs-renderers."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
## When to use this skill
|
|
7
|
+
|
|
8
|
+
**ALWAYS use this skill when the user mentions:**
|
|
9
|
+
|
|
10
|
+
- `NodeMaterial`, `TSL`, imports from `three/nodes` or WebGPU entry points in docs
|
|
11
|
+
- Building materials or post effects from nodes instead of string GLSL
|
|
12
|
+
- `WebGPURenderer`, `PostProcessing` (core class) in a node-centric pipeline
|
|
13
|
+
|
|
14
|
+
**IMPORTANT: node-tsl vs materials vs postprocessing**
|
|
15
|
+
|
|
16
|
+
| Situation | Skill |
|
|
17
|
+
|-----------|--------|
|
|
18
|
+
| Standard PBR tuning, no nodes | **threejs-materials** |
|
|
19
|
+
| TSL graph, NodeMaterial, WGSL path | **threejs-node-tsl** |
|
|
20
|
+
| Classic `EffectComposer` + Pass classes | **threejs-postprocessing** |
|
|
21
|
+
| Node post passes listed under Addons TSL in docs | **threejs-node-tsl** + **threejs-postprocessing** awareness |
|
|
22
|
+
|
|
23
|
+
**Trigger phrases include:**
|
|
24
|
+
|
|
25
|
+
- "TSL", "NodeMaterial", "three/nodes", "WebGPU", "node builder"
|
|
26
|
+
- "节点材质", "着色语言 TSL"
|
|
27
|
+
|
|
28
|
+
## How to use this skill
|
|
29
|
+
|
|
30
|
+
1. **Decide path**: WebGPU + nodes vs WebGL + classic materials—do not hybridize blindly.
|
|
31
|
+
2. **Anchor docs**: start from [Nodes index](https://threejs.org/docs/#Nodes) and [TSL.html](https://threejs.org/docs/TSL.html); use [NodeMaterial](https://threejs.org/docs/NodeMaterial.html) for material entry.
|
|
32
|
+
3. **Progressive disclosure**: keep SKILL.md navigational; long symbol lists live in [references/official-links.md](references/official-links.md) and [references/tsl-vs-classic.md](references/tsl-vs-classic.md); see [examples/workflow-tsl-entry.md](examples/workflow-tsl-entry.md) for navigation habits.
|
|
33
|
+
4. **Renderer**: enable `WebGPURenderer` per docs; fall back notes belong in **threejs-renderers**.
|
|
34
|
+
5. **Debugging**: use version-stamped examples in three.js repo; avoid copying deprecated import paths.
|
|
35
|
+
6. **Post stack**: if user names `PostProcessing` core class vs addon composer, clarify table in **threejs-renderers** / **threejs-postprocessing**.
|
|
36
|
+
|
|
37
|
+
## Doc map (official)
|
|
38
|
+
|
|
39
|
+
| Docs section | Representative links |
|
|
40
|
+
|--------------|----------------------|
|
|
41
|
+
| Nodes | https://threejs.org/docs/#Nodes |
|
|
42
|
+
| TSL | https://threejs.org/docs/TSL.html |
|
|
43
|
+
| NodeMaterial | https://threejs.org/docs/NodeMaterial.html |
|
|
44
|
+
| WebGPU renderer | https://threejs.org/docs/WebGPURenderer.html |
|
|
45
|
+
|
|
46
|
+
## Scope
|
|
47
|
+
|
|
48
|
+
- **In scope:** Nodes/TSL discovery, architecture, renderer pairing, where to look next, migration hints from ShaderMaterial.
|
|
49
|
+
- **Out of scope:** Pasting entire TSL symbol tables into SKILL.md; guaranteeing API stability across rapid releases—always cite "current docs".
|
|
50
|
+
|
|
51
|
+
## Common pitfalls and best practices
|
|
52
|
+
|
|
53
|
+
- Three.js node APIs evolve quickly—tie answers to a **version** or "current docs".
|
|
54
|
+
- Do not confuse **core** `PostProcessing` class with **addons** `EffectComposer`—names collide in conversation.
|
|
55
|
+
- WGSL vs GLSL expectations differ; TSL abstracts but limits still apply.
|
|
56
|
+
- Keep graphs modular; use references for lookup instead of bloating agent context.
|
|
57
|
+
|
|
58
|
+
## Documentation and version
|
|
59
|
+
|
|
60
|
+
The [Nodes](https://threejs.org/docs/#Nodes) index and [TSL](https://threejs.org/docs/TSL.html) page are large and **fast-moving**. Treat https://threejs.org/docs/ as the source of truth for the user’s installed three.js; prefer linking [NodeMaterial](https://threejs.org/docs/NodeMaterial.html) and [WebGPURenderer](https://threejs.org/docs/WebGPURenderer.html) over paraphrasing long symbol lists.
|
|
61
|
+
|
|
62
|
+
## Agent response checklist
|
|
63
|
+
|
|
64
|
+
When answering under this skill, prefer responses that:
|
|
65
|
+
|
|
66
|
+
1. Anchor on [TSL.html](https://threejs.org/docs/TSL.html) and/or `#Nodes` rather than inventing API names.
|
|
67
|
+
2. Contrast **threejs-materials** (classic) vs node/TSL path explicitly.
|
|
68
|
+
3. Warn that WebGPU + nodes examples may require recent minors—cite version when known.
|
|
69
|
+
4. Point to [references/tsl-vs-classic.md](references/tsl-vs-classic.md) and [references/official-links.md](references/official-links.md) for long lookups.
|
|
70
|
+
5. Disambiguate core `PostProcessing` vs addon `EffectComposer` (**threejs-postprocessing**).
|
|
71
|
+
|
|
72
|
+
## References
|
|
73
|
+
|
|
74
|
+
- https://threejs.org/docs/#Nodes
|
|
75
|
+
- https://threejs.org/docs/TSL.html
|
|
76
|
+
- https://threejs.org/docs/NodeMaterial.html
|
|
77
|
+
- https://threejs.org/docs/WebGPURenderer.html
|
|
78
|
+
|
|
79
|
+
## Keywords
|
|
80
|
+
|
|
81
|
+
**English:** tsl, node material, nodes, webgpu, wgsl, three.js shading language, node builder, nodematerial
|
|
82
|
+
|
|
83
|
+
**中文:** TSL、节点材质、WebGPU、着色语言、NodeMaterial、three.js
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Workflow: finding the right TSL entry
|
|
2
|
+
|
|
3
|
+
## Steps
|
|
4
|
+
|
|
5
|
+
1. Open https://threejs.org/docs/TSL.html and locate the function or node category matching the effect (lighting, texture, math).
|
|
6
|
+
|
|
7
|
+
2. Cross-check [Nodes](https://threejs.org/docs/#Nodes) for class-style nodes if TSL links to underlying node types.
|
|
8
|
+
|
|
9
|
+
3. Pair with `WebGPURenderer` setup from **threejs-renderers**.
|
|
10
|
+
|
|
11
|
+
4. For post effects expressed as nodes, compare with addon `EffectComposer` path in **threejs-postprocessing** and pick one pipeline per project.
|
|
12
|
+
|
|
13
|
+
Do not duplicate upstream example code here—link to the official example filename instead.
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# Official entry points (Nodes / TSL)
|
|
2
|
+
|
|
3
|
+
Use these pages as the source of truth; the Nodes catalog is large—link out instead of duplicating.
|
|
4
|
+
|
|
5
|
+
- https://threejs.org/docs/#Nodes
|
|
6
|
+
- https://threejs.org/docs/TSL.html
|
|
7
|
+
- https://threejs.org/docs/NodeMaterial.html
|
|
8
|
+
- https://threejs.org/docs/Node.html
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# TSL / NodeMaterial vs classic materials
|
|
2
|
+
|
|
3
|
+
## When to prefer classic (`threejs-materials`)
|
|
4
|
+
|
|
5
|
+
- You need widely documented PBR with `MeshStandardMaterial` / `MeshPhysicalMaterial`.
|
|
6
|
+
- Target is WebGL-only deployments without WebGPU.
|
|
7
|
+
- Team maintains GLSL `ShaderMaterial` with known light setups.
|
|
8
|
+
|
|
9
|
+
## When to prefer TSL / Node path (`threejs-node-tsl`)
|
|
10
|
+
|
|
11
|
+
- You adopt `WebGPURenderer` and node-based materials in examples.
|
|
12
|
+
- You want composable shader pieces without huge GLSL strings.
|
|
13
|
+
- You follow new three.js examples that import from node/TSL modules.
|
|
14
|
+
|
|
15
|
+
## Migration sanity
|
|
16
|
+
|
|
17
|
+
- Rebuild lighting model expectations: not every classic knob maps 1:1 on day one.
|
|
18
|
+
- Keep references to official migration notes in the three.js repository for your version.
|
|
19
|
+
|
|
20
|
+
## Links
|
|
21
|
+
|
|
22
|
+
- https://threejs.org/docs/TSL.html
|
|
23
|
+
- https://threejs.org/docs/ShaderMaterial.html
|
|
@@ -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.
|