@null3d/engine 0.0.0 → 0.1.1

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.
Files changed (517) hide show
  1. package/README.md +109 -0
  2. package/THIRD-PARTY-NOTICES.txt +0 -1
  3. package/dist/wasm/single/null3d.js +25 -10
  4. package/dist/wasm/single/null3d_bg.wasm +0 -0
  5. package/dist/wasm/threaded/null3d.js +25 -10
  6. package/dist/wasm/threaded/null3d_bg.wasm +0 -0
  7. package/docs/api/animation.md +114 -86
  8. package/docs/api/assets.md +135 -49
  9. package/docs/api/cameras.md +45 -12
  10. package/docs/api/controls.md +88 -62
  11. package/docs/api/debug.md +116 -41
  12. package/docs/api/engine.md +117 -35
  13. package/docs/api/feature-draws.md +23 -17
  14. package/docs/api/feature-effects.md +11 -11
  15. package/docs/api/feature-instances.md +70 -19
  16. package/docs/api/features.md +77 -47
  17. package/docs/api/geometry.md +132 -82
  18. package/docs/api/grass.md +55 -13
  19. package/docs/api/impostors.md +175 -22
  20. package/docs/api/input.md +24 -18
  21. package/docs/api/lights.md +78 -51
  22. package/docs/api/lines.md +41 -33
  23. package/docs/api/materials.md +248 -121
  24. package/docs/api/math.md +12 -13
  25. package/docs/api/objects.md +47 -22
  26. package/docs/api/page.md +58 -7
  27. package/docs/api/particles.md +33 -20
  28. package/docs/api/points.md +19 -31
  29. package/docs/api/post.md +75 -42
  30. package/docs/api/quality.md +42 -17
  31. package/docs/api/raycast.md +65 -51
  32. package/docs/api/reference/animation.md +10 -11
  33. package/docs/api/reference/assets.md +25 -22
  34. package/docs/api/reference/cameras.md +8 -4
  35. package/docs/api/reference/controls.md +134 -25
  36. package/docs/api/reference/debug.md +81 -14
  37. package/docs/api/reference/engine.md +58 -17
  38. package/docs/api/reference/feature-draws.md +3 -4
  39. package/docs/api/reference/feature-effects.md +2 -3
  40. package/docs/api/reference/feature-instances.md +5 -4
  41. package/docs/api/reference/features.md +7 -4
  42. package/docs/api/reference/geometry.md +287 -97
  43. package/docs/api/reference/grass.md +63 -3
  44. package/docs/api/reference/impostors.md +208 -13
  45. package/docs/api/reference/input.md +4 -5
  46. package/docs/api/reference/lights.md +13 -12
  47. package/docs/api/reference/lines.md +10 -11
  48. package/docs/api/reference/materials.md +54 -53
  49. package/docs/api/reference/math.md +35 -24
  50. package/docs/api/reference/objects.md +11 -12
  51. package/docs/api/reference/particles.md +31 -6
  52. package/docs/api/reference/points.md +6 -7
  53. package/docs/api/reference/post.md +21 -20
  54. package/docs/api/reference/quality.md +8 -5
  55. package/docs/api/reference/raycast.md +7 -8
  56. package/docs/api/reference/render.md +5 -4
  57. package/docs/api/reference/scene.md +52 -30
  58. package/docs/api/reference/sketch.md +15 -11
  59. package/docs/api/reference/sound.md +234 -0
  60. package/docs/api/reference/splats.md +42 -3
  61. package/docs/api/reference/sprites.md +7 -8
  62. package/docs/api/reference/tasks.md +16 -3
  63. package/docs/api/reference/terrain.md +27 -5
  64. package/docs/api/reference/textures.md +5 -6
  65. package/docs/api/reference/three-compat.md +18 -7
  66. package/docs/api/reference/time.md +1 -2
  67. package/docs/api/reference/ui.md +12 -9
  68. package/docs/api/reference/vertex-draws.md +5 -6
  69. package/docs/api/reference/water.md +153 -9
  70. package/docs/api/reference/wind.md +17 -4
  71. package/docs/api/render.md +73 -29
  72. package/docs/api/scene.md +164 -60
  73. package/docs/api/sketch.md +102 -15
  74. package/docs/api/sound.md +205 -0
  75. package/docs/api/splats.md +46 -12
  76. package/docs/api/sprites.md +10 -24
  77. package/docs/api/tasks.md +33 -24
  78. package/docs/api/terrain.md +42 -22
  79. package/docs/api/textures.md +68 -19
  80. package/docs/api/three-compat.md +15 -7
  81. package/docs/api/time.md +3 -5
  82. package/docs/api/ui.md +19 -23
  83. package/docs/api/vertex-draws.md +13 -12
  84. package/docs/api/water.md +262 -35
  85. package/docs/api/wind.md +63 -17
  86. package/docs/cli/null3d.md +177 -27
  87. package/docs/concepts/architecture.md +73 -27
  88. package/docs/concepts/assets.md +57 -33
  89. package/docs/concepts/backends.md +69 -27
  90. package/docs/concepts/color-management.md +54 -36
  91. package/docs/concepts/culling.md +68 -47
  92. package/docs/concepts/handles.md +14 -5
  93. package/docs/concepts/instances.md +74 -25
  94. package/docs/concepts/large-worlds.md +18 -8
  95. package/docs/concepts/lighting.md +155 -87
  96. package/docs/concepts/lod.md +126 -44
  97. package/docs/concepts/materials.md +58 -27
  98. package/docs/concepts/particle-buffer.md +48 -35
  99. package/docs/concepts/post-processing.md +84 -43
  100. package/docs/concepts/quality-preset-tables.md +56 -52
  101. package/docs/concepts/quality-presets.md +164 -52
  102. package/docs/concepts/render-graph.md +69 -29
  103. package/docs/concepts/render-layers.md +11 -21
  104. package/docs/concepts/shadows.md +105 -52
  105. package/docs/concepts/static-dynamic.md +22 -7
  106. package/docs/cookbook/index.md +164 -120
  107. package/docs/data/threejs-mapping.json +362 -367
  108. package/docs/errors/E1101.md +23 -5
  109. package/docs/errors/E1102.md +11 -3
  110. package/docs/errors/E1103.md +11 -3
  111. package/docs/errors/E1104.md +11 -3
  112. package/docs/errors/E1105.md +13 -5
  113. package/docs/errors/E1106.md +11 -3
  114. package/docs/errors/E1107.md +15 -5
  115. package/docs/errors/E1108.md +11 -3
  116. package/docs/errors/E1109.md +32 -6
  117. package/docs/errors/E1110.md +23 -5
  118. package/docs/errors/E1111.md +11 -3
  119. package/docs/errors/E1112.md +11 -3
  120. package/docs/errors/E1203.md +12 -4
  121. package/docs/errors/E1204.md +11 -3
  122. package/docs/errors/E1205.md +11 -3
  123. package/docs/errors/E1206.md +28 -6
  124. package/docs/errors/E1207.md +11 -3
  125. package/docs/errors/E1208.md +12 -3
  126. package/docs/errors/E1209.md +11 -3
  127. package/docs/errors/E1213.md +27 -5
  128. package/docs/errors/E1214.md +14 -6
  129. package/docs/errors/E1215.md +31 -6
  130. package/docs/errors/E1216.md +31 -6
  131. package/docs/errors/E1217.md +29 -6
  132. package/docs/errors/E1218.md +22 -6
  133. package/docs/errors/E1219.md +11 -3
  134. package/docs/errors/E1220.md +24 -5
  135. package/docs/errors/E1221.md +24 -5
  136. package/docs/errors/E1222.md +11 -3
  137. package/docs/errors/E1223.md +39 -6
  138. package/docs/errors/E1224.md +11 -3
  139. package/docs/errors/E1225.md +11 -3
  140. package/docs/errors/E1301.md +11 -3
  141. package/docs/errors/E1302.md +11 -3
  142. package/docs/errors/E1303.md +11 -3
  143. package/docs/errors/E1304.md +11 -3
  144. package/docs/errors/E1305.md +13 -3
  145. package/docs/errors/E1306.md +11 -3
  146. package/docs/errors/E1307.md +40 -0
  147. package/docs/errors/E1401.md +11 -3
  148. package/docs/errors/E1402.md +13 -5
  149. package/docs/errors/E1403.md +11 -3
  150. package/docs/errors/E1404.md +13 -3
  151. package/docs/errors/E1405.md +15 -4
  152. package/docs/errors/E1406.md +31 -5
  153. package/docs/errors/E1407.md +11 -3
  154. package/docs/errors/E1408.md +11 -3
  155. package/docs/errors/E1409.md +11 -3
  156. package/docs/errors/E1410.md +13 -5
  157. package/docs/errors/E1411.md +11 -3
  158. package/docs/errors/E1412.md +29 -6
  159. package/docs/errors/E1413.md +11 -3
  160. package/docs/errors/E1414.md +11 -3
  161. package/docs/errors/E1415.md +11 -3
  162. package/docs/errors/E1416.md +27 -6
  163. package/docs/errors/E1417.md +11 -3
  164. package/docs/errors/E1418.md +12 -3
  165. package/docs/errors/E1419.md +13 -5
  166. package/docs/errors/E1420.md +14 -6
  167. package/docs/errors/E1421.md +11 -3
  168. package/docs/errors/E1422.md +12 -3
  169. package/docs/errors/E1423.md +12 -3
  170. package/docs/errors/E1424.md +24 -5
  171. package/docs/errors/E1425.md +11 -3
  172. package/docs/errors/E1426.md +11 -3
  173. package/docs/errors/E1430.md +11 -3
  174. package/docs/errors/E1431.md +11 -3
  175. package/docs/errors/E1432.md +11 -3
  176. package/docs/errors/E1433.md +11 -3
  177. package/docs/errors/E1434.md +15 -6
  178. package/docs/errors/E1435.md +11 -3
  179. package/docs/errors/E1436.md +11 -3
  180. package/docs/errors/E1437.md +14 -6
  181. package/docs/errors/E1501.md +41 -6
  182. package/docs/errors/E1502.md +13 -3
  183. package/docs/errors/E1503.md +11 -3
  184. package/docs/errors/E1504.md +11 -3
  185. package/docs/errors/E1505.md +23 -5
  186. package/docs/errors/E1506.md +11 -3
  187. package/docs/errors/index.md +54 -30
  188. package/docs/getting-started/cdn.md +32 -10
  189. package/docs/getting-started/first-scene.md +21 -13
  190. package/docs/getting-started/hosting.md +152 -63
  191. package/docs/getting-started/install.md +44 -28
  192. package/docs/getting-started/network-use.md +33 -15
  193. package/docs/getting-started/project-structure.md +33 -12
  194. package/docs/getting-started/third-party-notices.md +12 -14
  195. package/docs/guides/accessibility.md +5 -5
  196. package/docs/guides/add-ons.md +86 -15
  197. package/docs/guides/agents.md +16 -9
  198. package/docs/guides/assets-pipeline.md +259 -82
  199. package/docs/guides/audio.md +115 -128
  200. package/docs/guides/baked-light-data.md +44 -23
  201. package/docs/guides/car-paint.md +38 -32
  202. package/docs/guides/content-pages.md +63 -35
  203. package/docs/guides/custom-passes.md +65 -22
  204. package/docs/guides/custom-shaders.md +59 -39
  205. package/docs/guides/debugging.md +74 -10
  206. package/docs/guides/deploying.md +85 -6
  207. package/docs/guides/deterministic-simulation.md +24 -17
  208. package/docs/guides/first-use-shaders.md +83 -45
  209. package/docs/guides/lens-kit.md +29 -26
  210. package/docs/guides/loading-screens.md +132 -47
  211. package/docs/guides/multiple-views.md +63 -13
  212. package/docs/guides/performance.md +192 -38
  213. package/docs/guides/phones.md +78 -15
  214. package/docs/guides/physics.md +7 -11
  215. package/docs/guides/screens.md +47 -33
  216. package/docs/guides/start-time.md +363 -0
  217. package/docs/guides/testing.md +152 -95
  218. package/docs/guides/ui-overlays.md +19 -14
  219. package/docs/guides/video-textures.md +14 -13
  220. package/docs/images/api/animation/character.webp +0 -0
  221. package/docs/images/api/animation/look-at-ring.webp +0 -0
  222. package/docs/images/api/animation/morph-tulips.webp +0 -0
  223. package/docs/images/api/animation/skeleton-lines.webp +0 -0
  224. package/docs/images/api/controls/gizmo-handles.webp +0 -0
  225. package/docs/images/api/controls/walk-and-fly.webp +0 -0
  226. package/docs/images/api/debug/debug-shapes.webp +0 -0
  227. package/docs/images/api/debug/levels-view.webp +0 -0
  228. package/docs/images/api/engine/transparent-canvas.webp +0 -0
  229. package/docs/images/api/feature-draws/feature-draw-clouds.webp +0 -0
  230. package/docs/images/api/feature-instances/compute-instances.webp +0 -0
  231. package/docs/images/api/feature-instances/instances-shadow.webp +0 -0
  232. package/docs/images/api/geometry/extra-shapes.webp +0 -0
  233. package/docs/images/api/geometry/generators.webp +0 -0
  234. package/docs/images/api/geometry/mesh-arrays.webp +0 -0
  235. package/docs/images/api/geometry/vertex-updates.webp +0 -0
  236. package/docs/images/api/grass/grass-grove.webp +0 -0
  237. package/docs/images/api/grass/grass-presets.webp +0 -0
  238. package/docs/images/api/grass/grass-shadow.webp +0 -0
  239. package/docs/images/api/impostors/impostor-handover.webp +0 -0
  240. package/docs/images/api/impostors/impostor-shadow.webp +0 -0
  241. package/docs/images/api/impostors/impostors-forest.webp +0 -0
  242. package/docs/images/api/lights/spot-cookies.webp +0 -0
  243. package/docs/images/api/lines/lines-lit.webp +0 -0
  244. package/docs/images/api/lines/lines-widths.webp +0 -0
  245. package/docs/images/api/materials/coat-and-sheen.webp +0 -0
  246. package/docs/images/api/materials/decals.webp +0 -0
  247. package/docs/images/api/materials/iridescence-and-anisotropy.webp +0 -0
  248. package/docs/images/api/materials/relief.webp +0 -0
  249. package/docs/images/api/materials/shader-inputs.webp +0 -0
  250. package/docs/images/api/materials/standard-grid.webp +0 -0
  251. package/docs/images/api/materials/subsurface.webp +0 -0
  252. package/docs/images/api/materials/translucency.webp +0 -0
  253. package/docs/images/api/objects/objects-turntable.webp +0 -0
  254. package/docs/images/api/particles/campfire.webp +0 -0
  255. package/docs/images/api/points/galaxy.webp +0 -0
  256. package/docs/images/api/reference/textures/texture-wrap.webp +0 -0
  257. package/docs/images/api/render/fullscreen-glow.webp +0 -0
  258. package/docs/images/api/render/reflection-mirror.webp +0 -0
  259. package/docs/images/api/render/security-camera.webp +0 -0
  260. package/docs/images/api/scene/aurora-sky-layer.webp +0 -0
  261. package/docs/images/api/sound/sound-demo.webp +0 -0
  262. package/docs/images/api/splats/splats-demo.webp +0 -0
  263. package/docs/images/api/sprites/sprites-lines.webp +0 -0
  264. package/docs/images/api/terrain/terrain-demo.webp +0 -0
  265. package/docs/images/api/textures/canvas-screen.webp +0 -0
  266. package/docs/images/api/textures/mipmaps.webp +0 -0
  267. package/docs/images/api/vertex-draws/rain.webp +0 -0
  268. package/docs/images/api/water/ocean.webp +0 -0
  269. package/docs/images/api/water/water-demo.webp +0 -0
  270. package/docs/images/api/water/water-rain.webp +0 -0
  271. package/docs/images/api/water/waterfall.webp +0 -0
  272. package/docs/images/concepts/assets/gltf-model.webp +0 -0
  273. package/docs/images/concepts/color-management/tone-mapped.webp +0 -0
  274. package/docs/images/concepts/culling/far-from-origin.webp +0 -0
  275. package/docs/images/concepts/instances/instances.webp +0 -0
  276. package/docs/images/concepts/instances/per-row-colors.webp +0 -0
  277. package/docs/images/concepts/large-worlds/large-world.webp +0 -0
  278. package/docs/images/concepts/lighting/area-lights.webp +0 -0
  279. package/docs/images/concepts/lighting/atmosphere.webp +0 -0
  280. package/docs/images/concepts/lighting/environment.webp +0 -0
  281. package/docs/images/concepts/lighting/light-shafts.webp +0 -0
  282. package/docs/images/concepts/lighting/reflection-probes.webp +0 -0
  283. package/docs/images/concepts/lod/forest.webp +0 -0
  284. package/docs/images/concepts/materials/weighted-transparency.webp +0 -0
  285. package/docs/images/concepts/post-processing/auto-exposure.webp +0 -0
  286. package/docs/images/concepts/post-processing/bounce-light.webp +0 -0
  287. package/docs/images/concepts/post-processing/depth-of-field.webp +0 -0
  288. package/docs/images/concepts/post-processing/post-effects-alley.webp +0 -0
  289. package/docs/images/concepts/post-processing/sharpen.webp +0 -0
  290. package/docs/images/concepts/post-processing/ssr-wet-street.webp +0 -0
  291. package/docs/images/concepts/render-layers/layers-cottages.webp +0 -0
  292. package/docs/images/concepts/shadows/hero-shadow.webp +0 -0
  293. package/docs/images/cookbook/index/picking.webp +0 -0
  294. package/docs/images/cookbook/index/time-of-day.webp +0 -0
  295. package/docs/images/errors/E1431/area-lights-no-tables.webp +0 -0
  296. package/docs/images/guides/custom-passes/reflection-water.webp +0 -0
  297. package/docs/images/guides/deterministic-simulation/replay-demo.webp +0 -0
  298. package/docs/images/guides/multiple-views/split-screen.webp +0 -0
  299. package/docs/images/guides/performance/overdraw-view.webp +0 -0
  300. package/docs/images/guides/testing/hold-mode-frame.webp +0 -0
  301. package/docs/images/index/showcase-island.webp +0 -0
  302. package/docs/images/porting/threejs-shaders/dissolve.webp +0 -0
  303. package/docs/images/shaders/builtins/builtins.webp +0 -0
  304. package/docs/images/shaders/surface-functions/custom-surface.webp +0 -0
  305. package/docs/images/shaders/surface-functions/vertex-offset.webp +0 -0
  306. package/docs/images/shots.json +2231 -0
  307. package/docs/index.md +18 -23
  308. package/docs/moves.json +1 -0
  309. package/docs/nav.json +300 -0
  310. package/docs/pages.md +230 -209
  311. package/docs/porting/react-three-fiber.md +225 -6
  312. package/docs/porting/threejs-loop-and-threads.md +217 -7
  313. package/docs/porting/threejs-mapping.md +1249 -233
  314. package/docs/porting/threejs-materials.md +218 -6
  315. package/docs/porting/threejs-overview.md +240 -7
  316. package/docs/porting/threejs-postprocessing.md +4 -8
  317. package/docs/porting/threejs-shaders.md +301 -6
  318. package/docs/porting/threejs-unsupported.md +83 -7
  319. package/docs/porting/verification.md +178 -6
  320. package/docs/shaders/builtins.md +15 -4
  321. package/docs/shaders/library.md +72 -45
  322. package/docs/shaders/surface-functions.md +59 -23
  323. package/docs/shaders/wgsl-rules.md +12 -5
  324. package/lib/debug/channel.d.ts +103 -0
  325. package/lib/debug/channel.js +269 -0
  326. package/lib/debug/debug.d.ts +11 -9
  327. package/lib/debug/draw.d.ts +11 -2
  328. package/lib/debug/draw.js +57 -6
  329. package/lib/debug/inspector.d.ts +60 -0
  330. package/lib/debug/inspector.js +475 -0
  331. package/lib/debug/overlay-look.d.ts +6 -0
  332. package/lib/debug/overlay-look.js +29 -7
  333. package/lib/debug/overlay.js +15 -11
  334. package/lib/debug/stats-options.d.ts +13 -0
  335. package/lib/debug/stats-panel.d.ts +22 -7
  336. package/lib/debug/stats-panel.js +80 -13
  337. package/lib/debug/stats.d.ts +2 -3
  338. package/lib/errors/codes.d.ts +17 -3
  339. package/lib/errors/codes.js +117 -105
  340. package/lib/errors/engine-error.js +25 -10
  341. package/lib/errors/fixes.d.ts +1 -0
  342. package/lib/errors/fixes.js +20 -19
  343. package/lib/generated/core.d.ts +1 -1
  344. package/lib/generated/core.js +1 -1
  345. package/lib/gpu/early-builds.d.ts +68 -0
  346. package/lib/gpu/early-builds.js +158 -0
  347. package/lib/gpu/pipeline-name.d.ts +6 -0
  348. package/lib/gpu/pipeline-name.js +23 -0
  349. package/lib/gpu/variants.d.ts +8 -2
  350. package/lib/gpu/variants.js +39 -7
  351. package/lib/gpu/webgl2/backend.d.ts +63 -2
  352. package/lib/gpu/webgl2/backend.js +226 -8
  353. package/lib/gpu/webgl2/programs.d.ts +18 -0
  354. package/lib/gpu/webgl2/programs.js +5 -2
  355. package/lib/gpu/webgpu/backend.d.ts +89 -2
  356. package/lib/gpu/webgpu/backend.js +255 -8
  357. package/lib/gpu/webgpu/pipelines.d.ts +13 -0
  358. package/lib/gpu/webgpu/pipelines.js +28 -14
  359. package/lib/index.d.ts +7 -5
  360. package/lib/index.js +3 -2
  361. package/lib/math/color.d.ts +5 -5
  362. package/lib/math/color.js +5 -5
  363. package/lib/math/mat4.d.ts +6 -12
  364. package/lib/math/mat4.js +6 -12
  365. package/lib/math/namespaces/quat.d.ts +3 -3
  366. package/lib/math/namespaces/quat.js +3 -3
  367. package/lib/math/quat.d.ts +8 -12
  368. package/lib/math/quat.js +8 -12
  369. package/lib/math/random.d.ts +2 -3
  370. package/lib/math/random.js +2 -3
  371. package/lib/math/types.d.ts +4 -4
  372. package/lib/math/vec3.d.ts +3 -6
  373. package/lib/math/vec3.js +3 -6
  374. package/lib/page/capabilities.d.ts +8 -8
  375. package/lib/page/capabilities.js +39 -25
  376. package/lib/page/check-store.d.ts +14 -2
  377. package/lib/page/check-store.js +34 -11
  378. package/lib/page/engine.d.ts +117 -31
  379. package/lib/page/engine.js +438 -99
  380. package/lib/page/first-frame.d.ts +16 -0
  381. package/lib/page/first-frame.js +35 -0
  382. package/lib/page/frame-stats.d.ts +34 -1
  383. package/lib/page/frame-stats.js +15 -0
  384. package/lib/page/label-loop.d.ts +7 -3
  385. package/lib/page/label-loop.js +26 -14
  386. package/lib/page/labels.d.ts +3 -3
  387. package/lib/page/pipeline-store.d.ts +25 -0
  388. package/lib/page/pipeline-store.js +84 -0
  389. package/lib/page/start-marker.d.ts +4 -1
  390. package/lib/page/start-marker.js +5 -2
  391. package/lib/page/stats-switch.js +2 -0
  392. package/lib/page/switches.d.ts +38 -6
  393. package/lib/page/switches.js +29 -5
  394. package/lib/quality/check.d.ts +24 -3
  395. package/lib/quality/check.js +21 -7
  396. package/lib/quality/chooser.d.ts +6 -0
  397. package/lib/quality/chooser.js +8 -0
  398. package/lib/quality/governor.d.ts +98 -6
  399. package/lib/quality/governor.js +250 -20
  400. package/lib/quality/preset-docs.d.ts +16 -1
  401. package/lib/quality/preset-docs.js +3 -0
  402. package/lib/quality/presets.d.ts +84 -7
  403. package/lib/quality/presets.js +94 -2
  404. package/lib/render/draw.d.ts +3 -2
  405. package/lib/render/draw.js +15 -5
  406. package/lib/render/load-draw.d.ts +7 -5
  407. package/lib/render/load-draw.js +7 -5
  408. package/lib/render/loss.d.ts +28 -10
  409. package/lib/render/loss.js +50 -22
  410. package/lib/render/recovery.d.ts +20 -0
  411. package/lib/render/recovery.js +44 -4
  412. package/lib/render/renderer.d.ts +85 -9
  413. package/lib/render/renderer.js +181 -42
  414. package/lib/render/scene-renderer.d.ts +19 -1
  415. package/lib/render/scene-renderer.js +25 -1
  416. package/lib/render/webgl2-renderers.js +8 -5
  417. package/lib/render/webgpu-renderers.js +5 -4
  418. package/lib/scene/animation.d.ts +28 -32
  419. package/lib/scene/animation.js +12 -15
  420. package/lib/scene/assets.d.ts +61 -86
  421. package/lib/scene/assets.js +103 -236
  422. package/lib/scene/background.d.ts +14 -18
  423. package/lib/scene/background.js +5 -2
  424. package/lib/scene/baked-light.d.ts +2 -2
  425. package/lib/scene/color.d.ts +3 -3
  426. package/lib/scene/downloads.d.ts +2 -0
  427. package/lib/scene/downloads.js +371 -0
  428. package/lib/scene/environment.d.ts +7 -7
  429. package/lib/scene/environment.js +1 -1
  430. package/lib/scene/fake-call-values.js +3 -3
  431. package/lib/scene/fog.d.ts +11 -4
  432. package/lib/scene/fog.js +8 -2
  433. package/lib/scene/frame-cameras.d.ts +35 -4
  434. package/lib/scene/frame-cameras.js +86 -10
  435. package/lib/scene/gltf.d.ts +33 -3
  436. package/lib/scene/gltf.js +78 -49
  437. package/lib/scene/grading.d.ts +2 -2
  438. package/lib/scene/grading.js +3 -3
  439. package/lib/scene/ktx2.d.ts +9 -1
  440. package/lib/scene/ktx2.js +3 -2
  441. package/lib/scene/level-rule.d.ts +121 -0
  442. package/lib/scene/level-rule.js +130 -0
  443. package/lib/scene/lines.d.ts +13 -17
  444. package/lib/scene/lines.js +3 -3
  445. package/lib/scene/lut.d.ts +1 -2
  446. package/lib/scene/lut.js +1 -2
  447. package/lib/scene/particles.d.ts +7 -3
  448. package/lib/scene/particles.js +3 -1
  449. package/lib/scene/picks.d.ts +2 -2
  450. package/lib/scene/pointer-events.d.ts +4 -7
  451. package/lib/scene/post.d.ts +39 -43
  452. package/lib/scene/post.js +4 -1
  453. package/lib/scene/prefab.d.ts +7 -8
  454. package/lib/scene/prefab.js +7 -8
  455. package/lib/scene/property-animation.d.ts +1 -1
  456. package/lib/scene/property-animation.js +1 -1
  457. package/lib/scene/queries.d.ts +7 -13
  458. package/lib/scene/resources.d.ts +238 -261
  459. package/lib/scene/resources.js +179 -81
  460. package/lib/scene/scene.d.ts +167 -120
  461. package/lib/scene/scene.js +243 -103
  462. package/lib/scene/serial-loads.d.ts +29 -0
  463. package/lib/scene/serial-loads.js +68 -0
  464. package/lib/scene/shader-preloads.d.ts +34 -0
  465. package/lib/scene/shader-preloads.js +38 -0
  466. package/lib/scene/sprites.d.ts +14 -17
  467. package/lib/scene/sprites.js +5 -6
  468. package/lib/scene/textures.d.ts +11 -12
  469. package/lib/scene/textures.js +9 -10
  470. package/lib/scene/time-of-day.d.ts +11 -7
  471. package/lib/scene/time-of-day.js +11 -8
  472. package/lib/scene/vertex-draws.d.ts +5 -4
  473. package/lib/scene/vertex-draws.js +7 -5
  474. package/lib/shader-artifact.json +1 -0
  475. package/lib/shared/core.d.ts +5 -0
  476. package/lib/shared/core.js +1 -0
  477. package/lib/shared/import-once.d.ts +6 -0
  478. package/lib/shared/import-once.js +19 -0
  479. package/lib/shared/labels.d.ts +5 -2
  480. package/lib/shared/labels.js +5 -2
  481. package/lib/shared/metrics.d.ts +38 -0
  482. package/lib/shared/metrics.js +62 -1
  483. package/lib/shared/permutation-words.d.ts +2 -0
  484. package/lib/shared/permutation-words.js +8 -0
  485. package/lib/shared/recording.d.ts +13 -5
  486. package/lib/shared/recording.js +31 -10
  487. package/lib/shared/run-task.js +7 -1
  488. package/lib/shared/sketch-data.d.ts +9 -0
  489. package/lib/shared/sketch-data.js +57 -0
  490. package/lib/shared/task-pending.d.ts +12 -0
  491. package/lib/shared/task-pending.js +61 -1
  492. package/lib/shared/tasks.js +79 -32
  493. package/lib/shared/version.d.ts +17 -1
  494. package/lib/shared/version.js +19 -1
  495. package/lib/shared/wasm.d.ts +12 -4
  496. package/lib/shared/wasm.js +50 -27
  497. package/lib/shared/worker-start.d.ts +7 -0
  498. package/lib/shared/worker-start.js +27 -0
  499. package/lib/sketch/define-sketch.d.ts +51 -7
  500. package/lib/sketch/define-sketch.js +2 -1
  501. package/lib/sketch/input.d.ts +2 -2
  502. package/lib/sketch/preset-check.d.ts +20 -6
  503. package/lib/sketch/preset-check.js +42 -17
  504. package/lib/sketch/quality.d.ts +69 -11
  505. package/lib/sketch/quality.js +54 -13
  506. package/lib/sketch/runner.d.ts +80 -9
  507. package/lib/sketch/runner.js +390 -52
  508. package/lib/sketch/ui.d.ts +5 -8
  509. package/lib/sketch/ui.js +4 -2
  510. package/lib/stats.d.ts +1 -0
  511. package/lib/workers/probe-worker.d.ts +5 -0
  512. package/lib/workers/probe-worker.js +13 -4
  513. package/lib/workers/protocol.d.ts +71 -13
  514. package/lib/workers/protocol.js +4 -0
  515. package/lib/workers/render-worker.js +29 -5
  516. package/lib/workers/sketch-worker.js +108 -16
  517. package/package.json +2 -2
package/docs/api/post.md CHANGED
@@ -1,17 +1,28 @@
1
1
  ---
2
2
  id: api/post
3
3
  title: Post-processing API
4
- status: experimental
5
- since: "0.1"
6
4
  summary: "post.set for tone mapping, exposure and a camera's EV100, automatic exposure, bloom, ambient occlusion, screen-space reflections, depth of field, outlines, color grading tables and controls, the vignette and sharpening; custom effects with post.addEffect, custom tone curves, and still views."
7
5
  ---
8
6
 
9
7
  # Post-processing API
10
8
 
11
- > Roadmap step 0.1, first released in null3D 0.1.0. Step 0.2 adds automatic exposure, bloom, ambient occlusion, depth of field, outlines, color grading, the vignette, sharpening, custom effects, custom tone curves and still views. The API is experimental, so it can still change between versions.
12
-
13
9
  `ctx.post` holds the settings that the engine applies to the scene's color on its way to the canvas. They are the tone mapping, the exposure, automatic exposure, bloom, ambient occlusion, screen-space reflections, depth of field, outlines, a color grading table, the vignette, the sharpening and the sketch's own effects. [Color management](../concepts/color-management.md) explains how the first two fit into the frame. [The post-processing chain](../concepts/post-processing.md) explains how bloom, ambient occlusion, screen-space reflections, depth of field and sharpening do.
14
10
 
11
+ Every effect is off until `post.set` turns it on. The tone mapping (AgX punchy) and an exposure of 1 always apply.
12
+
13
+ | Effect | `post.set` key | [Quality setting that turns it off](../concepts/quality-presets.md) | [Without HDR color](../concepts/post-processing.md#effects-on-devices-without-hdr-color) |
14
+ | --- | --- | --- | --- |
15
+ | Automatic exposure | `autoExposure` | None (`exposureMeter` picks the meter) | Stays off |
16
+ | Bloom | `bloom` | None (`bloomSize` sets the detail) | Stays off |
17
+ | Ambient occlusion | `ao` | `aoScale` 0: Low, Medium | Stays off with no float targets |
18
+ | Screen-space reflections | `ssr` | `ssrScale` 0: Low | Stays off with no float targets |
19
+ | Depth of field | `dof` | `dofSamples` 0: Low | Stays off |
20
+ | Outlines | `outline` | None | Draws |
21
+ | Color grading | `lut`, `grading` | None | Draws |
22
+ | Vignette | `vignette` | None | Draws |
23
+ | Sharpening | `sharpen` | None (adds nothing below a render scale of 1) | Draws |
24
+ | Custom effects and tone curves | `post.addEffect`, `toneMapping` | None | Stay off |
25
+
15
26
  ## Tone mapping and exposure
16
27
 
17
28
  ```ts
@@ -29,16 +40,25 @@ export default defineSketch(({ post }) => {
29
40
  | `exposure` | A number from 0 up. 2 is one stop brighter, and 0.5 one stop darker. | 1 |
30
41
  | `ev100` | The camera's exposure value at ISO 100, for lights in real units: a number from -20 to 30, or `false` for none | `false` |
31
42
 
32
- - The curves use three.js's formulas: `'agx'` for `AgXToneMapping`, `'neutral'` for `NeutralToneMapping` and `'aces'` for `ACESFilmicToneMapping`. `'agx-punchy'` is AgX with Filament's punchy look, which adds contrast and color. three.js has no such curve.
33
- - `'aces'` serves ports of three.js scenes that set `ACESFilmicToneMapping`. It shifts the hues of bright colors, so new scenes use AgX.
34
- - `'none'` scales the color by the exposure and clips it at white, as three.js's `LinearToneMapping` does.
35
- - three.js uses no tone mapping by default. A port of a three.js scene without tone mapping sets `toneMapping: 'none'`.
36
- - A custom tone curve is WGSL that declares `fn toneCurve(color: vec3f) -> vec3f`, compiled by the null3D Vite plugin. [Custom effects](#custom-effects) shows one. `@null3d/three-compat` gives `ReinhardToneMapping` and `CineonToneMapping` as the `reinhard` and `cineon` curves ([three.js compatibility](three-compat.md)).
43
+ - `'agx'` is AgX, the curve of Blender and Filament. `'agx-punchy'` is AgX with Filament's punchy look, which adds contrast and color.
44
+ - `'neutral'` is Khronos PBR Neutral, which keeps base colors as they are until they near white.
45
+ - `'aces'` is a fit of the ACES filmic curve. It first scales the color by 1 / 0.6, for a bright viewing place. It shifts the hues of bright colors, so new scenes use AgX.
46
+ - `'none'` scales the color by the exposure and clips it at white.
47
+ - A custom tone curve is WGSL that declares `fn toneCurve(color: vec3f) -> vec3f`, compiled by the null3D Vite plugin. [Custom effects](#custom-effects) shows one. `@null3d/three-compat` adds the `reinhard` and `cineon` curves ([its API page](three-compat.md)).
37
48
  - The settings apply to the whole scene, the background included, from the next frame on. A setting that a call leaves out keeps its value.
38
49
 
39
50
  ## Lights in real units
40
51
 
41
- Most scenes and ports keep three.js's units, which need no camera setting. Lights in real units, such as a sun of 100,000 lux, need `ev100`: the exposure value of a camera at ISO 100. The units are on the [Lights](lights.md#color-intensity-and-units) page. Typical values are 15 for a sunny day, 12 for an overcast day and 7 for a lit room. Each step up is one stop darker. The engine scales the scene by 1 / (1.2 × 2^ev100), the formula of Filament, Bevy and Unity's HDRP. The `exposure` setting then scales that, as exposure compensation does. Setting `ev100: false` turns the camera off again.
52
+ Most scenes need no camera setting: their lights have small intensities, such as a sun of 3, and the exposure stays at 1. Lights in real units, such as a sun of 100,000 lux, need `ev100`: the exposure value of a camera at ISO 100. The units are on the [Lights](lights.md#color-intensity-and-units) page. Typical values are 15 for a sunny day, 12 for an overcast day and 7 for a lit room. Each step up is one stop darker.
53
+
54
+ The `exposure` setting then scales that, as exposure compensation does. Setting `ev100: false` turns the camera off again.
55
+
56
+ <details>
57
+ <summary>Technical details: the exposure formula</summary>
58
+
59
+ The engine scales the scene by 1 / (1.2 × 2^ev100), the formula of Filament, Bevy and Unity's HDRP. [Lighting and environment](../concepts/lighting.md) covers the units in full.
60
+
61
+ </details>
42
62
 
43
63
  ```ts
44
64
  import { defineSketch } from '@null3d/engine';
@@ -51,11 +71,21 @@ export default defineSketch(({ scene, post }) => {
51
71
  });
52
72
  ```
53
73
 
54
- The engine multiplies the exposure into each light, the environment's light, the background color and the fog color. The shaders multiply it into emissive light and unlit colors. The tone mapping then works on values near 1, even with a sun of 100,000 lux. Otherwise its highlights would pass the largest value of the 16-bit float scene color. The picture is the one that an exposure at the end gives. Background and unlit colors take the exposure too. At EV100 15 they draw black unless their own values are in real units, as in three.js at the same exposure.
74
+ Background and unlit colors take the exposure too. At EV100 15 they draw black unless their own values are in real units.
75
+
76
+ <details>
77
+ <summary>Technical details: where the engine applies the exposure</summary>
55
78
 
56
- ## Changing the exposure during play
79
+ The engine multiplies the exposure into each light, the environment's light, the background color and the fog color. The shaders multiply it into emissive light and unlit colors. The tone mapping then works on values near 1, even with a sun of 100,000 lux. Otherwise its highlights would pass the largest value of the 16-bit float scene color. The picture is the one that an exposure at the end gives.
57
80
 
58
- `post.set` allocates nothing, so a sketch can change the exposure every frame. Keep one settings object and change its field, so your own code allocates nothing either:
81
+ </details>
82
+
83
+ ## Changing settings during play
84
+
85
+ `post.set` allocates nothing, so a sketch can change settings every frame. Keep one settings object and change its field, so your own code allocates nothing either.
86
+
87
+ - A setting that a call leaves out keeps its value, also while its effect is off. `post.set({ effect: {} })` turns an effect on with the values it had.
88
+ - Turning an effect on or off can cost more. Each effect's section says how much.
59
89
 
60
90
  ```ts
61
91
  export default defineSketch(({ post, time }) => {
@@ -106,11 +136,9 @@ export default defineSketch(({ scene, geometry, materials, post }) => {
106
136
  - The scene draws at the camera's exposure, the `exposure` and `ev100` settings, and the eye adapts from there. A brightness of 0 stops is a scene that the camera's exposure shows as middle gray. With `ev100: 15`, `minEv: -8` lets the eye adapt down to a scene of about EV100 7.
107
137
  - Within one stop of its target, the eye slows down, so it settles smoothly. Eyes adapt to the dark more slowly than to the light, so `speedDown` is lower by default.
108
138
  - The first frame that meters takes its target at once, so a scene starts adapted. Hold mode draws one frame, so its image is the adapted image, the same in every run.
109
- - The final pass multiplies the scene's color, bloom's glow and folded effects by the adapted exposure, before FXAA, the vignette and the tone curve. Custom effects and depth of field see the camera's exposure. Bloom's `threshold` keeps its meaning in the scene's units.
139
+ - The final pass multiplies the color it reads by the adapted exposure: the scene's color, with the result of any custom effects, and bloom's glow. It does this before FXAA, the vignette and the tone curve. Custom effects and depth of field read the color at the camera's exposure. This is also true when the engine joins an effect into the final pass. Bloom's `threshold` keeps its meaning in the scene's units.
110
140
  - The quality setting `exposureMeter` picks the meter. `'histogram'` bins a grid of samples in compute shaders on WebGPU, on Medium and above. `'downsample'` averages 16 x 16 cells of the image, on Low and on WebGL2. Both take the same settings.
111
141
  - It needs HDR color, as bloom does. In WebGPU's compatibility mode with MSAA, turning it on moves the engine to HDR color with FXAA. On a device with no HDR target it stays off, and development builds warn once.
112
- - A setting that a call leaves out keeps its value, also while it is off. `post.set({ autoExposure: {} })` turns it on with the values it had.
113
- - `post.set` allocates nothing, and a meter costs nothing while it is off. Its shaders download the first time it turns on.
114
142
 
115
143
  ## Bloom
116
144
 
@@ -134,7 +162,7 @@ export default defineSketch(({ post }) => {
134
162
  | `bloom.blend` | How the glow meets the scene's color: `'mix'`, `'add'` or `'screen'`. | `'mix'` |
135
163
  | `bloom.weights` | Each level's share of the glow, from the narrowest to the widest: up to 10 numbers from 0 up, not all 0. | Shares for 8 levels |
136
164
 
137
- - `'mix'` moves each pixel's color toward the glow, so the image keeps its total light. `'add'` adds the glow, as three.js's `UnrealBloomPass` does. `'screen'` screens it, as pmndrs's `BloomEffect` does.
165
+ - `'mix'` moves each pixel's color toward the glow, so the image keeps its total light. The `'add'` blend adds the glow, so the image gains light. The `'screen'` blend screens it, so the glow adds less where the scene is already bright.
138
166
  - At a threshold of 0, all light glows a little. At 1, only light brighter than white glows, such as an emissive material with an `emissiveIntensity` above 1.
139
167
  - Each level spreads light twice as far as the one before. The eighth spreads it over about a quarter of the canvas's shorter side, and the tenth over all of it. The engine divides the weights by their sum. Levels past the last one with a weight cost nothing.
140
168
  - The glow keeps its size as a share of the screen at any pixel ratio, render scale and orientation. The quality setting `bloomSize` sets how many texels the chain's largest level has, which trades the glow's detail for cost.
@@ -145,7 +173,7 @@ export default defineSketch(({ post }) => {
145
173
 
146
174
  ## Ambient occlusion
147
175
 
148
- Ambient occlusion darkens the ambient light in corners, in creases and under objects, with the meanings of three.js's `GTAOPass`. It is off by default.
176
+ Ambient occlusion darkens the ambient light in corners, in creases and under objects. It uses ground-truth ambient occlusion (GTAO), and it is off by default.
149
177
 
150
178
  ```ts
151
179
  import { defineSketch } from '@null3d/engine';
@@ -168,7 +196,7 @@ export default defineSketch(({ post, quality }) => {
168
196
  | `ao.samples` | The depth samples of each pixel's search: a whole number from 1 to 64. | 16 |
169
197
  | `ao.intensity` | How much of the occlusion reaches the ambient light: a number from 0 to 1. | 1 |
170
198
 
171
- - It darkens only the ambient light and the light that light maps add. `GTAOPass` darkens the whole image, direct light included.
199
+ - It darkens only the ambient light and the light that light maps add. Direct light keeps its strength in a corner.
172
200
  - It draws where the quality setting `aoScale` is above 0: on the High and Ultra presets, or after `quality.set({ aoScale })`. On Low and Medium, the presets of phones and tablets, the scale is 0.
173
201
  - It turns the depth prepass on while it draws. On a WebGL2 device without float render targets it stays off.
174
202
  - A setting that a call leaves out keeps its value, also while it is off. `post.set({ ao: {} })` turns it on with the values it had.
@@ -264,7 +292,7 @@ export default defineSketch(({ scene, geometry, materials, post }) => {
264
292
 
265
293
  ## Outlines
266
294
 
267
- Outlines draw a crisp line around the meshes that `setOutlined(true)` marks, as three.js's `OutlinePass` draws edges around its selected objects. They are off by default.
295
+ Outlines draw a crisp line around the meshes that `setOutlined(true)` marks. They are off by default.
268
296
 
269
297
  ```ts
270
298
  import { defineSketch } from '@null3d/engine';
@@ -291,21 +319,21 @@ export default defineSketch(({ scene, geometry, materials, post }) => {
291
319
  | `outline.width` | The line's width in CSS pixels, from 0 up. | 2 |
292
320
 
293
321
  - `mesh.setOutlined(true)` marks a mesh, and `setOutlined(false)` clears it. A model's copy from `scene.instantiate` has `setOutlined` too, which marks each of its meshes. Instance batches take no outline.
294
- - One outline style covers every outlined mesh. three.js needs one `OutlinePass` for each style, and null3D draws one.
322
+ - One outline style covers every outlined mesh, and one mask pass draws them all.
295
323
  - The exposure, the tone mapping and the vignette do not change the line's colors. The color grading table still applies, and the dither moves them by up to one 8-bit step.
296
324
  - The line is as wide as `width` says on every screen and at every render scale. The engine multiplies it by the device's pixel ratio.
297
325
  - Above about 4 pixels of the canvas, a part of a mesh thinner than the line can leave a gap between itself and its line.
298
326
  - The outline covers the mesh's whole shape. It ignores the holes that an alpha cutoff cuts, and the vertices that a custom material moves.
299
327
  - A setting that a call leaves out keeps its value, also while outlines are off. `post.set` allocates nothing. So a sketch can change the outline's color or width every frame.
300
328
  - Turning outlines on or off, and `setOutlined`, rebuild the engine's draw tables, as a new material does. Do it in response to a click, not in every frame.
301
- - A full-screen pass reads the outline's mask with `input: 'outlineMask'`, for a soft glow such as `OutlinePass` draws ([Custom passes](../guides/custom-passes.md#a-soft-outline-glow)). `width: 0` draws the mask without the line.
302
- - `@null3d/three-compat`'s `createOutlinePass` draws `OutlinePass`'s soft edge, glow and pulse from this mask, through five full-screen passes and an effect ([three.js compatibility](three-compat.md)).
329
+ - A full-screen pass reads the outline's mask with `input: 'outlineMask'`, for a soft glow ([Custom passes](../guides/custom-passes.md#a-soft-outline-glow)). `width: 0` draws the mask without the line.
330
+ - `createOutlinePass` from `@null3d/three-compat` draws a soft edge, a glow and a pulse from this mask, through five full-screen passes and an effect ([its API page](three-compat.md)).
303
331
 
304
332
  [The post-processing chain](../concepts/post-processing.md#outlines) explains how outlines draw and what they cost.
305
333
 
306
334
  ## Color grading
307
335
 
308
- A color grading table maps each color of the picture to a graded color, as three.js's `LUTPass` does. Load one from a `.cube` or a `.3dl` file with [`assets.loadLut`](assets.md#color-grading-tables), or make one from numbers with [`assets.lutFromData`](assets.md#tables-from-numbers). Then give it to `post.set`:
336
+ A color grading table maps each color of the picture to a graded color. Load one from a `.cube` or a `.3dl` file with [`assets.loadLut`](assets.md#color-grading-tables), or make one from numbers with [`assets.lutFromData`](assets.md#tables-from-numbers). Then give it to `post.set`:
309
337
 
310
338
  ```ts
311
339
  import { defineSketch } from '@null3d/engine';
@@ -320,20 +348,16 @@ export default defineSketch(async ({ assets, post }) => {
320
348
  | Setting | Values | Default |
321
349
  | --- | --- | --- |
322
350
  | `lut` | A table from `assets.loadLut` or `assets.lutFromData`, or `false` to turn grading off. | Off |
323
- | `lutIntensity` | The share of the table's color in each pixel, from 0 to 1, as `LUTPass`'s `intensity`. | 1 |
351
+ | `lutIntensity` | The share of the table's color in each pixel, from 0 to 1. | 1 |
324
352
 
325
- - The table grades each pixel after the tone mapping and the sRGB encoding, as `LUTPass` does after three.js's `OutputPass`. Tables made for sRGB display color, as most are, look as their authors made them.
326
- - The final pass reads the table with a linear filter between its texel centers, as `LUTPass` does. It maps the colors of a `.cube` file's domain onto the table, which `LUTPass` leaves out.
353
+ - The table grades each pixel after the tone mapping and the sRGB encoding. Tables made for sRGB display color, as most are, look as their authors made them.
354
+ - The final pass reads the table with a linear filter between its texel centers. It maps the colors of a `.cube` file's domain onto the table.
327
355
  - The table grades the picture from the first frame after its texels reach the GPU, usually the next one.
328
- - `lutIntensity` keeps its value while the table is off, and `post.set` allocates nothing, so a sketch can fade a grade in every frame.
356
+ - `lutIntensity` keeps its value while the table is off.
329
357
 
330
358
  ### Grading controls
331
359
 
332
- The grading controls set a look from a few numbers, without a table file. A job worker bakes them
333
- into a table of its own. The final pass applies that table to the display color that the tone curve
334
- leaves, before a `lut`. A change stalls no frame. The picture shows the new grade once the
335
- worker's bake reaches the GPU, usually within a few frames. The frame that lands a bake uploads the
336
- table, 256 KB.
360
+ The grading controls set a look from a few numbers, without a table file. A [job worker](../concepts/architecture.md#the-kinds-of-thread) bakes them into a table of its own, so a change stalls no frame. The final pass applies that table to the display color that the tone curve leaves. The picture shows the new grade once the bake reaches the GPU, usually within a few frames.
337
361
 
338
362
  ```ts
339
363
  post.set({
@@ -366,11 +390,20 @@ post.set({
366
390
  - White balance corrects the light of the given temperature to the neutral white of daylight at 6500 kelvin. It keeps the picture's brightness.
367
391
  - The table holds 32 texels along each side. The final pass takes the square root of the color before it reads the table. Its texels therefore lie closer together toward black, where a grade's curve is steepest.
368
392
  - The table holds the grade alone, and the tone curve stays a calculation in the pass. A custom tone curve therefore still works with the controls.
393
+
394
+ The [Creek showcase](https://github.com/null3d-engine/null3d/tree/main/examples/showcase/creek) sets its own WGSL tone curve in the scene's look.
369
395
  - The final pass applies the built-in grade first and a `lut` after it, so a look from a file can sit over a grade from the controls.
370
396
  - The final pass draws on every GPU path, with HDR color or without it, so both paths grade alike.
371
- - The bake runs in a job worker, so a value that changes in a frame loop does not stall the frames. The frame that lands a bake uploads the table, 256 KB. Where no worker can run tasks, the picture keeps its colors and development builds warn once.
397
+ - The bake runs in a job worker, so a value that changes in a frame loop does not stall the frames. Where no worker can run tasks, the picture keeps its colors and development builds warn once.
372
398
  - The values are designed for the null3D grading controls. To match a grade that a colorist made in another tool, load its `.cube` file instead.
373
399
 
400
+ <details>
401
+ <summary>Technical details: the grading table</summary>
402
+
403
+ Each table costs the final pass a few operations per pixel and one texture read. On a device that resolves its multisampled picture straight into the canvas, the table makes the final pass run, which reads the picture once more. The frame that lands a bake uploads the table, 256 KB.
404
+
405
+ </details>
406
+
374
407
  ## Vignette
375
408
 
376
409
  The vignette darkens the picture toward its edges:
@@ -387,12 +420,10 @@ post.set({ vignette: { intensity: 0.8, size: 1.2 } });
387
420
  | `vignette.falloff` | How fast the light falls from the center: the power of the falloff curve, above 0. Higher values darken more of the picture. | 2 |
388
421
  | `vignette.roundness` | The shape, from 0 to 1: 0 follows the canvas's shape, an ellipse on a wide canvas, and 1 is a circle. | 0 |
389
422
 
390
- - The vignette multiplies each pixel's light before the tone mapping. [The post-processing chain](../concepts/post-processing.md#color-grading-and-the-vignette) gives the rule, the engines it follows and the difference from three.js's `VignetteShader`.
423
+ - The vignette multiplies each pixel's light before the tone mapping. [The post-processing chain](../concepts/post-processing.md#color-grading-and-the-vignette) gives the rule and the engines it follows.
391
424
  - At a distance `d` from the center, in canvas widths and heights times `size`, the light is multiplied by `1 - intensity × (1 - (1 - d²)^falloff)`, and never by less than 0.
392
- - A port of three.js's `VignetteShader` sets `size` to its `offset` and `intensity` to its `darkness`. Under ACES the default falloff gives a close match. Under AgX, a port keeps `intensity` at 1 or less and sets `falloff` to 3. With a `darkness` below 1, three.js also lifts dark corners toward the gray, and null3D does not.
393
- - A setting that a call leaves out keeps its value, also while the vignette is off. `post.set({ vignette: {} })` turns it on with the values it had.
394
425
 
395
- Grading and the vignette draw on every GPU path, with HDR color or without it. Without HDR color, the scene's shaders darken their light by the vignette before their tone mapping. A plain background color then draws as a background, so the vignette darkens it too. Each table costs the final pass a few operations per pixel and one texture read. On a device that resolves its multisampled picture straight into the canvas, the table makes the final pass run, which reads the picture once more.
426
+ Grading and the vignette draw on every GPU path, with HDR color or without it. Without HDR color, the vignette still draws: the scene's shaders darken their light before their tone mapping, and a plain background color darkens too.
396
427
 
397
428
  The final pass dithers last, after the table and the vignette. It adds noise of up to one step of the 8-bit canvas, so smooth gradients show no bands. The noise is the same in every frame.
398
429
 
@@ -413,7 +444,7 @@ post.set({ sharpen: 0.5 });
413
444
  - It draws at the whole canvas's render scale. A render scale below 1 sharpens its own upscale, so the value adds nothing there ([quality presets](../concepts/quality-presets.md#dynamic-resolution)).
414
445
  - While it is on, the frame draws in two steps at the whole render scale. The first step tone maps the scene into an 8-bit target, and the second sharpens that display color. A sketch whose render scale can drop already keeps that target, so sharpening adds no memory there. One that holds the render scale at 1 keeps a target of the canvas's size while sharpening is on.
415
446
  - While it is on, a still view keeps drawing instead of blending its frames and resting, because the sharpening draws in the moving frame's second step. [The post-processing chain](../concepts/post-processing.md#still-camera-accumulation) says what a still view does.
416
- - A setting that a call leaves out keeps its value. `post.set({ sharpen: false })` turns it off, and 0 does the same.
447
+ - `post.set({ sharpen: false })` turns it off, and 0 does the same.
417
448
 
418
449
  ## Custom effects
419
450
 
@@ -464,13 +495,13 @@ post.set({ toneMapping: reinhard });
464
495
 
465
496
  ## Still views
466
497
 
467
- A view that holds still blends its frames into a sharper picture, then stops drawing until something changes. It needs no setting: `post.set` turns nothing on for it. Bloom, outlines and automatic exposure keep a view drawing every frame, as [the post-processing chain](../concepts/post-processing.md#still-camera-accumulation) explains. `createEngine({ still: false })` and the page switch `?still-camera=off` turn it off.
498
+ A view that holds still blends its frames into a sharper picture, then stops drawing until something changes. It needs no setting: `post.set` turns nothing on for it. Bloom, outlines, automatic exposure, screen-space reflections, sharpening and custom effects keep a view drawing every frame. [The post-processing chain](../concepts/post-processing.md#still-camera-accumulation) lists every feature that does. `createEngine({ still: false })` and the page switch `?still-camera=off` turn it off.
468
499
 
469
500
  ## Errors
470
501
 
471
502
  | Code | Cause |
472
503
  | --- | --- |
473
- | [E1213](../errors/E1213.md) | A ninth effect. A setting that this version does not have, such as three.js's vignette `offset` and `darkness`, a tone mapping that the engine does not know, or a bloom, ambient occlusion, depth of field, automatic exposure, outline, vignette or sharpening value other than settings, a number or `false`. An automatic exposure `metering` other than `'mean'` or `'percentile'`, `percentiles` that are not two numbers from 0 to 1 with the lower first, a `centerWeight` outside 0 to 1, a speed below 0, a `minEv`, `maxEv` or `compensation` outside -20 to 20, or a `minEv` above `maxEv`. A depth of field `focusDistance`, `aperture` or `focalLength` that is not above 0, a `maxBlur` outside 0 to 0.1, `blades` other than 0 or a whole number from 3 to 12, or a `focusPoint` that is not three finite numbers or `false`. Also a `lut` that is not a table from `assets.loadLut` or `assets.lutFromData`, a `grading` value out of its range, such as a white balance outside 1667 to 25000 kelvin, a lift channel outside -1 to 1, a gamma channel of 0 or below, a negative gain or saturation, or a split toning balance outside -1 to 1 or strength outside 0 to 1, or a value out of its range. These are an exposure, bloom intensity, threshold or knee, vignette intensity or size, or outline width below 0, a vignette falloff of 0 or below or a roundness above 1, a bloom blend other than `'mix'`, `'add'` or `'screen'`, bloom weights that are not 1 to 10 numbers of 0 or more, or that are all 0, a `lutIntensity` outside 0 to 1, a sharpening strength outside 0 to 1, an ambient occlusion value below 0 or its `distanceFalloff` or `intensity` above 1, a `distanceExponent` of 0, `samples` that are not a whole number from 1 to 64, or an `ev100` outside -20 to 30. |
504
+ | [E1213](../errors/E1213.md) | A ninth effect, because at most 8 run at once. A setting that this version does not have, or a value that a setting does not take, such as a tone mapping that the engine does not know or a number outside its range. Each section's settings table gives the values that a setting takes. |
474
505
  | [E1203](../errors/E1203.md) | A value that is not a finite number, such as NaN, or an effect's `order` that is not one. |
475
506
  | [E1204](../errors/E1204.md) | An outline color that is not a hex string, a hex number or three linear components from 0 to 1. |
476
507
  | [E1215](../errors/E1215.md) | An effect or a tone curve as WGSL that the null3D Vite plugin did not compile, or compiled WGSL of another kind. |
@@ -483,12 +514,14 @@ A view that holds still blends its frames into a sharper picture, then stops dra
483
514
  - [The post-processing chain](../concepts/post-processing.md): how bloom, ambient occlusion, depth of field, outlines, custom effects and still views work, and what they cost.
484
515
  - [Cameras](cameras.md#focal-length): `camera.setFocalLength`, the lens that depth of field takes.
485
516
  - [Custom passes](../guides/custom-passes.md): how to write custom effects and tone curves.
486
- - [three.js to null3D mapping](../porting/threejs-mapping.md): `renderer.toneMapping`, `toneMappingExposure`, `UnrealBloomPass`, `GTAOPass`, `BokehPass`, `OutlinePass`, `LUTPass`, `VignetteShader`, `SharpenNode` and `ShaderPass`. three.js has no grading controls; a null3D grade has no three.js twin.
517
+ - [three.js to null3D mapping](../porting/threejs-mapping.md): `renderer.toneMapping`, `toneMappingExposure`, `UnrealBloomPass`, `GTAOPass`, `BokehPass`, `OutlinePass`, `LUTPass`, `VignetteShader`, `SharpenNode` and `ShaderPass`.
487
518
  - [Quality presets](../concepts/quality-presets.md): `aoScale`, `dofSamples` and `exposureMeter` on each preset.
488
519
  - [Objects and transforms](objects.md#mesh-calls): `setOutlined`.
489
520
  - [Assets](assets.md): `assets.loadLut`, which loads color grading tables, and `assets.lutFromData`, which makes them from numbers.
490
521
  - [The post effects demo](https://github.com/null3d-engine/null3d/tree/main/examples/post-effects): bloom, ambient occlusion, an outline, a vignette, sharpening and color grading tables in one scene. It makes its warm and cool tables from lift, gamma and gain in code.
491
522
  - [The depth of field demo](https://github.com/null3d-engine/null3d/tree/main/examples/camera-lens): the focus racks across a chess board with `focusPoint`, while a dolly zoom changes the camera's focal length in every frame.
523
+ - [The automatic exposure demo](https://github.com/null3d-engine/null3d/tree/main/examples/auto-exposure): a walk from a sunny courtyard into a dark hall, where the eye opens and closes.
524
+ - [The screen-space reflections demo](https://github.com/null3d-engine/null3d/tree/main/examples/wet-street): puddles that mirror lit windows, neon signs and a passing taxi.
492
525
 
493
526
  ## API reference
494
527
 
@@ -1,16 +1,14 @@
1
1
  ---
2
2
  id: api/quality
3
3
  title: Quality API
4
- status: experimental
5
- since: "0.1"
6
4
  summary: "quality.preset, quality.set, quality.setPreset, the preset check, the frame-budget governor, budgets for a sketch's own systems, quality events."
7
5
  ---
8
6
 
9
7
  # Quality API
10
8
 
11
- > Roadmap step 0.1, first released in null3D 0.1.0. Step 0.2 adds `quality.setBudget`. The API is experimental, so it can still change between versions. `quality.set` takes every setting that changes during play, as [Settings](#settings) says. The others stay fixed while the engine runs. The settings that the preset table marks as planned are not built yet. Coding agents must not use them.
9
+ > `quality.set` takes every setting that changes during play, as [Changing settings during play](#changing-settings-during-play) says. The others stay fixed while the engine runs.
12
10
 
13
- `ctx.quality` gives a sketch the quality preset that the engine runs and its settings. The sketch can change the settings that change during play, switch to another preset, and hear when either changes. [Quality presets](../concepts/quality-presets.md) explains how the engine chooses and checks the preset, and lists each preset's values.
11
+ `ctx.quality` gives a sketch the quality preset that the engine runs and its settings. The sketch can change the settings that change during play, switch to another preset, and hear when either changes ([Quality events](#quality-events)). [Quality presets](../concepts/quality-presets.md) explains how the engine chooses and checks the preset, and lists each preset's values.
14
12
 
15
13
  ```ts
16
14
  import { defineSketch } from '@null3d/engine';
@@ -30,11 +28,12 @@ export default defineSketch(({ quality, page }) => {
30
28
 
31
29
  ## Choosing the preset on the page
32
30
 
33
- The page names the preset with the `preset` option of `createEngine`, or leaves the choice to the engine with `auto`, the default. The engine reports the preset that it runs in `engine.mode.preset`, and what the preset check measured in `engine.mode.presetCheck`:
31
+ The page names the preset with the `preset` option of `createEngine`, or leaves the choice to the engine with `auto`, the default. The engine reports the preset that it runs in `engine.mode.preset`, and what the preset check measured in `engine.mode.presetCheck`. The check measures the first frames of play, so wait for `engine.presetChecked` before you read its choice:
34
32
 
35
33
  ```ts
36
34
  const engine = await createEngine({ canvas, sketch, preset: 'auto' });
37
35
  console.log(engine.mode.preset, engine.mode.crashedStarts, engine.mode.memoryMaximumMiB);
36
+ await engine.presetChecked;
38
37
  console.log(engine.mode.presetCheck); // { from: 'high', targetFps: 60, rounds: [...], reused: false }, or null
39
38
  ```
40
39
 
@@ -42,14 +41,18 @@ console.log(engine.mode.presetCheck); // { from: 'high', targetFps: 60, rounds:
42
41
  | --- | --- |
43
42
  | `preset: 'auto'` | The engine chooses the preset for the device, then checks it with the sketch's scene and lowers it where the GPU cannot hold the frame rate. |
44
43
  | `preset: 'low'` to `'ultra'` | Names the preset. The GPU path still caps it, and a crashed start lowers it. |
44
+ | `presetCheck: 'during-play'` or `'before-play'` | When the preset check measures: in the first frames of play, the default, or before play, with `createEngine` waiting for it: [The preset check](../concepts/quality-presets.md#the-preset-check). |
45
45
  | `targetFps: 'display'` or a whole number | The frame rate that the preset check and the governor defend. Without it, the display's refresh rate, at most 60. `'display'` defends the display's full rate, and a number caps the target at that rate: [The target frame rate](../concepts/quality-presets.md#the-target-frame-rate). |
46
46
  | `maxPixelRatio` | Replaces the preset's pixel ratio cap. |
47
- | `antialias: 'msaa'`, `'fxaa'` or `'none'` | Replaces the preset's anti-aliasing mode. |
48
- | `shadowCascades`, `shadowMapSize`, `shadowTiles`, `shadowTileSize`, `heroTileSize`, `pointLightShadows`, `depthPrepass`, `gpuOcclusion`, `morphTargets` | Replace the preset's values of these settings, which stay fixed while the engine runs. |
49
- | `softwareOcclusion`, `textureMemoryMiB` | Replace the preset's values of these settings. A sketch can change them during play. |
47
+ | `antialias: 'msaa'`, `'fxaa'` or `'none'` | Replaces the preset's anti-aliasing mode: [GPU tiers and backends](../concepts/backends.md#color-and-anti-aliasing-on-each-tier). |
48
+ | `shadowCascades`, `shadowMapSize`, `shadowTiles`, `shadowTileSize`, `heroTileSize`, `pointLightShadows`, `momentTransparency`, `gpuOcclusion`, `morphTargets` | Replace the preset's values of these settings, which stay fixed while the engine runs. [Quality presets](../concepts/quality-presets.md#moment-transparency) explains `momentTransparency` and its `?moments=` switch. |
49
+ | `depthPrepass`, `cloudSteps`, `softwareOcclusion`, `textureMemoryMiB` | Replace the preset's values of these settings. A sketch can change them during play. |
50
50
  | `memory: { maximumMiB }` | Replaces the preset's memory maximum: [Page API](engine.md#memory). |
51
- | `?preset=low` to `?preset=ultra` | Fixes the preset for tests. It wins over the option, and the engine ignores earlier crashes and checks no preset. |
51
+ | `?preset=low` to `?preset=ultra` | Fixes the preset for tests. It wins over the option, skips the preset check and starts outside the lowest tier. A crashed start still lowers the preset by one. |
52
+ | `?tier=lowest` | Starts in the [lowest quality tier](../concepts/quality-presets.md#the-lowest-quality-tier), for tests and weak devices. |
53
+ | `?tier=off` | Keeps the governor out of the lowest quality tier, so a test reads the presets' own settings and looks on a slow machine. |
52
54
  | `?target-fps=display` or `?target-fps=90` | Sets the target frame rate. It wins over the `targetFps` option. |
55
+ | `?preset-check=during-play` or `?preset-check=before-play` | Sets when the preset check measures. It wins over the `presetCheck` option. |
53
56
 
54
57
  ## Settings
55
58
 
@@ -57,17 +60,24 @@ console.log(engine.mode.presetCheck); // { from: 'high', targetFps: 60, rounds:
57
60
 
58
61
  Most settings change during play. The preset tables' "Changes" column names the ones that stay fixed from the start, which the page's `createEngine` options set.
59
62
 
60
- ### Moment transparency
63
+ ## Changing settings during play
61
64
 
62
- `momentTransparency` blends the blended surfaces in a layer that needs no sort, and it keeps more of each surface's own color than `blending: 'weighted'` does. The setting is fixed at the start, so it goes in `createEngine`'s options or in the `?moments=` switch. Every preset leaves it off. Its cost is in [Quality presets](../concepts/quality-presets.md#moment-transparency). [Moment transparency](materials.md#moment-transparency) describes the layer and the surfaces that it draws.
65
+ `quality.set(settings)` changes the settings it gets and keeps the others. It takes the settings that change during play, applies them from the next frame on, and returns a promise that resolves at once. Another setting, or a value outside the setting's range, throws [E1213](../errors/E1213.md) and changes nothing. E1213 is also thrown for a `minRenderScale` above `maxRenderScale`, for a `createEngine` option with a value that its setting does not take, and for a preset name that `createEngine` does not know. [Quality presets](../concepts/quality-presets.md#moment-transparency) describes the moment transparency layer and the surfaces that it draws.
63
66
 
64
- [GPU tiers and backends](../concepts/backends.md#color-and-anti-aliasing-on-each-tier) compares the anti-aliasing modes on each GPU path.
67
+ <details>
68
+ <summary>Technical details: other calls that throw, and the render scale's range</summary>
65
69
 
66
- `quality.set(settings)` changes the settings it gets and keeps the others. It takes the settings that change during play, applies them from the next frame on, and returns a promise that resolves at once. Another setting, or a value outside the setting's range, throws [E1213](../errors/E1213.md) and changes nothing. So does a `minRenderScale` above `maxRenderScale`, an option of `createEngine` with a value that its setting does not take, and a preset name that `createEngine` does not know. To move both ends of the render scale's range past each other, give both in one call.
70
+ To move both ends of the render scale's range past each other, give both in one call. In the [lowest quality tier](../concepts/quality-presets.md#the-lowest-quality-tier), a `minRenderScale` above the tier's cap on the scale raises the cap to it instead. Only a `maxRenderScale` that the sketch set itself throws.
71
+
72
+ </details>
67
73
 
68
74
  ## Switching presets
69
75
 
70
- `quality.setPreset(preset)` switches to another preset at a point that the sketch picks, such as a menu or a loading screen. Every setting that changes during play takes the new preset's value, apart from those that the page's options give. The values that `set` gave end with the switch too. The settings fixed at the start, such as `antialias`, keep their values. The preset check is different: when it lowers the preset after the setup, the settings that the setup changed with `set` keep their values. The GPU path caps the preset: `setPreset('ultra')` on WebGL2 runs Medium. `quality.highest` names that cap, so a menu shows the presets above it as unavailable.
76
+ `quality.setPreset(preset)` switches to another preset at a point that the sketch picks, such as a menu or a loading screen. Every setting that changes during play takes the new preset's value, apart from those that the page's options give. The values that `set` gave end with the switch too. The settings fixed at the start, such as `antialias`, keep their values.
77
+
78
+ The preset check is different: when it lowers the preset after the setup, the settings that the setup changed with `set` keep their values.
79
+
80
+ The GPU path caps the preset: `setPreset('ultra')` on WebGL2 runs Medium. `quality.highest` names that cap, so a menu shows the presets above it as unavailable.
71
81
 
72
82
  ```ts
73
83
  export default defineSketch(({ quality, page }) => {
@@ -94,7 +104,16 @@ console.log(quality.renderScale); // 0.75
94
104
 
95
105
  ## The frame-budget governor
96
106
 
97
- When frames take too long, the engine lowers a sketch's budgets and the render scale in turn, a budget's step first, until the render scale reaches its lowest. Then it lowers the levels of detail, the live shadow settings, bloom's size, ambient occlusion's scale and the scale of screen-space reflections. Then it lowers the steps of contact shadows and the far characters' update interval. It raises them again once frames have time to spare. [Quality presets](../concepts/quality-presets.md#the-frame-budget-governor) gives the order of the steps and the rules that drive them. `quality.settings` keeps the values that the preset and the sketch gave. `quality.governor` reports what the engine draws with now. [`QualityGovernor`](reference/quality.md#qualitygovernor) lists each of its members with the step that changes it.
107
+ When frames take too long, the engine lowers the sketch's budgets and the render scale first, then detail, shadow and effect settings, one step at a time. It raises them again once frames have time to spare. When frames still miss at the lowest render scale, it enters the [lowest quality tier](../concepts/quality-presets.md#the-lowest-quality-tier). [Quality presets](../concepts/quality-presets.md#the-frame-budget-governor) lists every step in order.
108
+
109
+ `quality.settings` keeps the values that the preset and the sketch gave. `quality.governor` reports what the engine draws with now. [`QualityGovernor`](reference/quality.md#qualitygovernor) lists each of its members with the step that changes it.
110
+
111
+ <details>
112
+ <summary>Technical details: the order of the steps</summary>
113
+
114
+ After the budgets and the render scale, the governor lowers the levels of detail, the live shadow settings, bloom's size, ambient occlusion's scale and the scale of screen-space reflections. It then lowers the steps of contact shadows, the far characters' update interval and the slices of volumetric fog.
115
+
116
+ </details>
98
117
 
99
118
  The `quality.onChange` handlers run after each of these steps. So a sketch can lighten its own work with the engine's:
100
119
 
@@ -169,7 +188,7 @@ Each budget step adds a step before a step of the render scale. So with budgets,
169
188
 
170
189
  ## Texture memory
171
190
 
172
- The `quality.textureMemory` object reports the GPU memory of textures against their budget, the `textureMemoryMiB` setting. Its `bytes` are the GPU bytes that every texture takes, with the free layers of texture arrays. Its `budgetBytes` give the budget in bytes. Its `droppedLevels` count the mip levels that the engine dropped from every texture to stay under the budget. Its `droppedTextures` count the textures that hold fewer levels than their own. Each texture's `droppedLevels` gives its own count. [Quality presets](../concepts/quality-presets.md#texture-memory) explains which levels drop and how they come back.
191
+ The `quality.textureMemory` object reports the GPU memory of textures against the `textureMemoryMiB` budget, and how many mip levels the engine dropped to stay under it. [`TextureMemory`](reference/quality.md#texturememory) lists its fields, and each texture's own `droppedLevels` gives its count. [Quality presets](../concepts/quality-presets.md#texture-memory) explains which levels drop and how they come back.
173
192
 
174
193
  ```ts
175
194
  quality.onChange(({ textureMemory }) => {
@@ -182,7 +201,13 @@ Some textures never drop levels: those that the sketch made from images or data,
182
201
 
183
202
  ## Quality events
184
203
 
185
- `quality.onChange(handler)` calls the handler at the start of the first frame after the settings or the preset change. It also calls it after each shadow step of the frame-budget governor, and after the texture memory budget drops levels or asks for them again. A step of the budgets calls their `onScale` functions, not these handlers. It returns a function that removes the handler. Keep handlers cheap: they run when quality changes, not every frame. After a change of preset, the handler's frame waits for its pipelines too. So objects that a handler creates for the new preset appear with it.
204
+ `quality.onChange(handler)` returns a function that removes the handler. The engine calls the handler:
205
+
206
+ - At the start of the first frame after `quality.set` or `quality.setPreset` changes the settings or the preset. After a preset change, that frame waits for its pipelines, so objects that the handler makes for the new preset appear with it.
207
+ - After each step of [the frame-budget governor](#the-frame-budget-governor), apart from a step of the render scale.
208
+ - After the [texture memory](#texture-memory) budget drops mip levels or asks for them again.
209
+
210
+ A step of the [budgets](#budgets-for-the-sketchs-own-systems) calls their `onScale` functions, not these handlers. Keep handlers cheap: they run when quality changes, not every frame.
186
211
 
187
212
  ## Related pages
188
213