howone 0.1.36 → 0.1.39
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/templates/vite/.howone/skills/howone/SKILL.md +2 -1
- package/templates/vite/.howone/skills/web-shader-extractor/SKILL.md +123 -0
- package/templates/vite/.howone/skills/web-shader-extractor/references/capture-backends.md +201 -0
- package/templates/vite/.howone/skills/web-shader-extractor/references/evidence-policy.md +93 -0
- package/templates/vite/.howone/skills/web-shader-extractor/references/operating-contract.md +82 -0
- package/templates/vite/.howone/skills/web-shader-extractor/references/qa-failure-policy.md +100 -0
- package/templates/vite/.howone/skills/web-shader-extractor/references/recon-kernel.md +206 -0
- package/templates/vite/.howone/skills/web-shader-extractor/references/replay-policy.md +145 -0
- package/templates/vite/.howone/skills/web-shader-extractor/references/shaders-com.md +212 -0
- package/templates/vite/.howone/skills/web-shader-extractor/references/source-analysis.md +112 -0
- package/templates/vite/.howone/skills/web-shader-extractor/references/surface-discovery.md +113 -0
- package/templates/vite/.howone/skills/web-shader-extractor/references/target-lock.md +205 -0
- package/templates/vite/.howone/skills/web-shader-extractor/references/three-shader-reconstruction.md +155 -0
- package/templates/vite/.howone/skills/web-shader-extractor/references/tool-capability-matrix.md +57 -0
- package/templates/vite/.howone/skills/web-shader-extractor/references/unicorn-studio.md +387 -0
- package/templates/vite/.howone/skills/web-shader-extractor/scripts/fetch-rendered-dom.mjs +178 -0
- package/templates/vite/.howone/skills/web-shader-extractor/scripts/scan-bundle.sh +80 -0
- package/templates/vite/.howone/skills/web-shader-extractor/templates/extraction-report.md +41 -0
- package/templates/vite/.howone/skills/web-shader-extractor/templates/known-gaps.md +14 -0
- package/templates/vite/.howone/skills/web-shader-extractor/templates/qa-report.md +74 -0
- package/templates/vite/.howone/skills/web-shader-extractor/templates/replay-manifest.json +147 -0
- package/templates/vite/.howone/skills/web-shader-extractor/templates/run-state.json +75 -0
- package/templates/vite/.howone/skills/web-shader-extractor/templates/scout-card.json +106 -0
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
# Surface Discovery
|
|
2
|
+
|
|
3
|
+
Surface discovery has two jobs: inventory candidates, then prove causality between the requested visual and one or more rendering surfaces. Inventory alone never decides the target.
|
|
4
|
+
|
|
5
|
+
## Surfaces To Enumerate
|
|
6
|
+
|
|
7
|
+
- visible and hidden `canvas`
|
|
8
|
+
- canvases inside same-origin iframes; for cross-origin iframes, record frame bounds, screenshots, network/frame metadata, or tool-accessible observations without bypassing origin restrictions
|
|
9
|
+
- `OffscreenCanvas` transferred to workers
|
|
10
|
+
- WebGPU canvas contexts
|
|
11
|
+
- DOM masks, clip paths, sticky containers, SVG filters, videos, and images composited with canvas
|
|
12
|
+
- shared renderer canvases that persist across routes
|
|
13
|
+
|
|
14
|
+
## Candidate Record
|
|
15
|
+
|
|
16
|
+
Record each candidate as:
|
|
17
|
+
|
|
18
|
+
```json
|
|
19
|
+
{
|
|
20
|
+
"id": "surface-1",
|
|
21
|
+
"selector": "canvas#hero",
|
|
22
|
+
"frame": "main",
|
|
23
|
+
"bounds": { "x": 0, "y": 0, "width": 1440, "height": 900 },
|
|
24
|
+
"cssSize": { "width": 1440, "height": 900 },
|
|
25
|
+
"backingSize": { "width": 2880, "height": 1800 },
|
|
26
|
+
"dpr": 2,
|
|
27
|
+
"visibility": "visible",
|
|
28
|
+
"zIndex": "auto",
|
|
29
|
+
"context": "webgl2|webgl|webgpu|2d|bitmaprenderer|unknown",
|
|
30
|
+
"owner": "main-thread|iframe|worker|unknown",
|
|
31
|
+
"routePersistence": "single-route|persistent|unknown",
|
|
32
|
+
"notes": []
|
|
33
|
+
}
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Context Probes
|
|
37
|
+
|
|
38
|
+
Use non-destructive runtime evaluation first:
|
|
39
|
+
|
|
40
|
+
- inspect size, bounding rect, computed style, opacity, transform, pointer-events, z-index
|
|
41
|
+
- check known dataset hints such as `data-engine`, `data-renderer`, embed IDs
|
|
42
|
+
- detect existing contexts without creating unrelated new contexts when possible
|
|
43
|
+
- observe worker script URLs, `transferControlToOffscreen`, and WebGPU adapter/device calls if available
|
|
44
|
+
|
|
45
|
+
If context creation must be probed, label that as probe-induced evidence so it is not confused with the page's real context.
|
|
46
|
+
|
|
47
|
+
## Target Model
|
|
48
|
+
|
|
49
|
+
The target may be a surface group:
|
|
50
|
+
|
|
51
|
+
```text
|
|
52
|
+
canvas#background
|
|
53
|
+
+ canvas#particles
|
|
54
|
+
+ DOM mask
|
|
55
|
+
+ scroll progress
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Use `targetSet` in Scout Card and Manifest. Do not force the result into a single `targetCanvas`.
|
|
59
|
+
|
|
60
|
+
## Ranking And Attribution
|
|
61
|
+
|
|
62
|
+
Rank candidates for attribution by:
|
|
63
|
+
|
|
64
|
+
- overlap with the requested visual area
|
|
65
|
+
- frame-to-frame pixel change
|
|
66
|
+
- z-order and clipping relationship
|
|
67
|
+
- pointer/scroll/resize coupling
|
|
68
|
+
- route persistence
|
|
69
|
+
- owner traceability
|
|
70
|
+
|
|
71
|
+
Attribution scoring dimensions:
|
|
72
|
+
|
|
73
|
+
- `visualCoverage`: how much the surface overlaps the target visual region
|
|
74
|
+
- `temporalActivity`: how much the surface changes across sampled frames
|
|
75
|
+
- `interactionCoupling`: pointer, scroll, resize, or route changes affect the target
|
|
76
|
+
- `sectionCoupling`: relationship to page sections, sticky positioning, masks, and clips
|
|
77
|
+
- `routePersistence`: whether the surface persists across route changes
|
|
78
|
+
- `ablationImpact`: what target pixels/behaviors disappear when the surface is hidden or frozen
|
|
79
|
+
- `ownershipEvidence`: how well context and renderer owner can be traced
|
|
80
|
+
|
|
81
|
+
## Attribution Actions
|
|
82
|
+
|
|
83
|
+
Use the lowest-cost action that resolves the current unknown:
|
|
84
|
+
|
|
85
|
+
1. style, bounds, and visibility observation
|
|
86
|
+
2. multi-frame diff on a target crop
|
|
87
|
+
3. temporary `visibility:hidden`, opacity, transform, or clip ablation
|
|
88
|
+
4. freeze `requestAnimationFrame` or replace a candidate surface output
|
|
89
|
+
5. pointer sweep
|
|
90
|
+
6. small scroll
|
|
91
|
+
7. resize
|
|
92
|
+
8. route switch
|
|
93
|
+
9. owner stack or preload probe
|
|
94
|
+
|
|
95
|
+
All modifications are brief, reversible, and observational. Do not persist source-site changes.
|
|
96
|
+
|
|
97
|
+
## Evidence Examples
|
|
98
|
+
|
|
99
|
+
Strong attribution examples:
|
|
100
|
+
|
|
101
|
+
- target crop loses the distortion only when `surface-2` is hidden
|
|
102
|
+
- scroll progress changes uniforms on `surface-1` and the visual phase changes accordingly
|
|
103
|
+
- DOM mask plus canvas output together create the visible target; either alone is incomplete
|
|
104
|
+
- `OffscreenCanvas` worker owns the only context whose frame changes match the target crop
|
|
105
|
+
|
|
106
|
+
Weak attribution examples:
|
|
107
|
+
|
|
108
|
+
- candidate is the largest canvas
|
|
109
|
+
- candidate animates continuously
|
|
110
|
+
- candidate has a framework-looking dataset attribute
|
|
111
|
+
- bundle contains shader strings but no target binding exists
|
|
112
|
+
|
|
113
|
+
Area alone is weak evidence. A small overlay, mask, or DOM layer may be essential to the target effect.
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
# Target Lock
|
|
2
|
+
|
|
3
|
+
`TARGET_LOCKED` is an evidence gate.
|
|
4
|
+
After it passes, source tracing and capture can focus on one target surface group.
|
|
5
|
+
Use `attributed` when visual causality is proven but owner or source is still unresolved.
|
|
6
|
+
|
|
7
|
+
## Required Fields
|
|
8
|
+
|
|
9
|
+
`TARGET_ATTRIBUTED` means:
|
|
10
|
+
|
|
11
|
+
- the target surface or surface group is visually attributed
|
|
12
|
+
- ablation, frame comparison, interaction response, or equivalent evidence proves causality
|
|
13
|
+
- context, owner, framework, or source may still be incomplete
|
|
14
|
+
- only owner probes, backend probes, or narrow source probes tied to `nextProbe` are allowed
|
|
15
|
+
|
|
16
|
+
`TARGET_LOCKED` requires:
|
|
17
|
+
|
|
18
|
+
- target is a surface or surface group
|
|
19
|
+
- visual attribution evidence exists
|
|
20
|
+
- context type is known
|
|
21
|
+
- owner thread/frame/worker is known or reliably located
|
|
22
|
+
- framework, platform, runtime, or source clues are bound to the target
|
|
23
|
+
- effect boundary is classified
|
|
24
|
+
- exactly one primary trace route is selected
|
|
25
|
+
- alternatives and exclusion reasons are recorded
|
|
26
|
+
|
|
27
|
+
Do not set `lockStatus` to `locked` until these fields are present in `scout-card.json` with evidence paths.
|
|
28
|
+
Conversation text is not enough.
|
|
29
|
+
If owner/source is still unresolved but the visual target is proven, set `lockStatus` to `attributed`.
|
|
30
|
+
Make the next action an owner or backend probe.
|
|
31
|
+
|
|
32
|
+
## Scout Card v3
|
|
33
|
+
|
|
34
|
+
Write a small card before the full Manifest:
|
|
35
|
+
|
|
36
|
+
```json
|
|
37
|
+
{
|
|
38
|
+
"schemaVersion": 3,
|
|
39
|
+
"source": {
|
|
40
|
+
"url": "https://example.com/",
|
|
41
|
+
"route": "/",
|
|
42
|
+
"viewport": { "width": 1440, "height": 900, "dpr": 2 }
|
|
43
|
+
},
|
|
44
|
+
"candidates": [
|
|
45
|
+
{
|
|
46
|
+
"id": "surface-1",
|
|
47
|
+
"selector": "canvas#hero",
|
|
48
|
+
"frame": "main",
|
|
49
|
+
"context": "webgl2",
|
|
50
|
+
"owner": "unknown",
|
|
51
|
+
"visualCoverage": "high",
|
|
52
|
+
"temporalActivity": "high",
|
|
53
|
+
"ablationImpact": "major",
|
|
54
|
+
"evidence": ["evidence/scout/surface-1.json"]
|
|
55
|
+
}
|
|
56
|
+
],
|
|
57
|
+
"lockStatus": "provisional",
|
|
58
|
+
"targetSet": [],
|
|
59
|
+
"alternatives": [],
|
|
60
|
+
"effectBoundary": "surface-only|surface-plus-dom|page-coupled|route-coupled",
|
|
61
|
+
"frameworkHypotheses": [],
|
|
62
|
+
"platformHypotheses": [],
|
|
63
|
+
"interactions": [],
|
|
64
|
+
"scopeRisk": "low|medium|high",
|
|
65
|
+
"blockingUnknowns": [],
|
|
66
|
+
"nextProbe": {
|
|
67
|
+
"type": "surface-ablation|runtime-owner|platform-api|frame-capture|preload|source-map|bundle-slice",
|
|
68
|
+
"target": "surface-1",
|
|
69
|
+
"resolves": ["owner", "framework"]
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## Target-Bound Evidence
|
|
75
|
+
|
|
76
|
+
Weak evidence can form hypotheses only:
|
|
77
|
+
|
|
78
|
+
- `window.THREE` exists
|
|
79
|
+
- a bundle contains `three`, `babylon`, `pixi`, `regl`, or shader keywords
|
|
80
|
+
- the domain resembles a known platform
|
|
81
|
+
- a global variable contains a renderer
|
|
82
|
+
- another canvas on the page uses a framework
|
|
83
|
+
|
|
84
|
+
Promote a hypothesis only when at least one strong target binding exists:
|
|
85
|
+
|
|
86
|
+
- `renderer.domElement === targetCanvas`
|
|
87
|
+
- engine rendering canvas equals the target canvas
|
|
88
|
+
- target context creation stack comes from the framework/platform
|
|
89
|
+
- target draw calls, programs, or state are associated with framework objects
|
|
90
|
+
- public platform definition instance ID matches the target embed/canvas
|
|
91
|
+
- source map or module path initializes the target surface
|
|
92
|
+
|
|
93
|
+
## Route Selection
|
|
94
|
+
|
|
95
|
+
Pick the next route from the strongest current target-bound clue:
|
|
96
|
+
|
|
97
|
+
```text
|
|
98
|
+
strong platform feature
|
|
99
|
+
-> platform structured definition or public API
|
|
100
|
+
|
|
101
|
+
target renderer object accessible
|
|
102
|
+
-> runtime object and framework version
|
|
103
|
+
|
|
104
|
+
generic WebGL
|
|
105
|
+
-> frame capture or shader/runtime capture
|
|
106
|
+
|
|
107
|
+
WebGPU / TSL
|
|
108
|
+
-> platform source, TSL definition, WebGPU capture
|
|
109
|
+
|
|
110
|
+
owner or timeline unclear
|
|
111
|
+
-> preload hooks
|
|
112
|
+
|
|
113
|
+
source/config still missing
|
|
114
|
+
-> source map or targeted bundle slice
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## Adapter Interface
|
|
118
|
+
|
|
119
|
+
Each platform/framework adapter should answer:
|
|
120
|
+
|
|
121
|
+
```text
|
|
122
|
+
detect(context) target-bound evidence
|
|
123
|
+
preferredEvidence(context) highest-authority entry with lowest collection cost
|
|
124
|
+
capture(context) facts needed for replay
|
|
125
|
+
replay(context) recommended baseline route
|
|
126
|
+
validationHints(context) known failure cases and QA focus
|
|
127
|
+
fallback(context) next route if primary fails
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
Initial adapters: Unicorn Studio, shaders.com / TSL, generic WebGL, generic WebGPU, Canvas2D, and Three.js target binding.
|
|
131
|
+
|
|
132
|
+
## Three.js Target Binding
|
|
133
|
+
|
|
134
|
+
Use this only after a target surface exists. Three.js on the page is not enough.
|
|
135
|
+
|
|
136
|
+
Accept Three.js as the target framework when one is true:
|
|
137
|
+
|
|
138
|
+
- `renderer.domElement === targetCanvas`
|
|
139
|
+
- target canvas `data-engine` or dataset is corroborated by runtime renderer object
|
|
140
|
+
- target context creation stack includes Three.js renderer initialization
|
|
141
|
+
- target draw calls/programs correspond to Three.js material/program records
|
|
142
|
+
- source map/module that creates the target surface imports Three.js renderer/material code
|
|
143
|
+
|
|
144
|
+
Capture runtime facts:
|
|
145
|
+
|
|
146
|
+
- `THREE.REVISION`
|
|
147
|
+
- renderer output color space/tone mapping
|
|
148
|
+
- renderer size and pixel ratio
|
|
149
|
+
- scene/camera relationship for the target pass
|
|
150
|
+
- material type, shader chunks, `onBeforeCompile` hooks
|
|
151
|
+
- render targets and composer passes
|
|
152
|
+
- clock/time update rule
|
|
153
|
+
|
|
154
|
+
Three.js r170+ may use TSL and WebGPU.
|
|
155
|
+
Do not expect GLSL strings from `shaderSource()`.
|
|
156
|
+
Route to `references/three-shader-reconstruction.md` or `references/capture-backends.md` when node graphs or WebGPU backend are target-bound.
|
|
157
|
+
|
|
158
|
+
## Scope Gate
|
|
159
|
+
|
|
160
|
+
Default scope is `effect`.
|
|
161
|
+
|
|
162
|
+
Scope values:
|
|
163
|
+
|
|
164
|
+
- `effect`: independent visual effect
|
|
165
|
+
- `page`: current page DOM/CSS/interaction plus renderer cooperation
|
|
166
|
+
- `site`: main public visual routes, unique visual templates, shared renderer, and transitions; not backend, accounts, private data, or bulk same-template content pages
|
|
167
|
+
|
|
168
|
+
Ask a scope question only when all are true:
|
|
169
|
+
|
|
170
|
+
- the user did not specify scope
|
|
171
|
+
- WebGL/WebGPU is the overall experience skeleton
|
|
172
|
+
- it is coupled with DOM, scroll, navigation, or route
|
|
173
|
+
- extracting one surface would lose the main target experience
|
|
174
|
+
|
|
175
|
+
A fullscreen background canvas alone is not a reason to ask.
|
|
176
|
+
|
|
177
|
+
Question template:
|
|
178
|
+
|
|
179
|
+
```text
|
|
180
|
+
I have locked the main rendering system.
|
|
181
|
+
The site's WebGL/WebGPU also participates in layout, scroll, interaction feedback, or route transitions.
|
|
182
|
+
Extracting one effect would omit part of the main experience.
|
|
183
|
+
|
|
184
|
+
Choose the reproduction scope:
|
|
185
|
+
A. Core effect (default, fastest) - first build it as an independently runnable local effect.
|
|
186
|
+
B. Current page - also reproduce the DOM/CSS, scroll, interaction, and renderer cooperation.
|
|
187
|
+
C. Main site visual experience - inspect public visual routes and templates.
|
|
188
|
+
Reproduce the shared renderer, key visual pages, and route transitions.
|
|
189
|
+
Do not reproduce backend, accounts, private data, or bulk same-template content pages.
|
|
190
|
+
|
|
191
|
+
Reply with A, B, or C. If you reply "continue" or provide no scope, proceed with A.
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
Ask separately only for login, CAPTCHA, private pages, paid resources, or permission/license uncertainty.
|
|
195
|
+
Combine blockers into one note.
|
|
196
|
+
|
|
197
|
+
## Gate Rules
|
|
198
|
+
|
|
199
|
+
- Before attribution completes, `lockStatus` can only be `unlocked` or `provisional`.
|
|
200
|
+
- `attributed` allows owner/backend/source probes bound to `nextProbe`; it does not allow deep source or bundle work.
|
|
201
|
+
- `locked` requires a non-empty `gateDecision.requiredEvidence` checklist in `scout-card.json`; every item must be an evidence item with `status`, `evidenceId`, `path`, `truth`, and `notes`.
|
|
202
|
+
- `frameworkHypotheses` and `platformHypotheses` are candidates, not conclusions.
|
|
203
|
+
- `nextProbe` has one main action.
|
|
204
|
+
- Raw DOM, screenshots, network logs, and frame captures go into files and are referenced by path.
|
|
205
|
+
- After lock, fill `targetSet`, excluded alternatives, lock evidence, and primary route.
|
package/templates/vite/.howone/skills/web-shader-extractor/references/three-shader-reconstruction.md
ADDED
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
# Three.js Shader Reconstruction
|
|
2
|
+
|
|
3
|
+
Use this reference when target-bound evidence shows Three.js shader customization.
|
|
4
|
+
Applies to `material.onBeforeCompile`, Three.js TSL, WebGPU node graphs, or material systems that must preserve recorded source behavior.
|
|
5
|
+
|
|
6
|
+
## onBeforeCompile Failure Cases
|
|
7
|
+
|
|
8
|
+
### Built-In Function Signatures Vary By Version
|
|
9
|
+
|
|
10
|
+
Three.js shader chunk signatures change across versions:
|
|
11
|
+
|
|
12
|
+
```glsl
|
|
13
|
+
// r166 and earlier
|
|
14
|
+
vec4 getIBLVolumeRefraction(n, v, roughness, diffuseColor, specularColor, specularF90,
|
|
15
|
+
pos, modelMatrix, viewMatrix, projectionMatrix, ior, thickness,
|
|
16
|
+
attenuationColor, attenuationDistance)
|
|
17
|
+
|
|
18
|
+
// r167+ adds dispersion
|
|
19
|
+
vec4 getIBLVolumeRefraction(n, v, roughness, diffuseColor, specularColor, specularF90,
|
|
20
|
+
pos, modelMatrix, viewMatrix, projectionMatrix, dispersion, ior, thickness,
|
|
21
|
+
attenuationColor, attenuationDistance)
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Always check the target version's actual signature:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
curl -s "https://cdn.jsdelivr.net/npm/three@0.167.0/src/renderers/shaders/ShaderChunk/transmission_pars_fragment.glsl.js" \
|
|
28
|
+
| tr '\n' ' ' | grep -oE 'vec4 getIBLVolumeRefraction\([^)]+\)'
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### GLSL Does Not Allow Nested Function Definitions
|
|
32
|
+
|
|
33
|
+
```glsl
|
|
34
|
+
// Wrong.
|
|
35
|
+
void main() {
|
|
36
|
+
float myRand(vec2 co) { return fract(sin(...)); }
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// Correct.
|
|
40
|
+
float myRand(vec2 co) { return fract(sin(...)); }
|
|
41
|
+
void main() {
|
|
42
|
+
float r = myRand(uv);
|
|
43
|
+
}
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### Preserve Conditional Compilation Guards
|
|
47
|
+
|
|
48
|
+
Some variables exist only under specific macros:
|
|
49
|
+
|
|
50
|
+
- `vWorldPosition` requires `USE_TRANSMISSION`
|
|
51
|
+
- `vTransmissionMapUv` requires `USE_TRANSMISSIONMAP`
|
|
52
|
+
- `roughnessFactor` is available after `lights_physical_fragment`
|
|
53
|
+
|
|
54
|
+
If replacing `#include <transmission_fragment>`, keep the source guard pattern.
|
|
55
|
+
|
|
56
|
+
### Avoid Name Collisions
|
|
57
|
+
|
|
58
|
+
Injected global functions and variables can collide with Three.js internals:
|
|
59
|
+
|
|
60
|
+
- avoid generic names such as `hash`, `random`, and `noise`
|
|
61
|
+
- prefix custom helper names when needed
|
|
62
|
+
- prefix uniforms consistently, for example `uDistortion` and `uNoiseTime`
|
|
63
|
+
|
|
64
|
+
## Preferred Injection Pattern
|
|
65
|
+
|
|
66
|
+
Modify normals before the existing chunk when the target evidence supports it:
|
|
67
|
+
|
|
68
|
+
```javascript
|
|
69
|
+
material.onBeforeCompile = (shader) => {
|
|
70
|
+
shader.uniforms.uDistortion = { value: 0 };
|
|
71
|
+
shader.uniforms.uNoiseTime = { value: 0 };
|
|
72
|
+
|
|
73
|
+
shader.fragmentShader = `
|
|
74
|
+
uniform float uDistortion;
|
|
75
|
+
uniform float uNoiseTime;
|
|
76
|
+
${noiseGLSL}
|
|
77
|
+
` + shader.fragmentShader;
|
|
78
|
+
|
|
79
|
+
shader.fragmentShader = shader.fragmentShader.replace(
|
|
80
|
+
'#include <transmission_fragment>',
|
|
81
|
+
`
|
|
82
|
+
#ifdef USE_TRANSMISSION
|
|
83
|
+
{
|
|
84
|
+
if (uDistortion > 0.0) {
|
|
85
|
+
normal = normalize(normal + uDistortion * vec3(
|
|
86
|
+
snoiseFractal(vWorldPosition * 0.08 + vec3(uNoiseTime)),
|
|
87
|
+
snoiseFractal(vWorldPosition.zxy * 0.08 - vec3(uNoiseTime)),
|
|
88
|
+
snoiseFractal(vWorldPosition.yxz * 0.08)
|
|
89
|
+
));
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
#endif
|
|
93
|
+
#include <transmission_fragment>
|
|
94
|
+
`
|
|
95
|
+
);
|
|
96
|
+
};
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
When target evidence shows grain from low sample counts and chromatic aberration, a full `#include <transmission_fragment>` replacement may be required.
|
|
100
|
+
Keep the `#ifdef USE_TRANSMISSION` wrapper.
|
|
101
|
+
Preserve transmission and thickness map blocks.
|
|
102
|
+
Use the correct `getIBLVolumeRefraction` signature.
|
|
103
|
+
Pass evidence-derived dispersion/IOR values.
|
|
104
|
+
|
|
105
|
+
## Effect Source Mapping
|
|
106
|
+
|
|
107
|
+
| Effect | Source | Implementation |
|
|
108
|
+
|---|---|---|
|
|
109
|
+
| Glass refraction | `MeshPhysicalMaterial` `transmission` | Three.js built-in |
|
|
110
|
+
| Chromatic aberration | different IOR values for R/G/B | replace `transmission_fragment` |
|
|
111
|
+
| Film grain | low sample count plus per-pixel random direction | replace `transmission_fragment` |
|
|
112
|
+
| Organic distortion | simplex noise perturbing normal/refraction direction | `onBeforeCompile` injection |
|
|
113
|
+
| Color offset | `dispersion` property in r167+ | `MeshPhysicalMaterial` built-in |
|
|
114
|
+
|
|
115
|
+
## TSL Identification
|
|
116
|
+
|
|
117
|
+
Three.js r170+ TSL composes shader node graphs through JavaScript function chains and compiles them at runtime.
|
|
118
|
+
|
|
119
|
+
Identification signals:
|
|
120
|
+
|
|
121
|
+
1. Bundles contain many `uniform` or `shader` terms but very little `precision` or `gl_FragColor`.
|
|
122
|
+
2. The target canvas `data-engine` or runtime evidence indicates Three.js r170+.
|
|
123
|
+
3. The target-bound source contains chained calls such as `.mul()`, `.add()`, `.toVar()`, or `.assign()`.
|
|
124
|
+
|
|
125
|
+
## TSL To GLSL Mapping
|
|
126
|
+
|
|
127
|
+
| TSL | GLSL |
|
|
128
|
+
|---|---|
|
|
129
|
+
| `screenUV` | `gl_FragCoord.xy / resolution` |
|
|
130
|
+
| `viewportSize` | `uniform vec2 resolution` |
|
|
131
|
+
| `float()` / `vec2()` / `vec3()` / `vec4()` | same GLSL constructors, though TSL uses JavaScript functions |
|
|
132
|
+
| `.mul()` / `.add()` / `.sub()` / `.div()` | `*` / `+` / `-` / `/` |
|
|
133
|
+
| `sin()` / `cos()` / `mix()` / `smoothstep()` | same names |
|
|
134
|
+
| `clamp()` / `abs()` / `fract()` / `floor()` | same names |
|
|
135
|
+
| `pow()` / `exp()` / `sqrt()` / `dot()` / `length()` | same names |
|
|
136
|
+
| `Fn()` | shader function wrapper; inline it into GLSL |
|
|
137
|
+
| `uniform()` | `uniform <type> name` |
|
|
138
|
+
| `convertToTexture()` | RTT or FBO pass |
|
|
139
|
+
| `.sample(uv)` | `texture(sampler, uv)` |
|
|
140
|
+
| `.toVar()` / `.assign()` | mutable variable declaration/assignment |
|
|
141
|
+
| `.oneMinus()` | `1.0 - x` |
|
|
142
|
+
|
|
143
|
+
## TSL Reconstruction Steps
|
|
144
|
+
|
|
145
|
+
1. Locate `fragmentNode` near the target component name or target-bound module.
|
|
146
|
+
2. Build the mapping from minified imports to TSL function names using bundle import statements.
|
|
147
|
+
```javascript
|
|
148
|
+
import { A as screenUV, W as sin, ... } from "three-module"
|
|
149
|
+
```
|
|
150
|
+
3. Translate chained calls into GLSL expressions.
|
|
151
|
+
```javascript
|
|
152
|
+
// TSL: screenUV.x.sub(center.x).mul(aspect)
|
|
153
|
+
// GLSL: (uv.x - center.x) * aspect
|
|
154
|
+
```
|
|
155
|
+
4. Convert `convertToTexture(childNode)` into an independent FBO pass and sample it with `texture()` in the consuming shader.
|
package/templates/vite/.howone/skills/web-shader-extractor/references/tool-capability-matrix.md
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# Tool Capability Matrix
|
|
2
|
+
|
|
3
|
+
The skill depends on capabilities, not specific tool names. Probe available tools first, then choose the smallest sufficient profile.
|
|
4
|
+
|
|
5
|
+
## Capability Names
|
|
6
|
+
|
|
7
|
+
```text
|
|
8
|
+
navigate
|
|
9
|
+
runtime-eval
|
|
10
|
+
preload-script
|
|
11
|
+
network-metadata
|
|
12
|
+
network-body
|
|
13
|
+
source-map
|
|
14
|
+
canvas-screenshot
|
|
15
|
+
interaction
|
|
16
|
+
frame-capture-webgl
|
|
17
|
+
frame-capture-webgpu
|
|
18
|
+
local-run
|
|
19
|
+
multi-frame-compare
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Profiles
|
|
23
|
+
|
|
24
|
+
### Profile A: Light Scout
|
|
25
|
+
|
|
26
|
+
Use for navigation, runtime eval, canvas inventory, screenshots, pointer/scroll/resize, and network overview.
|
|
27
|
+
A browser CLI, browser MCP, or host browser automation can satisfy this profile.
|
|
28
|
+
|
|
29
|
+
If Playwright is already installed, `scripts/fetch-rendered-dom.mjs` can serve as an optional inventory helper for DOM/canvas/network observations.
|
|
30
|
+
It does not perform Surface Attribution, Target Lock, Replay Ready, or QA gates.
|
|
31
|
+
Treat its output as inventory and hypothesis evidence only.
|
|
32
|
+
|
|
33
|
+
### Profile B: Chrome Deep Diagnostics
|
|
34
|
+
|
|
35
|
+
Use for pre-navigation init scripts, source-mapped stacks, response bodies, performance traces, and existing Chrome sessions.
|
|
36
|
+
CLI fits batch work. MCP fits continued interaction.
|
|
37
|
+
|
|
38
|
+
### Profile C: GPU Capture
|
|
39
|
+
|
|
40
|
+
Use WebGL frame capture or WebGPU recorders only after target and backend are known. GPU tools are optional adapters, not first-strike requirements.
|
|
41
|
+
|
|
42
|
+
### Profile D: Static Fallback
|
|
43
|
+
|
|
44
|
+
Use HTML, public API, source maps, dynamic chunk graph, and narrow bundle slices. Do not default to full deobfuscation.
|
|
45
|
+
|
|
46
|
+
`scripts/scan-bundle.sh` may be used on a target-bound slice to count shader/framework keywords.
|
|
47
|
+
Treat every result as a hypothesis that still needs target-bound evidence.
|
|
48
|
+
Do not infer GPGPU from generic `RenderTarget`, generic `DataTexture`, or post-processing hits.
|
|
49
|
+
Require feedback-loop, ping-pong pair, data-texture simulation, or compute-like update evidence.
|
|
50
|
+
|
|
51
|
+
## Rules
|
|
52
|
+
|
|
53
|
+
- Do not require a single MCP before starting.
|
|
54
|
+
- Do not silently install large dependencies.
|
|
55
|
+
- If a tool is missing, downgrade to the closest capability and record the gap.
|
|
56
|
+
- If connecting to an existing logged-in browser, warn that credentials/page data may be visible to the agent and avoid persisting sensitive material.
|
|
57
|
+
- Store variable tool/version observations in run artifacts, not hard-coded skill instructions.
|