depthview-mcp 0.1.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/skill/SKILL.md CHANGED
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: depthview
3
- description: Work on a three.js / React Three Fiber scene together with the Depthview browser inspector, through the Depthview MCP tools. Read the live scene, change lights, cameras, materials and shader uniforms on the running page, look at the result, and write the final values into the source code. Use when the user is building or tuning a 3D scene, says they changed something in Depthview, asks to "apply the Depthview edits", pastes a Depthview change list, or asks to pair or connect Depthview.
3
+ description: Build finished three.js / React Three Fiber sites and scenes from nothing, and tune and test existing ones, through the Depthview MCP tools. Carries the method for an award-level 3D page (subject modelled in code, studio lighting, a set with no horizon, a scroll camera journey, typography, a reviewed result), a design review that returns a picture of every scroll stop with its measured faults, and the three.js documentation of the version the project has installed. Read the live scene, change lights, cameras, materials and shader uniforms on the running page, make it look realistic (world lighting, materials, bevels, tone mapping, lens effects), add and edit particles, smoke, clouds, fog and custom GLSL shaders live, find visual bugs (pixelation, blur, jagged edges, z-fighting, texture, colour and shadow problems) by measuring the real frame, and write the result into the source code. Carries in-depth guides on how award-level 3D sites (igloo.inc, organimo) are built, rendering, shaders, particles, volumetrics, performance and R3F. Use when the user asks for a 3D website, landing page, hero or product page, is building or tuning a 3D scene or site, wants it to look more realistic or premium, asks for particles, smoke, clouds, fog or a shader effect, asks why a 3D page is pixelated, blurry, flickering or slow, wants a 3D site tested or checked, says they changed something in Depthview, asks to "apply the Depthview edits", pastes a Depthview change list, or asks to pair or connect Depthview.
4
4
  ---
5
5
 
6
6
  # Depthview: tune a 3D scene live, then write it into the source
@@ -14,19 +14,135 @@ three.js scene. Through the `depthview` MCP server you can use it as your eyes a
14
14
  objects. No reload, no source edit, the developer watches it happen and can undo it.
15
15
  - **Write** what is right into the source files.
16
16
 
17
+ - **Create** effects on the live page: particles, smoke, clouds, fog, your own GLSL.
18
+ - **Test** it: an audit that measures the drawn frame and names each visual bug.
19
+
17
20
  The developer can also change things by hand in the inspector. Those changes reach you the same
18
21
  way, through `get_changes`.
19
22
 
20
- ## 1. Connect
23
+ ## Who does what
24
+
25
+ **You do the making.** The whole process (the subject, the lighting and realism, the page,
26
+ the camera journey, the review) runs through these tools and your own file edits, with or
27
+ without the extension: `open_preview` gives you eyes on a headless page.
28
+
29
+ **The extension is where the developer places things by hand:** which view of the scene each
30
+ section shows (Camera views) and how the camera flows between them. They drag, you read it
31
+ back (`get_camera_views`, `get_camera_path_edit`, `get_changes`) and write it into the code.
32
+ Do not send the developer into the extension to fix lighting or materials: that is your work.
33
+
34
+ ## Building a site from nothing
35
+
36
+ When the request is a page, not a tweak ("make a site for…", "a 3D landing page", "something
37
+ like igloo.inc"), read the `site-build` guide first and follow it. In short:
38
+
39
+ 1. Decide the **subject**, **three materials that differ**, the **palette** and the
40
+ **journey** (three to five scroll stops). Say them in a few lines and start.
41
+ 2. Page and typography around a fixed canvas. Then renderer and a studio environment, a set
42
+ with no horizon, the subject (the `modeling` guide, or a real model), one camera key per
43
+ section with the subject placed by `camera.setViewOffset`, a restrained last pass, the
44
+ phone layout, the reveal.
45
+ 3. Before any three.js class or add-on you are not certain of: `three_docs { name }`. It
46
+ reads the documentation from the three.js this project has installed. three.js renames
47
+ things (`Clock`, `PCFSoftShadowMap`, `RGBELoader` are all deprecated); what you remember
48
+ may be another version. The `threejs` guide lists what changed.
49
+ 4. **Review after every round.** Start the dev server, `open_preview`, `get_errors`, then
50
+ `review_site`: a picture of every scroll stop and the faults measured there (a glare, a
51
+ flat frame, a horizon line, a colour fringe, copy that cannot be read, a stock box or
52
+ sphere as the subject, no copy, a scroll that changes nothing). Fix every high and medium
53
+ one in the source, reload, review again. Then answer its `lookFor` questions from the
54
+ pictures and improve the weakest stop. Then `review_site { phone: true }`.
55
+ 5. `audit_visuals`, `audit_camera_motion`, `get_performance`. Show the developer the
56
+ pictures, and offer the extension for placing the views by hand.
57
+
58
+ A first draft always has faults that only the picture shows. Never present one unreviewed.
59
+ `get_realism` at 95 says the render settings are in order, not that the page looks good: a
60
+ cube on a grey floor scores 97. `create_scene` writes a scaffold of placeholder blocks: a
61
+ start for tuning, not a page.
62
+
63
+ ## Read the guide for the area before you write code
64
+
65
+ This skill carries reference guides. Read the one for the area you are about to work in, once
66
+ per session, **before** writing three.js code or tuning: they hold the numbers, the order of
67
+ operations and the traps. They are in `references/` next to this file; if you cannot read
68
+ files there, call `get_guide { topic }`, which returns the same text.
69
+
70
+ | Topic | Read it when |
71
+ | -------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- |
72
+ | `site-build` | Building a page from nothing: the order of work, the numbers for each step, and the faults every first draft has |
73
+ | `modeling` | There is no model file: lathe profiles, bevelled extrusions, cut detail, natural shapes, labels drawn on a canvas |
74
+ | `threejs` | Before the first line of three.js: what was renamed or removed, defaults, units, the set-up that is right in r187 |
75
+ | `award-sites` | Planning a 3D site or asked for "something like igloo.inc / organimo": how those are really built, the pipeline, what makes them feel expensive |
76
+ | `rendering` | Colour management, tone mapping, materials, environment lighting, shadows, post-processing order, anti-aliasing |
77
+ | `shaders` | Writing or patching GLSL: ShaderMaterial, onBeforeCompile anchors, noise, fresnel, dissolve, debugging |
78
+ | `particles` | Dust, snow, sparks, swarms: which technique for which count, GPGPU, soft particles |
79
+ | `volumetrics` | Clouds, smoke, fog, light shafts: sprite stacks, ray marching, what makes it fast enough |
80
+ | `performance` | Budgets, draw calls, compression, adaptive quality, loading without hitches |
81
+ | `r3f` | React Three Fiber and drei: the rules, the patterns, what must never be in a component |
82
+ | `visual-qa` | Something looks wrong, or the site must be tested: every bug, its cause, how to confirm, the fix |
83
+ | `extension-ui` | The developer asks where something is in the extension, or you need to tell them what to click: every panel, tab, switch and shortcut |
21
84
 
22
- Call `get_status` first, always.
85
+ ## 1. Connect
23
86
 
24
- | `get_status` says | Do this |
87
+ Call `get_status` first, always. Its `mode` says what answers the live tools:
88
+
89
+ - `"extension"`: the Depthview inspector is open in the developer's Chrome. They watch what
90
+ you do and can tune by hand.
91
+ - `"preview"`: a headless browser this server started with `open_preview`. Nobody watches;
92
+ you see through `take_screenshot`.
93
+ - `"none"`: nothing yet. Choose one of the two.
94
+
95
+ ### Working without the extension: `open_preview`
96
+
97
+ You do not need the extension to see and work on a scene. `open_preview { url }` opens the
98
+ dev page in a headless Chrome on this machine and gives it the same hook the extension uses,
99
+ so the live tools answer the same way: `take_screenshot`, `describe_scene`, `find_objects`,
100
+ `get_object`, `set_value`, `audit_visuals`, `get_errors`, `get_performance`, `get_resources`,
101
+ `get_lighting`, the shader tools, effects, the whole realism look (`get_realism`,
102
+ `fix_realism`, `set_look`, `set_surface`, `save_look`), `set_scroll`, `set_time`,
103
+ `set_viewport`, `get_changes` and `apply_changes_to_code`.
104
+
105
+ Use it whenever no extension is paired. **Never write 3D code blind when you could look:**
106
+
107
+ 1. Start the dev server if it is not running (in the background), and find its address.
108
+ 2. `open_preview { url }`. If `sceneAvailable` is false: `take_screenshot` and `get_errors`;
109
+ a scene that loads slowly needs `wait: 6000`.
110
+ 3. Work as in the rest of this skill: look, change live, measure, write into the source.
111
+ 4. **After every source edit, `open_preview` again** to reload the page, then
112
+ `take_screenshot`. Build, look, fix, look again: that loop is the whole point.
113
+ 5. Other screens: `open_preview` with `width`, `height`, `pixelRatio` (390 × 844 at 3 is a
114
+ phone; 1440 × 900 at 2 a laptop), or `set_viewport { width, height, devicePixelRatio }` on
115
+ the open page. Unlike a real window it can be any size.
116
+ 6. `close_preview` when the work is done.
117
+
118
+ The scroll camera path works in the preview as well: `get_camera_path` records it,
119
+ `edit_camera_path` changes its keys and previews them, `save_camera_path` writes the file.
120
+
121
+ What the preview does not have: the developer's selection, and the developer's eyes: show
122
+ them screenshots, and tell them they can open the extension to watch and tune by hand (and
123
+ to drag the camera path's handles). Frame rates measured in a headless browser are for
124
+ comparing before and after, not absolute numbers: it may be drawing with software. It has a
125
+ clean profile: a page behind a login will not load. When the extension is paired, it is used
126
+ instead of the preview.
127
+
128
+ ### With the extension
129
+
130
+ The developer has switches in the inspector that change what your tools return.
131
+ `get_inspector_state` reports them, and its `affectsYourTools` names the ones that matter
132
+ right now: "Site pipeline" off (the site is not drawing: `get_performance` counts nothing and
133
+ the audit cannot read a frame), an isolated object (screenshots show only that), wireframe,
134
+ live preview, a camera-path preview. Call it when a result looks wrong for no reason in the
135
+ scene. To tell the developer where to click, read the `extension-ui` guide first: do not
136
+ guess the names of panels and buttons.
137
+
138
+ | `get_status` says | Do this |
139
+
140
+ | `get_inspector_state` | What the developer sees and has switched in the inspector |
25
141
  | -------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
26
142
  | `paired: false` | Give the developer the `pairingCode` and say: open your site in Chrome, click the Depthview icon, and type the code under **AI agent & code sync** in the side panel. Then stop and wait. |
27
143
  | `paired: true`, `inspectorOpen: false` | Ask them to click the Depthview icon on their page and keep that tab in front. |
28
144
  | `sceneAvailable: false` | The page has no readable three.js scene (not loaded yet, or it uses the WebGPU renderer). Say so. Do not guess values. |
29
- | `sourceLocations: false` | Live tuning works. Exact source edits do not: you will find the code yourself (see section 4). Suggest adding `@depthview/r3f-bridge` once, do not insist. |
145
+ | `sourceLocations: false` | Live tuning works. Exact source edits do not: you will find the code yourself (see section 4). Suggest adding `depthview-r3f-bridge` once, do not insist. |
30
146
 
31
147
  The pairing code is used once. If pairing fails, call `get_status` again for the new code.
32
148
  If the `depthview` tools are missing, the project is not set up: tell the developer to run
@@ -95,8 +211,10 @@ nothing is changed if one is wrong, and one `undo_change` takes all of them back
95
211
  The value must have the same shape as the current one: a number stays a number, a vector stays
96
212
  `[x, y, z]`. `set_value` refuses anything else and says what it expected.
97
213
 
98
- Things that cannot be changed live: adding or removing objects, geometry, swapping material
99
- types, textures, shader source, animation code. Do those in the source.
214
+ Things that cannot be changed live: geometry of existing objects, swapping material types,
215
+ loading textures or models, animation code. Do those in the source. Objects, effects and
216
+ shaders _can_ be added and edited live: see "Adding and removing objects", "Effects" and
217
+ "Shaders".
100
218
 
101
219
  `material.opacity` below 1 shows only when `material.transparent` is true.
102
220
 
@@ -116,15 +234,53 @@ the next frame. Change the code that drives it instead, and say so to the develo
116
234
 
117
235
  Start a "why is it slow / ugly / broken" task with the tool that measures it, not with a guess.
118
236
 
119
- | Symptom | Tool | Look at |
120
- | --------------------------------------- | ----------------- | ------------------------------------------------------------------------------------------------------------------ |
121
- | Slow, stutter, hot laptop | `get_performance` | `fps`, `frameMs.p95`, `drawCalls`, `triangles`, `renderPasses`, `canvas.pixelRatio`, `passesOfOneFrame` |
122
- | Slow to load, crashes on phones | `get_resources` | The biggest textures and geometries; `usedBy: 1` on a huge texture; many materials that look the same |
123
- | Something does not show, a black object | `get_errors` | `shaderPrograms` (compile failures), then `errors` |
124
- | Shadows blurry, cut off or missing | `get_lighting` | `issues` first: it names the light and the fix |
125
- | Looks wrong at one scroll position | `set_scroll` | Then `take_screenshot` with `view: "site"` |
126
- | Looks wrong at one moment | `set_time` | `pause`, then `step`, then screenshot. **Always `resume`.** |
127
- | Wrong on small or dense screens | `set_viewport` | `width`/`height`, then screenshot; `pixelRatio: 2` or `3`, then `get_performance`. **Always `reset: true` after.** |
237
+ | Symptom | Tool | Look at |
238
+ | ---------------------------------------- | --------------------- | ---------------------------------------------------------------------------------------------------------------------- |
239
+ | Slow, stutter, hot laptop | `get_performance` | `fps`, `frameMs.p95`, `drawCalls`, `triangles`, `renderPasses`, `canvas.pixelRatio`, `passesOfOneFrame` |
240
+ | Slow to load, crashes on phones | `get_resources` | The biggest textures and geometries; `usedBy: 1` on a huge texture; many materials that look the same |
241
+ | Something does not show, a black object | `get_errors` | `shaderPrograms` (compile failures), then `errors` |
242
+ | Shadows blurry, cut off or missing | `get_lighting` | `issues` first: it names the light and the fix |
243
+ | Looks wrong at one scroll position | `set_scroll` | Then `take_screenshot` with `view: "site"` |
244
+ | Looks wrong at one moment | `set_time` | `pause`, then `step`, then screenshot. **Always `resume`.** |
245
+ | Wrong on small or dense screens | `set_viewport` | `width`/`height`, then screenshot; `pixelRatio: 2` or `3`, then `get_performance`. **Always `reset: true` after.** |
246
+ | Pixelated, blurry, jagged, flickering | `audit_visuals` | `issues`, worst first: each has `evidence`, `cause`, `fix` and often `tryLive` |
247
+ | Scroll camera jerky, busy, not cinematic | `audit_camera_motion` | `score`, `verdict`, `issues` with scroll ranges, `shots` (what the camera does where), `checkAt` (stops to screenshot) |
248
+
249
+ ## Testing a 3D page for visual bugs
250
+
251
+ `audit_visuals` checks the set-up of the scene **and measures the pixels of a real frame**, so
252
+ it finds what is visibly wrong even when the cause is deep in the site's own pipeline:
253
+
254
+ - **Resolution**: a canvas or a render target smaller than the screen (the usual "why is it
255
+ pixelated"), a squashed canvas, a camera aspect left behind by a resize, blocky upscaling.
256
+ - **Edges**: stair-stepped silhouettes; anti-aliasing that is switched on but does not reach
257
+ the scene because it is drawn through post-processing.
258
+ - **Textures**: too small for their size on screen, `NearestFilter`, no mipmaps, no
259
+ anisotropy, colour textures not marked sRGB, data textures marked sRGB.
260
+ - **Depth**: a near/far range that causes z-fighting, flat surfaces lying in the same plane.
261
+ - **Also**: see-through objects that write depth, NaN transforms, shadow set-up, banded
262
+ gradients, clipped highlights, a blank frame, a lost WebGL context.
263
+
264
+ How to use it:
265
+
266
+ 1. `get_errors` first, then `audit_visuals { scroll: [0, 25, 50, 75, 100] }`: texture, depth
267
+ and resolution problems depend on where the camera is, and each issue comes back with the
268
+ scroll positions it shows at.
269
+ 2. **Confirm before you fix.** Where an issue has `tryLive`, run that call, then
270
+ `take_screenshot view:"site" compare:true`. If the picture did not change, that was not
271
+ the cause: say so.
272
+ 3. Phone check: `set_viewport { width: 500, height: 900, pixelRatio: 3 }`, audit again,
273
+ `get_performance`, then `set_viewport { reset: true }`.
274
+ 4. Report worst first: what is wrong, the measured evidence, the source change. Then fix in
275
+ the source and audit again to prove it is gone.
276
+
277
+ `measured` in the result holds the raw numbers: `sharpEdgeWidth` (about 1 to 1.6 px for a
278
+ full-resolution render, 2 and up when something is rendered small and stretched),
279
+ `hardEdgeShare` (edges with no in-between pixel: no anti-aliasing), `blockSize`, `bandShare`.
280
+ A deliberate style (pixel art, heavy depth of field) reads as an issue: ask, do not "fix" a
281
+ decision. The audit cannot judge composition or taste: look at the screenshots yourself. The
282
+ `visual-qa` guide explains every issue id, and the bugs only eyes find. The `test` prompt
283
+ walks through all of it.
128
284
 
129
285
  Rules of thumb for `get_performance` (they are starting points, not laws):
130
286
 
@@ -138,6 +294,227 @@ Rules of thumb for `get_performance` (they are starting points, not laws):
138
294
  Prove a fix: measure, change, measure again, and report both numbers. To learn what one object
139
295
  costs, `remove_object` it, measure, then `reset_changes`.
140
296
 
297
+ ## Camera views: the page on load and each section
298
+
299
+ The easy way to answer "change what shows when the page loads", "show the watch from the
300
+ left in the features section" or "the camera should stop on each section". A view is what the
301
+ site camera shows at one place on the page; the path between views is built for you.
302
+
303
+ 1. `get_camera_views` lists them: view 1 is the page on load (scroll 0), then one per page
304
+ section, each with its scroll `percent`, camera `position`, `target`, `fov`, `hold` and
305
+ `changed`. The first call scrolls the page once to find the sections. It works when the
306
+ camera does not move at all yet: every view starts as the one the site has.
307
+ 2. `set_camera_view` sets one. `view` is its number, id or section label. Say what to show in
308
+ one of three ways:
309
+ - `frame: { object, from, fill }` shows an object: `from` is `front`, `back`, `left`,
310
+ `right`, `top`, `front-left` or `front-right`; `fill` (0.05 to 1) is how much of the
311
+ screen it takes. The pose comes from the object's measured size.
312
+ - `position` and/or `target` for exact numbers (one alone keeps the other).
313
+ - `fromView: true` takes the view the developer framed by hand in the inspector. Use it
314
+ when they say "I put the camera where I want it".
315
+ `hold: true` keeps the camera still while that section scrolls past. `reset: true` puts a
316
+ view back.
317
+ 3. The call leaves the page on that view, drawn by the site camera on the edited path:
318
+ `take_screenshot` with `view: "site"` and judge it. Is the subject in frame, clear of the
319
+ page's text, not cut off? Change `fill`, `from` or `target` and look again.
320
+ 4. Save as for any path: `save_camera_path`, or rewrite the developer's own camera code (next
321
+ section). A camera that did not move before needs `useCameraPath(path)` from
322
+ `depthview-r3f-bridge/camera-path` inside `<Canvas>`; ask before removing their camera code.
323
+ A one-screen page has one view: write its position, look-at and fov into the camera in the
324
+ source instead.
325
+
326
+ The developer does the same by hand under **Camera views** in the side panel: pick a view,
327
+ drag the 3D view, press **Use this view**. Their views reach you through `get_camera_views`.
328
+ Prefer views over single keys; `edit_camera_path` is for a point between two views.
329
+
330
+ ## The scroll camera path
331
+
332
+ `get_camera_path` records where the site camera is along the scroll. To change that path:
333
+
334
+ 1. `edit_camera_path` with `action: "start"` turns the recording into a few keys. The
335
+ developer can also do this in the inspector (Camera views > Set camera views) and drag the
336
+ keys; their edits reach you the same way.
337
+ 2. Each key: scroll `percent` (0 top, 100 bottom), camera `position`, look-at `target`, `fov`,
338
+ in world space. Between keys the camera follows a smooth curve through the positions and
339
+ through the targets.
340
+ 3. Move keys with `action: "set_key"` (`index`, `position`, `target`, `fov`, `percent`), add one
341
+ with `"add_key"` at a `percent`, remove one with `"remove_key"`. Size moves to the scene
342
+ (`describe_scene`).
343
+ 4. `action: "preview"` puts the site camera on the edited path. Then `scroll` (in the same call)
344
+ or `set_scroll`, and `take_screenshot` with `view: "site"` to see what a visitor sees.
345
+ 5. To put it into the project, `get_camera_path_edit` first, then either:
346
+ - `save_camera_path` when the project uses (or the developer wants) `useCameraPath(path)`
347
+ from `depthview-r3f-bridge/camera-path` with a `camera-path.json`, or
348
+ - rewrite the developer's own scroll camera code with the keys (GSAP timeline values,
349
+ curve points, `useFrame` targets). Keep their library and structure; read the code first.
350
+ The `camera-path` prompt walks through it.
351
+
352
+ The inspector's preview does not change the site's code: nothing is written until you save or
353
+ edit the source.
354
+
355
+ ## Making a scene look real
356
+
357
+ Use this when the developer wants the scene to look realistic, premium, "like a product shot",
358
+ or less like a first draft. Realism is a handful of settings, not more geometry, and Depthview
359
+ holds them as one object, the **look**: colour management, render quality, world lighting,
360
+ shadows, surface materials, bevelled edges and lens effects. You tune it on the live page and
361
+ save it once. Do not hand-write environment, lighting or post-processing code while the look
362
+ can do it: you cannot see your own code's result, but you can see the look's.
363
+
364
+ 1. `get_realism` gives a `score` out of 100, the `issues` (each with why it matters), and the
365
+ current `look`. Issues with `fixable: true` can be fixed live; the others need a change in
366
+ the source, and `detail` says which.
367
+ 2. `fix_realism` applies the one-click fixes: filmic tone mapping, full pixel ratio, studio
368
+ world lighting, soft shadows, bevelled edges, and (with the dev bridge) anti-aliasing and
369
+ ambient occlusion. One `undo_change` takes it back.
370
+ 3. `take_screenshot` with `view: "site"` and `compare: true`, and look at it. Every later step
371
+ too. The score says the basics are in place; only the picture says it looks good.
372
+ 4. Tune with `set_look` (a partial patch) and `set_surface` (one object):
373
+
374
+ | What | How |
375
+ | ------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
376
+ | Metal and gloss | A `world` with light boxes. `studio` for metal and glass, `softbox` for bright product shots. A highlight is a light box mirrored in the surface. |
377
+ | Move a highlight | Send the whole `world.boxes` list back with one box changed (`azimuth` around, `elevation` up), or turn everything with `world.rotation`. |
378
+ | Broad soft gradient | A large box (`width`, `height` 60 and up) with `softness` near 1. A small bright box gives a sharp glint. |
379
+ | Surface | `set_surface` with a `preset` (`polished-metal`, `brushed-metal`, `gold`, `car-paint`, `glass`, `plastic`, `ceramic`, `rubber`), then single values over it. |
380
+ | Metal values | `metalness` 1, `roughness` 0.1 to 0.4. Never 0: a perfect mirror reads as fake. |
381
+ | Sharp CG edges | `bevel` `mode: "all"`, `amount` 0.03 to 0.08. Boxes and cylinders only; other shapes are bevelled in the modelling tool. |
382
+ | Clipped highlights | `color.toneMapping`: `agx` (most natural), `aces` (contrast), `neutral` (brand colours stay exact). Then `exposure` in steps of 0.1. |
383
+ | Floating objects | `shadows.mode: "on"`, `softness` 3 to 5. Needs a directional or spot light in the scene. |
384
+ | Pixelated picture | `quality.pixelRatio: 2`. Jagged edges: `effects.antialias`. Blurry floors: `quality.anisotropy`. |
385
+ | Lens | `effects`: `ao` on; `bloom` only when something is brighter than white, strength under 0.3; `vignette` under 0.35; `grain` under 0.2. More than that reads as a filter. |
386
+
387
+ 5. Read `notes` in every result. It lists what the page could not do: an effect that needs the
388
+ dev bridge, a value that needs `MeshPhysicalMaterial`, a shape that cannot be bevelled.
389
+ Fix those in the source, do not retry.
390
+ 6. Lens effects run with the project's own three.js, through the dev bridge. When they are
391
+ locked, offer to add it: `depthview-r3f-bridge` as a dev dependency, and `depthviewVite()`
392
+ from `depthview-r3f-bridge/vite` in the Vite `plugins`. Ask before installing. It only
393
+ exists in the dev server.
394
+ 7. When the developer says it looks right, `save_look` writes `src/depthview-look.json`. Its
395
+ `usage` is the code that applies it (three >= 0.160):
396
+ - React Three Fiber: `<DepthviewLook look={look} />` from `depthview-r3f-bridge/look/react`,
397
+ inside `<Canvas>`.
398
+ - Plain three.js: `const applied = applyLook({ renderer, scene, camera }, look)` from
399
+ `depthview-r3f-bridge/look`, then `applied.render()` in place of `renderer.render(...)`.
400
+
401
+ Surfaces and bevels are matched by object **name**: give those objects a name in the source
402
+ first. Ask before replacing the developer's own lighting or effect code. `depthview-r3f-bridge`
403
+ must then be a normal dependency, not a dev one.
404
+
405
+ ### Frame rate is part of realism
406
+
407
+ A look that drops frames is worse than a plain scene. `get_realism` reports `performance`:
408
+ `fps` with the look on and `siteFps` without it, measured on the developer's machine with the
409
+ inspector open (compare the two with each other, not with 60).
410
+
411
+ - When the look costs more than a fifth of the site's frame rate, the check raises a
412
+ `performance` issue. `measure_look_cost` switches each heavy part off in turn and reports
413
+ the milliseconds it adds: full resolution, shadows, smooth edges, ambient occlusion, bloom,
414
+ depth of field, bevels.
415
+ - `lighten_look` steps the look down in a fixed order (shadow detail, pixel ratio, depth of
416
+ field, ambient occlusion, bloom, smooth edges) until the frame rate is back. World lighting,
417
+ tone mapping, bevels and surfaces are never given up: they cost nothing per frame.
418
+ - Before saving, set `performance: { adaptive: true }` with `set_look`: the saved look then
419
+ takes the same steps by itself on a device that cannot hold `targetFps` (30, 45 or 60).
420
+
421
+ ### Fine detail without geometry
422
+
423
+ `set_surface` with `detail: { pattern, strength, scale, text }` draws relief into a generated
424
+ normal map: `brushed` (a brushed-metal finish), `rings` (concentric grooves, for a coin or a
425
+ dial), `hammered`, `knurl` (a tool grip), `text` (engraved around the centre, like the legend
426
+ of a coin). It costs one texture, no triangles, and stays sharp when the camera is close. The
427
+ object needs UV coordinates. Keep `brushed` under 0.3: more reads as scratches. `detail: null`
428
+ takes it off.
429
+
430
+ ### Real models and textures
431
+
432
+ When the scene needs shapes or surfaces that primitives cannot give, use the free library
433
+ (Poly Haven, CC0: no attribution, fine for commercial work):
434
+
435
+ 1. `find_assets` with `type` `model`, `texture` or `hdri` and a few words. Show the developer
436
+ the candidates (each has a `page` with pictures) and let them choose.
437
+ 2. `import_asset` downloads it into `public/assets/<id>/` and returns `usage`: the code that
438
+ loads it. Start at `resolution: "1k"`; it refuses anything over the size budget instead of
439
+ bloating the page. Ask first: it writes files.
440
+ 3. Add the code where the scene is built, name the meshes you will tune, reload, screenshot.
441
+ 4. `adapt_model` with the model's name (see below), then `get_performance`. If `notes` gives a
442
+ `gltf-transform` command for a large model, offer to run it.
443
+
444
+ ### Fitting a new model into the scene
445
+
446
+ A model dropped into a tuned scene usually looks pasted in: no shadow, wrong size, floating,
447
+ washed-out textures. `adapt_model` measures it on the live page and fixes what the numbers
448
+ decide:
449
+
450
+ - soft shadows on, every mesh casting and receiving, the shadow area fitted to the scene
451
+ - texture colour spaces (colour maps sRGB, normal and roughness maps plain numbers)
452
+ - anisotropic filtering, and a studio world when there was nothing to reflect
453
+ - depth-of-field focus at the model, ambient-occlusion radius at the size of the scene
454
+ - reflections turned down when the model clips to white on screen and the scene does not
455
+ - the look lightened when the frame rate dropped
456
+
457
+ What depends on intent comes back as `advice`, with the measurement:
458
+
459
+ - `gap`: how far the model floats above (or is sunk into) the surface under it, measured
460
+ against that surface's triangles. `adapt_model { name, ground: true }` sets it down.
461
+ - `relativeSize`: its size against the other models. Twenty times off is usually a unit
462
+ mismatch. `adapt_model { name, scale: 0.01 }` fixes it. The real size is not in the file.
463
+ - Basic, Lambert or Phong materials, triangle count and texture size: fix in the code or
464
+ with the `gltf-transform` command given.
465
+
466
+ Tell the developer the numbers and ask before scaling or grounding: a model can be meant to
467
+ float. A model is a top-level object of the scene, so give it a name in the code. The saved
468
+ look keeps the fit, and fits itself again when models finish loading on the real site
469
+ (`adapt.follow`, on by default).
470
+
471
+ ### Matching a reference picture
472
+
473
+ When the developer shows a picture of the look they want (a screenshot of another site, a
474
+ render), put it in the project or have them drop it into Realism > Match a reference, then
475
+ `compare_to_reference`. It returns `match` and the `differences`, biggest first: brightness,
476
+ contrast, shadow depth, highlights, warmth, saturation, vignette, sharpness. Each has `advice`
477
+ and, where the look can close the gap, a `patch` for `set_look`. Apply one, compare again
478
+ (no `file` needed), and stop when `match` stops rising. It measures light and colour, not
479
+ shapes: judge composition and materials yourself with `take_screenshot`. Learn from a
480
+ reference; do not copy another site's models, textures or code.
481
+
482
+ ### Starting from nothing
483
+
484
+ `create_scene` writes a working starter into the project: `product-hero` (one product on a
485
+ pedestal, the camera moving around it on scroll) or `scroll-journey` (three stations and a
486
+ camera that travels between them), as `r3f` or plain `three`. It makes the scene file,
487
+ `look.json`, `camera-path.json` and returns `mount`, the code that puts it on a page. Use it
488
+ instead of writing a first scene by hand, then replace the placeholder objects and tune. The
489
+ `new-scene` prompt walks through it.
490
+
491
+ The developer has the same controls in the inspector's **Realism** tab and may change them
492
+ while you work: call `get_realism` again before you build on an earlier result.
493
+ `set_look` with `reset: true` puts the site back.
494
+
495
+ ### The site's own controls
496
+
497
+ For values the developer will keep tuning (a roughness, a light's strength, a speed), declare
498
+ them in the code where they are used:
499
+
500
+ ```ts
501
+ import { depthviewControls } from 'depthview-r3f-bridge/controls';
502
+
503
+ const coin = depthviewControls('Coin', {
504
+ roughness: { value: 0.32, min: 0, max: 1 },
505
+ spin: true,
506
+ tint: '#c9ccd1',
507
+ });
508
+ // read coin.roughness where the scene uses it (it is updated in place)
509
+ ```
510
+
511
+ In React: `useDepthviewControls('Coin', {...})` from `depthview-r3f-bridge/controls/react`; the
512
+ component renders again when a value changes. They appear in the inspector under Realism >
513
+ Your site's controls, named after the group. `get_site_controls` lists them,
514
+ `set_site_control` changes one live (the site's own code reacts), and `save_site_controls`
515
+ writes changed values back into that call: only the literal changes. Without the inspector the
516
+ values are the ones in the code; nothing is added to the production site.
517
+
141
518
  ## Shaders
142
519
 
143
520
  1. `get_shader` shows the GLSL that runs, with line numbers. When `kind` is `"compiled"` it is
@@ -149,10 +526,130 @@ costs, `remove_object` it, measure, then `reset_changes`.
149
526
  at once, so nothing stays broken: fix and send again.
150
527
  4. When it compiles and a `take_screenshot` looks right, write the same source into the file.
151
528
 
152
- Only `ShaderMaterial` and `RawShaderMaterial` can be replaced (`canBeReplaced` in `get_shader`).
153
- Built-in materials are changed through their properties, or in source with `onBeforeCompile`.
154
- New uniforms cannot be added live: add them in the source. Existing ones are set with
155
- `set_value` and the path `uniform.<name>`.
529
+ Only `ShaderMaterial` and `RawShaderMaterial` can be replaced whole (`canBeReplaced` in
530
+ `get_shader`). Existing uniforms are set with `set_value` and the path `uniform.<name>`.
531
+
532
+ ### Built-in materials: `patch_shader`
533
+
534
+ A `MeshStandardMaterial` (or Physical, Basic, Lambert...) keeps its lighting, shadows and
535
+ reflections while you inject GLSL into the shader three.js generates for it: what
536
+ `onBeforeCompile` does in source. Use it for vertex displacement, wind, a fresnel rim, a
537
+ dissolve or reveal, colour by height.
538
+
539
+ ```json
540
+ {
541
+ "name": "Rock",
542
+ "patches": [
543
+ {
544
+ "stage": "vertex",
545
+ "find": "#include <common>",
546
+ "replace": "#include <common>\nuniform float uTime;\nuniform float uAmount;"
547
+ },
548
+ {
549
+ "stage": "vertex",
550
+ "find": "#include <begin_vertex>",
551
+ "replace": "#include <begin_vertex>\n transformed += normal * sin(position.y * 6.0 + uTime * 3.0) * uAmount;"
552
+ }
553
+ ],
554
+ "uniforms": { "uAmount": 0.1 }
555
+ }
556
+ ```
557
+
558
+ - Each patch replaces one piece of the shader, usually an `#include <...>` line with itself
559
+ plus your code. The `shaders` guide lists the anchors and what each lets you change.
560
+ - Declare new uniforms by patching `#include <common>`. `uTime` (seconds) is filled in for
561
+ you; give the others in `uniforms` (a number, 2 to 4 numbers, or `"#rrggbb"` for a vec3).
562
+ - Send the whole list each time: it replaces the previous patch. `patches: []` removes it.
563
+ - A patch that does not compile, or whose `find` is not in the shader, is taken out again and
564
+ reported (`errors`, `missed`).
565
+ - The result has `onBeforeCompile`: the same patch as source for the project. It is live only
566
+ until that is written into the file.
567
+
568
+ ## Effects: particles, smoke, clouds, fog, your own shaders
569
+
570
+ `add_effect` puts an effect into the live scene, built from the site's own three.js and sized
571
+ to the scene. `list_effects` gives every preset and every uniform with its range.
572
+
573
+ | Kind | Presets | What it is |
574
+ | ----------- | ------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
575
+ | `particles` | `dust`, `snow`, `embers`, `fireflies`, `rain`, `stars`, `galaxy`, `swarm` | Camera-facing sprites drifting through a box, wrapping round. No simulation: cheap, and deterministic for screenshots |
576
+ | `smoke` | `smoke`, `steam`, `ground-mist`, `fire` | Rising puffs shaped by noise, growing and fading over their life |
577
+ | `clouds` | `cumulus`, `overcast`, `wisps`, `sunset` | A ray-marched volume in a box, lit from a direction |
578
+ | `fog` | `ground-fog`, `haze` | The same volume, thin and low |
579
+ | `shader` | `water`, `aurora`, `hologram`, `shield`, `light-shaft`, `backdrop` | Ready-made shader objects: a rippling reflective surface; a curtain of light; glowing spheres to scale around an object; a cone of light (its point at the lamp); a drifting gradient with grain behind the whole scene |
580
+ | `custom` | | Your own vertex and fragment GLSL on a `plane`, `box`, `sphere`, `sprites` or full-`screen` triangle |
581
+
582
+ `swarm` is thousands of sprites that flow between a sphere, a ring and a box: drive its
583
+ `uShape` (0 to 3) from scroll or time in the source for a shape-forming particle transition.
584
+ Every preset is a starting point for your own: `get_effect_code` gives its full GLSL, and
585
+ `set_effect` with `vertex` / `fragment` replaces it live. `list_effects` and
586
+ `get_effect_code { kind, preset }` need no page at all.
587
+
588
+ The loop is the same as for everything else: add, look, tune, measure, write.
589
+
590
+ 1. `describe_scene` for the scale, then `add_effect { kind, preset }`. It lands where the
591
+ camera looks (clouds: above that); `position` and `scale` (the size of its box) place it.
592
+ Particles, clouds and fog fill a box centred on `position`. Smoke rises **from**
593
+ `position`, `scale.y` high: put it on the thing that smokes. Fog belongs on the ground:
594
+ `position.y` = the floor's height (`get_object` on the floor gives `worldBounds`) plus half
595
+ of `scale.y`. Both are ordinary values afterwards: `set_value` with `position` or `scale`,
596
+ or the developer drags it.
597
+ 2. `take_screenshot view:"site"`, then `set_effect { uuid, uniforms: {...} }` with only the
598
+ uniforms to change, one kind of change per step. `count` changes the number of sprites.
599
+ 3. **Keep it subtle.** An effect is noticed second, after the subject. Dust: a few hundred
600
+ sprites at low opacity. Smoke: opacity 0.15 to 0.4. Clouds and fog may sit around the
601
+ subject when the result says `sceneDepth: true`; keep them clear of it otherwise.
602
+ 4. Point a volume's `uLightDir` at the scene's key light (its position from
603
+ `describe_scene`), and take `uLightColor` / `uShadowColor` from the scene's light and
604
+ shadow colours, or the cloud is lit from somewhere else than everything around it.
605
+ 5. `get_performance` before and after. More than a fifth of the frame rate: fewer sprites,
606
+ lower `uSteps`, a smaller box on screen. Volumes are the costliest thing a page can draw.
607
+ 6. When the developer says it is right: `get_effect_code { uuid, format: "r3f" | "three" }`
608
+ returns a self-contained file (shaders, geometry, material, per-frame update) with the
609
+ tuned values and its place in the scene. Write it into the project, mount it, then
610
+ `reset_changes` to take the live one away. `get_changes` lists live effects under
611
+ `effects`: they are never written automatically.
612
+
613
+ ### Writing your own (`kind: "custom"`, or `set_effect` with `vertex` / `fragment`)
614
+
615
+ Write the shaders as for a three.js `ShaderMaterial`:
616
+
617
+ - `position`, `normal`, `uv`, `modelMatrix`, `modelViewMatrix`, `projectionMatrix`,
618
+ `viewMatrix`, `normalMatrix` and `cameraPosition` are declared for you. No `#version` and no
619
+ `precision` line. Write `gl_FragColor`, `varying`, `attribute`, `texture2D`.
620
+ - End the fragment shader with `#include <tonemapping_fragment>` and
621
+ `#include <colorspace_fragment>`, or it will not match the rest of the scene.
622
+ - Declare `uniform float uTime;` (seconds, follows `set_time`), `uniform vec2 uResolution;`
623
+ (drawing buffer in pixels) or `uniform vec3 uCameraLocal;` (camera in the object's space)
624
+ and they are filled in every frame. Give every other uniform a value in `uniforms`.
625
+ - `geometry: "sprites"` gives `count` quads with `position` (a random point in the unit box,
626
+ the same for the quad's vertices), `attribute vec2 dvCorner` (-1..1) and
627
+ `attribute vec4 dvSeed` (four random numbers). `"screen"` is one triangle covering the
628
+ screen: `gl_Position = vec4(position.xy, 0.0, 1.0)`.
629
+ - Set `transparent`, `blending` (`normal` / `additive`), `depthWrite`, `depthTest`, `side` to
630
+ match: glow is `additive` with `depthWrite: false`.
631
+ - A shader that does not compile adds nothing (or is put back) and the compiler's errors come
632
+ back: fix and send again. Editing a built-in effect's shader turns it into a custom one.
633
+ - **Textures.** A `sampler2D` uniform takes `{ "texture": "file:public/smoke.png" }` (an
634
+ image in the project: png, jpg or webp, read as colour, v upwards, repeating) or
635
+ `{ "texture": "scene:<uuid>" }` (a texture the page already has; `get_resources` lists them
636
+ with ids).
637
+ - **Noise.** Declare `uniform sampler2D uNoise;` and you get a 256 × 256 tiling noise
638
+ texture. One read gives 3D value noise (see `dvNoise` in the clouds shader from
639
+ `get_effect_code { kind: "clouds" }`): use it in any loop instead of computed noise.
640
+ - **Scene depth.** Declare `uniform sampler2D uDepth; uniform float uHasDepth;` (and
641
+ `uniform vec2 uResolution;`) to read the depth of the solid scene behind the pixel at
642
+ `gl_FragCoord.xy / uResolution`, valid while `uHasDepth > 0.5`. That is how the built-in
643
+ clouds and fog stop at the objects inside them and smoke fades where it meets a floor.
644
+ `uniform mat4 uDepthToLocal;` turns `vec4(screen * 2.0 - 1.0, depth * 2.0 - 1.0, 1.0)` into
645
+ the object's own space (divide by w). The result of `add_effect` says `sceneDepth: true`
646
+ when the page could provide it; when it is false the effect draws as if nothing were there.
647
+
648
+ In the written code the depth is an option you pass in (`depth` prop, or the second argument
649
+ of `update`): drei's `useDepthBuffer()` or your render target's `depthTexture`, at the size of
650
+ the canvas. Without it the effect ignores what it touches. Still for the source only: half
651
+ resolution for large volumes (the `volumetrics` guide). The `effect` prompt walks through
652
+ adding one.
156
653
 
157
654
  ## Adding and removing objects
158
655
 
@@ -166,7 +663,7 @@ New uniforms cannot be added live: add them in the source. Existing ones are set
166
663
  source location when known; delete the element there to remove it for good.
167
664
 
168
665
  All of this is live only and gone after a reload. `reset_changes` puts added, removed and
169
- re-shaded things back.
666
+ re-shaded things back, and takes effects and shader patches out again.
170
667
 
171
668
  ## 4. Write it into the source
172
669
 
@@ -274,36 +771,68 @@ is no file), and change only that value. The rules below apply the same way.
274
771
 
275
772
  ## Tools
276
773
 
277
- | Tool | Use |
278
- | ----------------------- | -------------------------------------------------------------- |
279
- | `get_status` | Connected? Which page, what is selected, how many changes |
280
- | `get_pairing_code` | The code to type into the inspector (stdio mode only) |
281
- | `find_objects` | Search the live scene |
282
- | `describe_scene` | Scene scale, camera focus, camera, lights, counts: call first |
283
- | `get_object` | All values of one object, editable paths, bounds, source |
284
- | `get_scene_snapshot` | The whole scene tree as JSON (large; prefer `find_objects`) |
285
- | `take_screenshot` | See the result: `site`, `scene`, inspector; `compare` for both |
286
- | `get_performance` | Frame rate, frame time, draw calls, triangles, passes |
287
- | `get_resources` | Textures, geometries, materials by GPU memory |
288
- | `get_errors` | Uncaught errors, console errors and warnings, failed shaders |
289
- | `get_lighting` | Lights, shadow set-up, and the problems found |
290
- | `get_animated_values` | Which values the site's code drives over time or on scroll |
291
- | `get_camera_path` | Where the site camera is along the scroll |
292
- | `get_shader` | The GLSL that runs, with line numbers and uniforms |
293
- | `set_shader` | Try a new shader live; compile errors come back |
294
- | `set_value` | Change one value on the live page |
295
- | `set_values` | Change several values at once, one undo step |
296
- | `add_object` | Add a copy, a primitive, a group or a light; returns its JSX |
297
- | `remove_object` | Take an object out of the live scene |
298
- | `set_scroll` | Scroll the site to a position |
299
- | `set_time` | Hold, step or release the site's animation |
300
- | `set_viewport` | Resize the window, set the pixel ratio; `reset: true` to undo |
301
- | `select_object` | Show the developer which object you mean |
302
- | `undo_change` | Take back the latest value change |
303
- | `reset_changes` | Put everything back: values, objects, shaders |
304
- | `get_changes` | Everything that differs from the loaded page, with source info |
305
- | `apply_changes_to_code` | Write all value changes into the source |
306
- | `list_pending_edits` | Edits the server could not apply exactly |
307
- | `get_edit_context` | Source around a queued edit, and why it was queued |
308
- | `apply_edit` | Apply a queued edit, optionally with your own expression |
309
- | `mark_edit_done` | Report an edit you made with your own tools |
774
+ | Tool | Use |
775
+ | ----------------------- | ---------------------------------------------------------------- |
776
+ | `get_status` | Connected? Which page, what is selected, how many changes |
777
+ | `open_preview` | Open the page in a headless browser: work without the extension |
778
+ | `close_preview` | Close that browser |
779
+ | `get_pairing_code` | The code to type into the inspector (stdio mode only) |
780
+ | `find_objects` | Search the live scene |
781
+ | `describe_scene` | Scene scale, camera focus, camera, lights, counts: call first |
782
+ | `get_object` | All values of one object, editable paths, bounds, source |
783
+ | `get_scene_snapshot` | The whole scene tree as JSON (large; prefer `find_objects`) |
784
+ | `take_screenshot` | See the result: `site`, `scene`, inspector; `compare` for both |
785
+ | `get_performance` | Frame rate, frame time, draw calls, triangles, passes |
786
+ | `get_resources` | Textures, geometries, materials by GPU memory |
787
+ | `get_errors` | Uncaught errors, console errors and warnings, failed shaders |
788
+ | `get_lighting` | Lights, shadow set-up, and the problems found |
789
+ | `get_animated_values` | Which values the site's code drives over time or on scroll |
790
+ | `get_camera_views` | The view on load and per section: pose, hold, changed |
791
+ | `set_camera_view` | Set a view: frame an object, exact pose, or the developer's view |
792
+ | `get_camera_path` | Where the site camera is along the scroll |
793
+ | `edit_camera_path` | Edit the scroll path: start, move/add/remove keys, preview |
794
+ | `get_camera_path_edit` | The edited path: keys, what changed, JSON and code |
795
+ | `save_camera_path` | Write the path into the project as camera-path.json |
796
+ | `get_realism` | Realism score, what is missing, and the current look |
797
+ | `fix_realism` | Apply the one-click realism fixes live |
798
+ | `set_look` | Tune colour, world lighting, shadows, bevels, lens effects |
799
+ | `set_surface` | What one object is made of: a preset or single values |
800
+ | `measure_look_cost` | Frame time each part of the look costs |
801
+ | `lighten_look` | Step the look down until the frame rate is back |
802
+ | `adapt_model` | Fit the look to a new model; measure its size and grounding |
803
+ | `compare_to_reference` | Differences from a reference picture, with a fix for each |
804
+ | `find_assets` | Search free CC0 models, textures and lighting panoramas |
805
+ | `import_asset` | Download one into the project, with the code that loads it |
806
+ | `create_scene` | Write a working starter scene into the project |
807
+ | `save_look` | Write the look into the project as depthview-look.json |
808
+ | `get_site_controls` | Controls the site declares with depthviewControls |
809
+ | `set_site_control` | Change one of the site's own controls live |
810
+ | `save_site_controls` | Write changed control values back into the source |
811
+ | `get_shader` | The GLSL that runs, with line numbers and uniforms |
812
+ | `set_shader` | Try a new shader live; compile errors come back |
813
+ | `patch_shader` | Inject GLSL into a built-in material; returns onBeforeCompile |
814
+ | `list_effects` | Effect kinds, presets, and every uniform with its range |
815
+ | `add_effect` | Add particles, smoke, clouds, fog or a custom shader object |
816
+ | `set_effect` | Tune an effect: uniforms, count, blending, shader source |
817
+ | `get_effect_code` | The effect as an R3F component or three.js module |
818
+ | `audit_visuals` | Find visual bugs from the set-up and the pixels of a frame |
819
+ | `audit_camera_motion` | Judge the scroll-driven camera: jumps, reversals, pacing, roll |
820
+ | `review_site` | Design review: a picture of every scroll stop and its faults |
821
+ | `three_docs` | three.js docs for the installed version; manual pages |
822
+ | `get_guide` | The reference guides, when the files cannot be read |
823
+ | `set_value` | Change one value on the live page |
824
+ | `set_values` | Change several values at once, one undo step |
825
+ | `add_object` | Add a copy, a primitive, a group or a light; returns its JSX |
826
+ | `remove_object` | Take an object out of the live scene |
827
+ | `set_scroll` | Scroll the site to a position |
828
+ | `set_time` | Hold, step or release the site's animation |
829
+ | `set_viewport` | Resize the window, set the pixel ratio; `reset: true` to undo |
830
+ | `select_object` | Show the developer which object you mean |
831
+ | `undo_change` | Take back the latest value change |
832
+ | `reset_changes` | Put everything back: values, objects, shaders |
833
+ | `get_changes` | Everything that differs from the loaded page, with source info |
834
+ | `apply_changes_to_code` | Write all value changes into the source |
835
+ | `list_pending_edits` | Edits the server could not apply exactly |
836
+ | `get_edit_context` | Source around a queued edit, and why it was queued |
837
+ | `apply_edit` | Apply a queued edit, optionally with your own expression |
838
+ | `mark_edit_done` | Report an edit you made with your own tools |