@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.
- package/README.md +109 -0
- package/THIRD-PARTY-NOTICES.txt +0 -1
- package/dist/wasm/single/null3d.js +25 -10
- package/dist/wasm/single/null3d_bg.wasm +0 -0
- package/dist/wasm/threaded/null3d.js +25 -10
- package/dist/wasm/threaded/null3d_bg.wasm +0 -0
- package/docs/api/animation.md +114 -86
- package/docs/api/assets.md +135 -49
- package/docs/api/cameras.md +45 -12
- package/docs/api/controls.md +88 -62
- package/docs/api/debug.md +116 -41
- package/docs/api/engine.md +117 -35
- package/docs/api/feature-draws.md +23 -17
- package/docs/api/feature-effects.md +11 -11
- package/docs/api/feature-instances.md +70 -19
- package/docs/api/features.md +77 -47
- package/docs/api/geometry.md +132 -82
- package/docs/api/grass.md +55 -13
- package/docs/api/impostors.md +175 -22
- package/docs/api/input.md +24 -18
- package/docs/api/lights.md +78 -51
- package/docs/api/lines.md +41 -33
- package/docs/api/materials.md +248 -121
- package/docs/api/math.md +12 -13
- package/docs/api/objects.md +47 -22
- package/docs/api/page.md +58 -7
- package/docs/api/particles.md +33 -20
- package/docs/api/points.md +19 -31
- package/docs/api/post.md +75 -42
- package/docs/api/quality.md +42 -17
- package/docs/api/raycast.md +65 -51
- package/docs/api/reference/animation.md +10 -11
- package/docs/api/reference/assets.md +25 -22
- package/docs/api/reference/cameras.md +8 -4
- package/docs/api/reference/controls.md +134 -25
- package/docs/api/reference/debug.md +81 -14
- package/docs/api/reference/engine.md +58 -17
- package/docs/api/reference/feature-draws.md +3 -4
- package/docs/api/reference/feature-effects.md +2 -3
- package/docs/api/reference/feature-instances.md +5 -4
- package/docs/api/reference/features.md +7 -4
- package/docs/api/reference/geometry.md +287 -97
- package/docs/api/reference/grass.md +63 -3
- package/docs/api/reference/impostors.md +208 -13
- package/docs/api/reference/input.md +4 -5
- package/docs/api/reference/lights.md +13 -12
- package/docs/api/reference/lines.md +10 -11
- package/docs/api/reference/materials.md +54 -53
- package/docs/api/reference/math.md +35 -24
- package/docs/api/reference/objects.md +11 -12
- package/docs/api/reference/particles.md +31 -6
- package/docs/api/reference/points.md +6 -7
- package/docs/api/reference/post.md +21 -20
- package/docs/api/reference/quality.md +8 -5
- package/docs/api/reference/raycast.md +7 -8
- package/docs/api/reference/render.md +5 -4
- package/docs/api/reference/scene.md +52 -30
- package/docs/api/reference/sketch.md +15 -11
- package/docs/api/reference/sound.md +234 -0
- package/docs/api/reference/splats.md +42 -3
- package/docs/api/reference/sprites.md +7 -8
- package/docs/api/reference/tasks.md +16 -3
- package/docs/api/reference/terrain.md +27 -5
- package/docs/api/reference/textures.md +5 -6
- package/docs/api/reference/three-compat.md +18 -7
- package/docs/api/reference/time.md +1 -2
- package/docs/api/reference/ui.md +12 -9
- package/docs/api/reference/vertex-draws.md +5 -6
- package/docs/api/reference/water.md +153 -9
- package/docs/api/reference/wind.md +17 -4
- package/docs/api/render.md +73 -29
- package/docs/api/scene.md +164 -60
- package/docs/api/sketch.md +102 -15
- package/docs/api/sound.md +205 -0
- package/docs/api/splats.md +46 -12
- package/docs/api/sprites.md +10 -24
- package/docs/api/tasks.md +33 -24
- package/docs/api/terrain.md +42 -22
- package/docs/api/textures.md +68 -19
- package/docs/api/three-compat.md +15 -7
- package/docs/api/time.md +3 -5
- package/docs/api/ui.md +19 -23
- package/docs/api/vertex-draws.md +13 -12
- package/docs/api/water.md +262 -35
- package/docs/api/wind.md +63 -17
- package/docs/cli/null3d.md +177 -27
- package/docs/concepts/architecture.md +73 -27
- package/docs/concepts/assets.md +57 -33
- package/docs/concepts/backends.md +69 -27
- package/docs/concepts/color-management.md +54 -36
- package/docs/concepts/culling.md +68 -47
- package/docs/concepts/handles.md +14 -5
- package/docs/concepts/instances.md +74 -25
- package/docs/concepts/large-worlds.md +18 -8
- package/docs/concepts/lighting.md +155 -87
- package/docs/concepts/lod.md +126 -44
- package/docs/concepts/materials.md +58 -27
- package/docs/concepts/particle-buffer.md +48 -35
- package/docs/concepts/post-processing.md +84 -43
- package/docs/concepts/quality-preset-tables.md +56 -52
- package/docs/concepts/quality-presets.md +164 -52
- package/docs/concepts/render-graph.md +69 -29
- package/docs/concepts/render-layers.md +11 -21
- package/docs/concepts/shadows.md +105 -52
- package/docs/concepts/static-dynamic.md +22 -7
- package/docs/cookbook/index.md +164 -120
- package/docs/data/threejs-mapping.json +362 -367
- package/docs/errors/E1101.md +23 -5
- package/docs/errors/E1102.md +11 -3
- package/docs/errors/E1103.md +11 -3
- package/docs/errors/E1104.md +11 -3
- package/docs/errors/E1105.md +13 -5
- package/docs/errors/E1106.md +11 -3
- package/docs/errors/E1107.md +15 -5
- package/docs/errors/E1108.md +11 -3
- package/docs/errors/E1109.md +32 -6
- package/docs/errors/E1110.md +23 -5
- package/docs/errors/E1111.md +11 -3
- package/docs/errors/E1112.md +11 -3
- package/docs/errors/E1203.md +12 -4
- package/docs/errors/E1204.md +11 -3
- package/docs/errors/E1205.md +11 -3
- package/docs/errors/E1206.md +28 -6
- package/docs/errors/E1207.md +11 -3
- package/docs/errors/E1208.md +12 -3
- package/docs/errors/E1209.md +11 -3
- package/docs/errors/E1213.md +27 -5
- package/docs/errors/E1214.md +14 -6
- package/docs/errors/E1215.md +31 -6
- package/docs/errors/E1216.md +31 -6
- package/docs/errors/E1217.md +29 -6
- package/docs/errors/E1218.md +22 -6
- package/docs/errors/E1219.md +11 -3
- package/docs/errors/E1220.md +24 -5
- package/docs/errors/E1221.md +24 -5
- package/docs/errors/E1222.md +11 -3
- package/docs/errors/E1223.md +39 -6
- package/docs/errors/E1224.md +11 -3
- package/docs/errors/E1225.md +11 -3
- package/docs/errors/E1301.md +11 -3
- package/docs/errors/E1302.md +11 -3
- package/docs/errors/E1303.md +11 -3
- package/docs/errors/E1304.md +11 -3
- package/docs/errors/E1305.md +13 -3
- package/docs/errors/E1306.md +11 -3
- package/docs/errors/E1307.md +40 -0
- package/docs/errors/E1401.md +11 -3
- package/docs/errors/E1402.md +13 -5
- package/docs/errors/E1403.md +11 -3
- package/docs/errors/E1404.md +13 -3
- package/docs/errors/E1405.md +15 -4
- package/docs/errors/E1406.md +31 -5
- package/docs/errors/E1407.md +11 -3
- package/docs/errors/E1408.md +11 -3
- package/docs/errors/E1409.md +11 -3
- package/docs/errors/E1410.md +13 -5
- package/docs/errors/E1411.md +11 -3
- package/docs/errors/E1412.md +29 -6
- package/docs/errors/E1413.md +11 -3
- package/docs/errors/E1414.md +11 -3
- package/docs/errors/E1415.md +11 -3
- package/docs/errors/E1416.md +27 -6
- package/docs/errors/E1417.md +11 -3
- package/docs/errors/E1418.md +12 -3
- package/docs/errors/E1419.md +13 -5
- package/docs/errors/E1420.md +14 -6
- package/docs/errors/E1421.md +11 -3
- package/docs/errors/E1422.md +12 -3
- package/docs/errors/E1423.md +12 -3
- package/docs/errors/E1424.md +24 -5
- package/docs/errors/E1425.md +11 -3
- package/docs/errors/E1426.md +11 -3
- package/docs/errors/E1430.md +11 -3
- package/docs/errors/E1431.md +11 -3
- package/docs/errors/E1432.md +11 -3
- package/docs/errors/E1433.md +11 -3
- package/docs/errors/E1434.md +15 -6
- package/docs/errors/E1435.md +11 -3
- package/docs/errors/E1436.md +11 -3
- package/docs/errors/E1437.md +14 -6
- package/docs/errors/E1501.md +41 -6
- package/docs/errors/E1502.md +13 -3
- package/docs/errors/E1503.md +11 -3
- package/docs/errors/E1504.md +11 -3
- package/docs/errors/E1505.md +23 -5
- package/docs/errors/E1506.md +11 -3
- package/docs/errors/index.md +54 -30
- package/docs/getting-started/cdn.md +32 -10
- package/docs/getting-started/first-scene.md +21 -13
- package/docs/getting-started/hosting.md +152 -63
- package/docs/getting-started/install.md +44 -28
- package/docs/getting-started/network-use.md +33 -15
- package/docs/getting-started/project-structure.md +33 -12
- package/docs/getting-started/third-party-notices.md +12 -14
- package/docs/guides/accessibility.md +5 -5
- package/docs/guides/add-ons.md +86 -15
- package/docs/guides/agents.md +16 -9
- package/docs/guides/assets-pipeline.md +259 -82
- package/docs/guides/audio.md +115 -128
- package/docs/guides/baked-light-data.md +44 -23
- package/docs/guides/car-paint.md +38 -32
- package/docs/guides/content-pages.md +63 -35
- package/docs/guides/custom-passes.md +65 -22
- package/docs/guides/custom-shaders.md +59 -39
- package/docs/guides/debugging.md +74 -10
- package/docs/guides/deploying.md +85 -6
- package/docs/guides/deterministic-simulation.md +24 -17
- package/docs/guides/first-use-shaders.md +83 -45
- package/docs/guides/lens-kit.md +29 -26
- package/docs/guides/loading-screens.md +132 -47
- package/docs/guides/multiple-views.md +63 -13
- package/docs/guides/performance.md +192 -38
- package/docs/guides/phones.md +78 -15
- package/docs/guides/physics.md +7 -11
- package/docs/guides/screens.md +47 -33
- package/docs/guides/start-time.md +363 -0
- package/docs/guides/testing.md +152 -95
- package/docs/guides/ui-overlays.md +19 -14
- package/docs/guides/video-textures.md +14 -13
- package/docs/images/api/animation/character.webp +0 -0
- package/docs/images/api/animation/look-at-ring.webp +0 -0
- package/docs/images/api/animation/morph-tulips.webp +0 -0
- package/docs/images/api/animation/skeleton-lines.webp +0 -0
- package/docs/images/api/controls/gizmo-handles.webp +0 -0
- package/docs/images/api/controls/walk-and-fly.webp +0 -0
- package/docs/images/api/debug/debug-shapes.webp +0 -0
- package/docs/images/api/debug/levels-view.webp +0 -0
- package/docs/images/api/engine/transparent-canvas.webp +0 -0
- package/docs/images/api/feature-draws/feature-draw-clouds.webp +0 -0
- package/docs/images/api/feature-instances/compute-instances.webp +0 -0
- package/docs/images/api/feature-instances/instances-shadow.webp +0 -0
- package/docs/images/api/geometry/extra-shapes.webp +0 -0
- package/docs/images/api/geometry/generators.webp +0 -0
- package/docs/images/api/geometry/mesh-arrays.webp +0 -0
- package/docs/images/api/geometry/vertex-updates.webp +0 -0
- package/docs/images/api/grass/grass-grove.webp +0 -0
- package/docs/images/api/grass/grass-presets.webp +0 -0
- package/docs/images/api/grass/grass-shadow.webp +0 -0
- package/docs/images/api/impostors/impostor-handover.webp +0 -0
- package/docs/images/api/impostors/impostor-shadow.webp +0 -0
- package/docs/images/api/impostors/impostors-forest.webp +0 -0
- package/docs/images/api/lights/spot-cookies.webp +0 -0
- package/docs/images/api/lines/lines-lit.webp +0 -0
- package/docs/images/api/lines/lines-widths.webp +0 -0
- package/docs/images/api/materials/coat-and-sheen.webp +0 -0
- package/docs/images/api/materials/decals.webp +0 -0
- package/docs/images/api/materials/iridescence-and-anisotropy.webp +0 -0
- package/docs/images/api/materials/relief.webp +0 -0
- package/docs/images/api/materials/shader-inputs.webp +0 -0
- package/docs/images/api/materials/standard-grid.webp +0 -0
- package/docs/images/api/materials/subsurface.webp +0 -0
- package/docs/images/api/materials/translucency.webp +0 -0
- package/docs/images/api/objects/objects-turntable.webp +0 -0
- package/docs/images/api/particles/campfire.webp +0 -0
- package/docs/images/api/points/galaxy.webp +0 -0
- package/docs/images/api/reference/textures/texture-wrap.webp +0 -0
- package/docs/images/api/render/fullscreen-glow.webp +0 -0
- package/docs/images/api/render/reflection-mirror.webp +0 -0
- package/docs/images/api/render/security-camera.webp +0 -0
- package/docs/images/api/scene/aurora-sky-layer.webp +0 -0
- package/docs/images/api/sound/sound-demo.webp +0 -0
- package/docs/images/api/splats/splats-demo.webp +0 -0
- package/docs/images/api/sprites/sprites-lines.webp +0 -0
- package/docs/images/api/terrain/terrain-demo.webp +0 -0
- package/docs/images/api/textures/canvas-screen.webp +0 -0
- package/docs/images/api/textures/mipmaps.webp +0 -0
- package/docs/images/api/vertex-draws/rain.webp +0 -0
- package/docs/images/api/water/ocean.webp +0 -0
- package/docs/images/api/water/water-demo.webp +0 -0
- package/docs/images/api/water/water-rain.webp +0 -0
- package/docs/images/api/water/waterfall.webp +0 -0
- package/docs/images/concepts/assets/gltf-model.webp +0 -0
- package/docs/images/concepts/color-management/tone-mapped.webp +0 -0
- package/docs/images/concepts/culling/far-from-origin.webp +0 -0
- package/docs/images/concepts/instances/instances.webp +0 -0
- package/docs/images/concepts/instances/per-row-colors.webp +0 -0
- package/docs/images/concepts/large-worlds/large-world.webp +0 -0
- package/docs/images/concepts/lighting/area-lights.webp +0 -0
- package/docs/images/concepts/lighting/atmosphere.webp +0 -0
- package/docs/images/concepts/lighting/environment.webp +0 -0
- package/docs/images/concepts/lighting/light-shafts.webp +0 -0
- package/docs/images/concepts/lighting/reflection-probes.webp +0 -0
- package/docs/images/concepts/lod/forest.webp +0 -0
- package/docs/images/concepts/materials/weighted-transparency.webp +0 -0
- package/docs/images/concepts/post-processing/auto-exposure.webp +0 -0
- package/docs/images/concepts/post-processing/bounce-light.webp +0 -0
- package/docs/images/concepts/post-processing/depth-of-field.webp +0 -0
- package/docs/images/concepts/post-processing/post-effects-alley.webp +0 -0
- package/docs/images/concepts/post-processing/sharpen.webp +0 -0
- package/docs/images/concepts/post-processing/ssr-wet-street.webp +0 -0
- package/docs/images/concepts/render-layers/layers-cottages.webp +0 -0
- package/docs/images/concepts/shadows/hero-shadow.webp +0 -0
- package/docs/images/cookbook/index/picking.webp +0 -0
- package/docs/images/cookbook/index/time-of-day.webp +0 -0
- package/docs/images/errors/E1431/area-lights-no-tables.webp +0 -0
- package/docs/images/guides/custom-passes/reflection-water.webp +0 -0
- package/docs/images/guides/deterministic-simulation/replay-demo.webp +0 -0
- package/docs/images/guides/multiple-views/split-screen.webp +0 -0
- package/docs/images/guides/performance/overdraw-view.webp +0 -0
- package/docs/images/guides/testing/hold-mode-frame.webp +0 -0
- package/docs/images/index/showcase-island.webp +0 -0
- package/docs/images/porting/threejs-shaders/dissolve.webp +0 -0
- package/docs/images/shaders/builtins/builtins.webp +0 -0
- package/docs/images/shaders/surface-functions/custom-surface.webp +0 -0
- package/docs/images/shaders/surface-functions/vertex-offset.webp +0 -0
- package/docs/images/shots.json +2231 -0
- package/docs/index.md +18 -23
- package/docs/moves.json +1 -0
- package/docs/nav.json +300 -0
- package/docs/pages.md +230 -209
- package/docs/porting/react-three-fiber.md +225 -6
- package/docs/porting/threejs-loop-and-threads.md +217 -7
- package/docs/porting/threejs-mapping.md +1249 -233
- package/docs/porting/threejs-materials.md +218 -6
- package/docs/porting/threejs-overview.md +240 -7
- package/docs/porting/threejs-postprocessing.md +4 -8
- package/docs/porting/threejs-shaders.md +301 -6
- package/docs/porting/threejs-unsupported.md +83 -7
- package/docs/porting/verification.md +178 -6
- package/docs/shaders/builtins.md +15 -4
- package/docs/shaders/library.md +72 -45
- package/docs/shaders/surface-functions.md +59 -23
- package/docs/shaders/wgsl-rules.md +12 -5
- package/lib/debug/channel.d.ts +103 -0
- package/lib/debug/channel.js +269 -0
- package/lib/debug/debug.d.ts +11 -9
- package/lib/debug/draw.d.ts +11 -2
- package/lib/debug/draw.js +57 -6
- package/lib/debug/inspector.d.ts +60 -0
- package/lib/debug/inspector.js +475 -0
- package/lib/debug/overlay-look.d.ts +6 -0
- package/lib/debug/overlay-look.js +29 -7
- package/lib/debug/overlay.js +15 -11
- package/lib/debug/stats-options.d.ts +13 -0
- package/lib/debug/stats-panel.d.ts +22 -7
- package/lib/debug/stats-panel.js +80 -13
- package/lib/debug/stats.d.ts +2 -3
- package/lib/errors/codes.d.ts +17 -3
- package/lib/errors/codes.js +117 -105
- package/lib/errors/engine-error.js +25 -10
- package/lib/errors/fixes.d.ts +1 -0
- package/lib/errors/fixes.js +20 -19
- package/lib/generated/core.d.ts +1 -1
- package/lib/generated/core.js +1 -1
- package/lib/gpu/early-builds.d.ts +68 -0
- package/lib/gpu/early-builds.js +158 -0
- package/lib/gpu/pipeline-name.d.ts +6 -0
- package/lib/gpu/pipeline-name.js +23 -0
- package/lib/gpu/variants.d.ts +8 -2
- package/lib/gpu/variants.js +39 -7
- package/lib/gpu/webgl2/backend.d.ts +63 -2
- package/lib/gpu/webgl2/backend.js +226 -8
- package/lib/gpu/webgl2/programs.d.ts +18 -0
- package/lib/gpu/webgl2/programs.js +5 -2
- package/lib/gpu/webgpu/backend.d.ts +89 -2
- package/lib/gpu/webgpu/backend.js +255 -8
- package/lib/gpu/webgpu/pipelines.d.ts +13 -0
- package/lib/gpu/webgpu/pipelines.js +28 -14
- package/lib/index.d.ts +7 -5
- package/lib/index.js +3 -2
- package/lib/math/color.d.ts +5 -5
- package/lib/math/color.js +5 -5
- package/lib/math/mat4.d.ts +6 -12
- package/lib/math/mat4.js +6 -12
- package/lib/math/namespaces/quat.d.ts +3 -3
- package/lib/math/namespaces/quat.js +3 -3
- package/lib/math/quat.d.ts +8 -12
- package/lib/math/quat.js +8 -12
- package/lib/math/random.d.ts +2 -3
- package/lib/math/random.js +2 -3
- package/lib/math/types.d.ts +4 -4
- package/lib/math/vec3.d.ts +3 -6
- package/lib/math/vec3.js +3 -6
- package/lib/page/capabilities.d.ts +8 -8
- package/lib/page/capabilities.js +39 -25
- package/lib/page/check-store.d.ts +14 -2
- package/lib/page/check-store.js +34 -11
- package/lib/page/engine.d.ts +117 -31
- package/lib/page/engine.js +438 -99
- package/lib/page/first-frame.d.ts +16 -0
- package/lib/page/first-frame.js +35 -0
- package/lib/page/frame-stats.d.ts +34 -1
- package/lib/page/frame-stats.js +15 -0
- package/lib/page/label-loop.d.ts +7 -3
- package/lib/page/label-loop.js +26 -14
- package/lib/page/labels.d.ts +3 -3
- package/lib/page/pipeline-store.d.ts +25 -0
- package/lib/page/pipeline-store.js +84 -0
- package/lib/page/start-marker.d.ts +4 -1
- package/lib/page/start-marker.js +5 -2
- package/lib/page/stats-switch.js +2 -0
- package/lib/page/switches.d.ts +38 -6
- package/lib/page/switches.js +29 -5
- package/lib/quality/check.d.ts +24 -3
- package/lib/quality/check.js +21 -7
- package/lib/quality/chooser.d.ts +6 -0
- package/lib/quality/chooser.js +8 -0
- package/lib/quality/governor.d.ts +98 -6
- package/lib/quality/governor.js +250 -20
- package/lib/quality/preset-docs.d.ts +16 -1
- package/lib/quality/preset-docs.js +3 -0
- package/lib/quality/presets.d.ts +84 -7
- package/lib/quality/presets.js +94 -2
- package/lib/render/draw.d.ts +3 -2
- package/lib/render/draw.js +15 -5
- package/lib/render/load-draw.d.ts +7 -5
- package/lib/render/load-draw.js +7 -5
- package/lib/render/loss.d.ts +28 -10
- package/lib/render/loss.js +50 -22
- package/lib/render/recovery.d.ts +20 -0
- package/lib/render/recovery.js +44 -4
- package/lib/render/renderer.d.ts +85 -9
- package/lib/render/renderer.js +181 -42
- package/lib/render/scene-renderer.d.ts +19 -1
- package/lib/render/scene-renderer.js +25 -1
- package/lib/render/webgl2-renderers.js +8 -5
- package/lib/render/webgpu-renderers.js +5 -4
- package/lib/scene/animation.d.ts +28 -32
- package/lib/scene/animation.js +12 -15
- package/lib/scene/assets.d.ts +61 -86
- package/lib/scene/assets.js +103 -236
- package/lib/scene/background.d.ts +14 -18
- package/lib/scene/background.js +5 -2
- package/lib/scene/baked-light.d.ts +2 -2
- package/lib/scene/color.d.ts +3 -3
- package/lib/scene/downloads.d.ts +2 -0
- package/lib/scene/downloads.js +371 -0
- package/lib/scene/environment.d.ts +7 -7
- package/lib/scene/environment.js +1 -1
- package/lib/scene/fake-call-values.js +3 -3
- package/lib/scene/fog.d.ts +11 -4
- package/lib/scene/fog.js +8 -2
- package/lib/scene/frame-cameras.d.ts +35 -4
- package/lib/scene/frame-cameras.js +86 -10
- package/lib/scene/gltf.d.ts +33 -3
- package/lib/scene/gltf.js +78 -49
- package/lib/scene/grading.d.ts +2 -2
- package/lib/scene/grading.js +3 -3
- package/lib/scene/ktx2.d.ts +9 -1
- package/lib/scene/ktx2.js +3 -2
- package/lib/scene/level-rule.d.ts +121 -0
- package/lib/scene/level-rule.js +130 -0
- package/lib/scene/lines.d.ts +13 -17
- package/lib/scene/lines.js +3 -3
- package/lib/scene/lut.d.ts +1 -2
- package/lib/scene/lut.js +1 -2
- package/lib/scene/particles.d.ts +7 -3
- package/lib/scene/particles.js +3 -1
- package/lib/scene/picks.d.ts +2 -2
- package/lib/scene/pointer-events.d.ts +4 -7
- package/lib/scene/post.d.ts +39 -43
- package/lib/scene/post.js +4 -1
- package/lib/scene/prefab.d.ts +7 -8
- package/lib/scene/prefab.js +7 -8
- package/lib/scene/property-animation.d.ts +1 -1
- package/lib/scene/property-animation.js +1 -1
- package/lib/scene/queries.d.ts +7 -13
- package/lib/scene/resources.d.ts +238 -261
- package/lib/scene/resources.js +179 -81
- package/lib/scene/scene.d.ts +167 -120
- package/lib/scene/scene.js +243 -103
- package/lib/scene/serial-loads.d.ts +29 -0
- package/lib/scene/serial-loads.js +68 -0
- package/lib/scene/shader-preloads.d.ts +34 -0
- package/lib/scene/shader-preloads.js +38 -0
- package/lib/scene/sprites.d.ts +14 -17
- package/lib/scene/sprites.js +5 -6
- package/lib/scene/textures.d.ts +11 -12
- package/lib/scene/textures.js +9 -10
- package/lib/scene/time-of-day.d.ts +11 -7
- package/lib/scene/time-of-day.js +11 -8
- package/lib/scene/vertex-draws.d.ts +5 -4
- package/lib/scene/vertex-draws.js +7 -5
- package/lib/shader-artifact.json +1 -0
- package/lib/shared/core.d.ts +5 -0
- package/lib/shared/core.js +1 -0
- package/lib/shared/import-once.d.ts +6 -0
- package/lib/shared/import-once.js +19 -0
- package/lib/shared/labels.d.ts +5 -2
- package/lib/shared/labels.js +5 -2
- package/lib/shared/metrics.d.ts +38 -0
- package/lib/shared/metrics.js +62 -1
- package/lib/shared/permutation-words.d.ts +2 -0
- package/lib/shared/permutation-words.js +8 -0
- package/lib/shared/recording.d.ts +13 -5
- package/lib/shared/recording.js +31 -10
- package/lib/shared/run-task.js +7 -1
- package/lib/shared/sketch-data.d.ts +9 -0
- package/lib/shared/sketch-data.js +57 -0
- package/lib/shared/task-pending.d.ts +12 -0
- package/lib/shared/task-pending.js +61 -1
- package/lib/shared/tasks.js +79 -32
- package/lib/shared/version.d.ts +17 -1
- package/lib/shared/version.js +19 -1
- package/lib/shared/wasm.d.ts +12 -4
- package/lib/shared/wasm.js +50 -27
- package/lib/shared/worker-start.d.ts +7 -0
- package/lib/shared/worker-start.js +27 -0
- package/lib/sketch/define-sketch.d.ts +51 -7
- package/lib/sketch/define-sketch.js +2 -1
- package/lib/sketch/input.d.ts +2 -2
- package/lib/sketch/preset-check.d.ts +20 -6
- package/lib/sketch/preset-check.js +42 -17
- package/lib/sketch/quality.d.ts +69 -11
- package/lib/sketch/quality.js +54 -13
- package/lib/sketch/runner.d.ts +80 -9
- package/lib/sketch/runner.js +390 -52
- package/lib/sketch/ui.d.ts +5 -8
- package/lib/sketch/ui.js +4 -2
- package/lib/stats.d.ts +1 -0
- package/lib/workers/probe-worker.d.ts +5 -0
- package/lib/workers/probe-worker.js +13 -4
- package/lib/workers/protocol.d.ts +71 -13
- package/lib/workers/protocol.js +4 -0
- package/lib/workers/render-worker.js +29 -5
- package/lib/workers/sketch-worker.js +108 -16
- package/package.json +2 -2
package/docs/api/engine.md
CHANGED
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
---
|
|
2
2
|
id: api/engine
|
|
3
3
|
title: "Page API: createEngine"
|
|
4
|
-
status: experimental
|
|
5
|
-
since: "0.1"
|
|
6
4
|
summary: "createEngine options and start errors; memory; capabilities and mode; pausing, detaching, failures, measuring, captureFrame, messages, pointer lock and destroy."
|
|
7
5
|
---
|
|
8
6
|
|
|
9
7
|
# Page API: createEngine
|
|
10
8
|
|
|
11
|
-
> Roadmap step 0.1, first released in null3D 0.1.0. Step 0.2 adds `requestPointerLock`. The API is experimental, so it can still change between versions.
|
|
12
|
-
|
|
13
9
|
`createEngine` starts the engine on a canvas and runs a sketch. It returns an `Engine`, the page's handle on the running engine. The page keeps the HTML, and the sketch builds the scene in a worker of its own.
|
|
14
10
|
|
|
15
11
|
```ts
|
|
@@ -26,21 +22,26 @@ try {
|
|
|
26
22
|
engine.onFailure((error) => console.error(error.code, error.message));
|
|
27
23
|
await engine.firstFrame; // the first frame is on the screen: remove the loading screen
|
|
28
24
|
} catch (error) {
|
|
29
|
-
// The browser cannot run the engine
|
|
25
|
+
// The browser cannot run the engine, or the engine stopped before its first frame: show the page
|
|
26
|
+
// without the scene.
|
|
30
27
|
}
|
|
31
28
|
```
|
|
32
29
|
|
|
33
30
|
## The start
|
|
34
31
|
|
|
35
|
-
`createEngine` tests what the browser offers, and picks the build and the GPU path from those tests,
|
|
32
|
+
`createEngine` tests what the browser offers, and picks the build and the GPU path (tier) from those tests, not from browser or GPU names. One later choice on WebGPU does read names: a start-up measurement of the draw path runs only on an Apple GPU in WebKit ([Never branch on GPU names](../concepts/backends.md#never-branch-on-gpu-names)). It starts the engine's threads, loads the sketch module and runs the sketch's setup. It resolves once the setup has run.
|
|
33
|
+
|
|
34
|
+
`engine.firstFrame` resolves once the GPU has finished the first frame. If the engine stops drawing before that frame, `engine.firstFrame` rejects with the failure that ended its frames, such as [E1404](../errors/E1404.md) when the thread that draws fails. A destroy before the first frame rejects it with [E1420](../errors/E1420.md).
|
|
35
|
+
|
|
36
|
+
When the engine chose the preset itself, its [preset check](../concepts/quality-presets.md#the-preset-check) measures the first frames of play, and `engine.presetChecked` resolves once the check has ended. With the `presetCheck` option's `before-play`, the check runs before play, and `createEngine` waits for it. The first frame is then on the screen before `createEngine` resolves. On a repeat visit, the engine takes the check's stored result instead, and runs no check.
|
|
36
37
|
|
|
37
38
|
`onProgress` reports each stage of the start, in this order:
|
|
38
39
|
|
|
39
40
|
- `core-download`, as the engine core's file downloads, with the bytes that have arrived and the
|
|
40
41
|
length that the server announced;
|
|
41
42
|
- `core`, once the engine core is compiled and the GPU paths are tested;
|
|
42
|
-
- `sketch`, after the sketch's setup, and after the preset check when
|
|
43
|
-
- `first-frame`, once the GPU has finished the first frame.
|
|
43
|
+
- `sketch`, after the sketch's setup, and after the preset check when the `presetCheck` option is `before-play`;
|
|
44
|
+
- `first-frame`, once the GPU has finished the first frame after the setup. It does not wait for a preset check during play.
|
|
44
45
|
|
|
45
46
|
The handler's second argument carries a stage's figures: `done` and `total`, in bytes, for
|
|
46
47
|
`core-download`. The handler gets it only while the stage has figures. The total is 0 when the
|
|
@@ -58,7 +59,7 @@ An `AbortSignal` in `signal` cancels a start in progress. Then `createEngine` st
|
|
|
58
59
|
| --- | --- |
|
|
59
60
|
| [E1407](../errors/E1407.md) | The `hold` option or the `?hold=` switch gives a time that is not a number of seconds from 0 to 600. |
|
|
60
61
|
| [E1415](../errors/E1415.md) | The sketch would run on the page's main thread, where another engine still runs its sketch. |
|
|
61
|
-
| [E1213](../errors/E1213.md) | An option is out of its range: `preset`, `targetFps`, `maxPixelRatio`, `antialias
|
|
62
|
+
| [E1213](../errors/E1213.md) | An option is out of its range: `preset`, `presetCheck`, `targetFps`, `maxPixelRatio`, `antialias` or a shadow option. It can also be `depthPrepass`, `momentTransparency`, `gpuOcclusion`, `softwareOcclusion`, `morphTargets`, `cloudSteps` or `textureMemoryMiB`. It can also be `expectedObjects`, `maxLabels` or `maxLabels3d`. The options table gives each range. `sketchData` that is not plain JSON data, or that takes more than 64 KiB as JSON, also fails with it. |
|
|
62
63
|
| [E1409](../errors/E1409.md) | The `memory` option asks for a maximum that is not a whole number of MiB from 256 to 4096. |
|
|
63
64
|
| [E1303](../errors/E1303.md) | The browser runs WebAssembly without SIMD. |
|
|
64
65
|
| [E1306](../errors/E1306.md) | The browser runs the WebKit engine of a Safari before 18: Safari 17 or older, or any browser on iOS or iPadOS 17 or older. |
|
|
@@ -66,7 +67,7 @@ An `AbortSignal` in `signal` cancels a start in progress. Then `createEngine` st
|
|
|
66
67
|
| [E1406](../errors/E1406.md) | The engine core's WebAssembly file did not download. |
|
|
67
68
|
| [E1418](../errors/E1418.md) | The page's Content-Security-Policy blocks WebAssembly: its `script-src` lacks `'wasm-unsafe-eval'`. |
|
|
68
69
|
| [E1109](../errors/E1109.md) | The browser refused the engine's memory, even after about 45 seconds of tries. |
|
|
69
|
-
| [E1402](../errors/E1402.md) | The engine core's file comes from another build than the engine's JavaScript. Every build checks that the threaded core imports shared memory, and development builds also check each function.
|
|
70
|
+
| [E1402](../errors/E1402.md) | The engine core's file comes from another build than the engine's JavaScript. Every build checks that the threaded core imports shared memory, and development builds also check each function. |
|
|
70
71
|
| [E1410](../errors/E1410.md) | The sketch module did not load, at the first import or the second: it did not download, or its code threw an error while it loaded. |
|
|
71
72
|
| [E1401](../errors/E1401.md) | The sketch module's default export is not `defineSketch(...)`. |
|
|
72
73
|
| [E1214](../errors/E1214.md) | An option of `defineSketch` is out of its range. |
|
|
@@ -81,6 +82,8 @@ An error that the sketch's setup throws also rejects the start ([Sketch API](ske
|
|
|
81
82
|
|
|
82
83
|
`canvas` and `sketch` are required. `sketch` is the address of the sketch module, usually `new URL('./sketch.ts', import.meta.url)`.
|
|
83
84
|
|
|
85
|
+
`sketchData` gives the setup a start state, such as the section that the address names ([Start data](page.md#start-data)).
|
|
86
|
+
|
|
84
87
|
The canvas takes its size from CSS. The engine sizes the canvas's drawing buffer to that size times the screen's pixel ratio, up to the cap that `maxPixelRatio` or the preset sets.
|
|
85
88
|
|
|
86
89
|
- A canvas that no CSS sizes shows its drawing buffer at one CSS pixel per buffer pixel, so each new buffer would make it larger. The engine sets the CSS width and height that the canvas shows when the engine starts.
|
|
@@ -89,26 +92,29 @@ The canvas takes its size from CSS. The engine sizes the canvas's drawing buffer
|
|
|
89
92
|
| Option | Default | What it does |
|
|
90
93
|
| --- | --- | --- |
|
|
91
94
|
| `preset` | `'auto'` | The quality preset, which the engine chooses for the device unless the page names one: [Quality presets](../concepts/quality-presets.md). The `?preset=` switch wins over it. |
|
|
92
|
-
| `
|
|
95
|
+
| `presetCheck` | `'during-play'` | When the engine checks a preset that it chose: in the first frames of play, while the loading screen is gone, or `'before-play'`, with `createEngine` waiting for it. `engine.presetChecked` resolves once the check has ended: [The preset check](../concepts/quality-presets.md#the-preset-check). The `?preset-check=` switch wins over it. |
|
|
96
|
+
| `targetFps` | The display's rate, at most 60 | The frame rate that the engine defends. `'display'` defends the display's full rate, such as 120 or 144 for a game. A whole number caps the target at that rate: [Quality presets](../concepts/quality-presets.md#the-target-frame-rate). The `?target-fps=` switch wins over it. |
|
|
93
97
|
| `maxPixelRatio` | The preset's cap | Caps the screen's pixel ratio that the engine draws at, in place of the preset's cap |
|
|
94
98
|
| `antialias` | The preset's mode | `'msaa'`, `'fxaa'` or `'none'`, in place of the preset's anti-aliasing mode: [GPU tiers and backends](../concepts/backends.md#color-and-anti-aliasing-on-each-tier) |
|
|
95
|
-
| `hdr` | The device's path | `false` draws the scene into 8-bit color, where each material's shader applies the output transform, instead of HDR color, which the final pass tone maps. Both paths
|
|
99
|
+
| `hdr` | The device's path | `false` draws the scene into 8-bit color, where each material's shader applies the output transform, instead of HDR color, which the final pass tone maps. Both paths honor a material's `toneMapped: false`, and the 8-bit path also honors it on a blended surface: [Materials that keep their display color](../concepts/color-management.md#materials-that-keep-their-display-color). The `?hdr=off` switch takes that path too. |
|
|
96
100
|
| `shadowTiles`, `shadowTileSize`, `pointLightShadows` | The preset's values | The shadows of spot and point lights, in place of the preset's settings: [Shadows](../concepts/shadows.md#settings). Each is fixed while the engine runs. |
|
|
97
|
-
| `cloudSteps` | The preset's value | The steps of each ray of the sky's volumetric cloud tier, in place of the preset's value: 0 draws the flat layer, and a number above 0 the volumetric clouds, at that many steps. WebGL2 and compatibility mode stop at Medium, so a page there reaches the tier with this option or with `quality.set`. The tier's noise and shaders load at its first use: [Quality API](quality.md#settings).
|
|
98
|
-
| `shadowCascades`, `shadowMapSize`, `heroTileSize`, `gpuOcclusion`, `morphTargets`, `softwareOcclusion`, `textureMemoryMiB` | The preset's values | These settings, in place of the preset's values: [Quality API](quality.md#settings).
|
|
101
|
+
| `cloudSteps` | The preset's value | The steps of each ray of the sky's volumetric cloud tier, in place of the preset's value: 0 draws the flat layer, and a number above 0 the volumetric clouds, at that many steps. WebGL2 and compatibility mode stop at Medium, so a page there reaches the tier with this option or with `quality.set`. The tier's noise and shaders load at its first use: [Quality API](quality.md#settings). |
|
|
102
|
+
| `shadowCascades`, `shadowMapSize`, `heroTileSize`, `gpuOcclusion`, `morphTargets`, `softwareOcclusion`, `textureMemoryMiB` | The preset's values | These settings, in place of the preset's values: [Quality API](quality.md#settings). |
|
|
99
103
|
| `depthPrepass` | `true` on WebGL2 and `false` on WebGPU, on every preset | `true` draws the depth of the opaque objects before they are shaded: [The depth prepass](../concepts/quality-presets.md#the-depth-prepass). The `?prepass=` switch wins over it. |
|
|
100
|
-
| `
|
|
104
|
+
| `momentTransparency` | `false` on every preset | `true` blends the camera's blended surfaces in a layer that needs no sort, and draws those surfaces twice: [Moment transparency](materials.md#moment-transparency). It stays fixed while the engine runs. The `?moments=` switch wins over it. |
|
|
105
|
+
| `keepTextureCopies` | `true` on phones and tablets, `false` on desktops | `true` keeps the engine's copy of each texture's texels after their upload, so a texture draws with its map again after the browser takes the GPU away. It costs about one more copy of each image in memory: [When the GPU goes away](../concepts/backends.md#when-the-gpu-goes-away). With it, the engine also gives its GPU back while the page sits in the browser's back-forward cache. |
|
|
101
106
|
| `gpu` | `'auto'` | Forces a GPU path, for tests only. The `?gpu=` switch in the page's address wins over it, and also takes `compat` for WebGPU's compatibility mode. |
|
|
102
|
-
| `powerPreference` | `'high-performance'` | Picks the GPU on a device that has two. `'low-power'` saves battery. |
|
|
107
|
+
| `powerPreference` | `'high-performance'` | Picks the GPU on a device that has two. `'low-power'` saves battery. The engine's start-up tests of the GPU run on the GPU that it picks. |
|
|
103
108
|
| `latency` | `'pipelined'` | The latency mode, `'pipelined'` or `'low'`: [Architecture](../concepts/architecture.md#latency-modes). The `?latency=` switch wins over it, and the single-threaded build ignores it. Where no worker can draw, the engine runs pipelined. |
|
|
104
109
|
| `transparent` | false | Makes a see-through canvas: [A transparent canvas](#a-transparent-canvas) |
|
|
105
110
|
| `largeWorld` | false | Keeps the positions of objects exact at any distance from the origin, for scenes the size of a planet: [Large worlds and precision](../concepts/large-worlds.md#large-world-mode) |
|
|
106
111
|
| `sketchThread` | `'worker'` | The thread that runs the sketch. `'main'` runs it on the page's main thread, where it can reach the DOM: [Where the sketch runs](../concepts/architecture.md#where-the-sketch-runs). The `?sketch-thread=` switch wins over it, and the single-threaded build always runs the sketch on the main thread. |
|
|
107
112
|
| `memory` | `{ maximumMiB: 1024 }` | The most memory that the engine's threads share: [Memory](#memory) |
|
|
108
|
-
| `expectedObjects` | None | The objects that the scene starts with room for, from 1 to 1,048,575, in place of 1,023. A scene that knows its size never grows its tables during play: [Scene limits](scene.md#limits).
|
|
109
|
-
| `maxLabels` | `4096` | The most labels that the sketch tracks at once, from 1 to 65,536: [
|
|
110
|
-
| `maxLabels3d` | `256` | The most labels whose `transform` is `'world'` or `'billboard'`, which are planes of the scene, from 0 to 65,536: [Labels as planes of the scene](ui.md#labels-as-planes-of-the-scene).
|
|
113
|
+
| `expectedObjects` | None | The objects that the scene starts with room for, from 1 to 1,048,575, in place of 1,023. A scene that knows its size never grows its tables during play: [Scene limits](scene.md#limits). |
|
|
114
|
+
| `maxLabels` | `4096` | The most labels that the sketch tracks at once, from 1 to 65,536: [Labels that follow objects](ui.md). |
|
|
115
|
+
| `maxLabels3d` | `256` | The most labels whose `transform` is `'world'` or `'billboard'`, which are planes of the scene, from 0 to 65,536: [Labels as planes of the scene](ui.md#labels-as-planes-of-the-scene). |
|
|
111
116
|
| `onProgress` | None | Reports each stage of the start, and a download stage's bytes |
|
|
117
|
+
| `sketchData` | None | Start data that the sketch's setup reads as `ctx.data`, before the first frame and in hold mode. It takes plain JSON data, up to 64 KiB as JSON, and another value fails with [E1213](../errors/E1213.md). A recording keeps it: [Start data](page.md#start-data) |
|
|
112
118
|
| `onSketchMessage` | None | Receives the sketch's messages from the start of its setup: [Messages](page.md) |
|
|
113
119
|
| `onSketchError` | None | Receives each distinct error that the sketch's frame code throws while the engine runs: [The running engine](#the-running-engine) |
|
|
114
120
|
| `onWorkerRetry` | None | Called when the engine starts a second copy of a worker whose script did not load: [The start](#the-start) |
|
|
@@ -117,12 +123,18 @@ The canvas takes its size from CSS. The engine sizes the canvas's drawing buffer
|
|
|
117
123
|
| `input` | true | `false` keeps the engine from listening for input, for a page whose input another library records. The sketch's `ctx.input` then stays at rest, and `requestPointerLock()` fails with [E1426](../errors/E1426.md): [Input off](input.md#input-off) |
|
|
118
124
|
| `preload` | None | Features whose shaders load before the first frame, such as `['skinning', 'bloom']`, for a game that must fetch nothing while it plays. Each feature's shaders otherwise download the first time the sketch uses it: [Loading screens](../guides/loading-screens.md). A name that the engine does not know throws [E1421](../errors/E1421.md). |
|
|
119
125
|
| `still` | true | `false` draws every frame of a view that holds still, which otherwise blends its frames into a sharper picture and then stops drawing until something changes: [Still-camera accumulation](../concepts/post-processing.md#still-camera-accumulation). The `?still-camera=off` switch turns it off too. |
|
|
120
|
-
| `stats` | false | `true` shows the stats overlay from the first frame,
|
|
126
|
+
| `stats` | false | `true` shows the stats overlay from the first frame, `{ collapsed: true }` shows it with its card closed, and `{ corner: 'bottom-right' }` puts it over the canvas's bottom-right corner: [Stats overlay and frame figures](debug.md#stats-overlay-and-frame-figures). The `?stats` switch shows it too, and `?stats=off` hides it. A held engine shows no overlay. |
|
|
127
|
+
|
|
128
|
+
A value outside its range fails the start with [E1213](../errors/E1213.md), except `memory`, which fails with [E1409](../errors/E1409.md).
|
|
121
129
|
|
|
122
130
|
## A transparent canvas
|
|
123
131
|
|
|
124
132
|
With `transparent: true`, the page shows through wherever no object draws. The canvas holds premultiplied alpha, the form that browsers composite. The sketch can still set a background with `scene.setBackground`, which makes the canvas opaque again.
|
|
125
133
|
|
|
134
|
+

|
|
135
|
+
|
|
136
|
+
A see-through canvas over a page, with a depth-only plane.
|
|
137
|
+
|
|
126
138
|
```ts
|
|
127
139
|
const engine = await createEngine({
|
|
128
140
|
canvas,
|
|
@@ -131,7 +143,7 @@ const engine = await createEngine({
|
|
|
131
143
|
});
|
|
132
144
|
```
|
|
133
145
|
|
|
134
|
-
Use it to put a model over the page's own background, such as a product on a marketing page. [Color management](../concepts/color-management.md#transparent-canvases) covers how the edges of objects blend with the page.
|
|
146
|
+
Use it to put a model over the page's own background, such as a product on a marketing page. [Color management](../concepts/color-management.md#transparent-canvases) covers how the edges of objects blend with the page. The [depth-only holdout demo](https://github.com/null3d-engine/null3d/tree/main/examples/depth-only) shows the pattern. The demos' shared runner starts the engine with the option, not the demo's sketch.
|
|
135
147
|
|
|
136
148
|
## Memory
|
|
137
149
|
|
|
@@ -143,43 +155,111 @@ const engine = await createEngine({ canvas, sketch, memory: { maximumMiB: 2048 }
|
|
|
143
155
|
|
|
144
156
|
The browser reserves address space for the whole maximum when the engine starts, and the memory grows into it as the scene needs. Every other engine and WebAssembly module on the page, such as a physics engine, shares the address space that is left. So a larger maximum leaves less room for them. In Safari on an iPad Pro, a page holds the memories of 6 engines at 1024 MiB, and of 3 at 4096 MiB.
|
|
145
157
|
|
|
146
|
-
Ask for more only when a scene needs it.
|
|
158
|
+
Ask for more only when a scene needs it. A scene that needs more memory than the maximum fails with [E1109](../errors/E1109.md). A maximum that is not a whole number of MiB from 256 to 4096 fails the start with [E1409](../errors/E1409.md).
|
|
159
|
+
|
|
160
|
+
<details>
|
|
161
|
+
<summary>Technical details: how much memory a scene takes</summary>
|
|
162
|
+
|
|
163
|
+
- Each instance row takes about 210 bytes of engine memory, so rows alone fill 1024 MiB at about 5 million. Leave room for the meshes and the rest of the scene, or ask for a larger maximum.
|
|
164
|
+
- Each place for an object takes about 267 bytes in the scene's tables.
|
|
165
|
+
- While the tables grow, the old and the new tables both take memory for a moment.
|
|
166
|
+
|
|
167
|
+
</details>
|
|
147
168
|
|
|
148
169
|
The single-threaded build's memory is not shared. It grows as the scene needs, so the option does not change it. The `?memory=<MiB>` switch in the page's address wins over the option, for tests.
|
|
149
170
|
|
|
150
171
|
## What the engine reports
|
|
151
172
|
|
|
152
|
-
- `engine.capabilities` gives the GPU path
|
|
153
|
-
- `engine.mode` gives
|
|
173
|
+
- `engine.capabilities` gives the GPU path that the engine chose and what that path offers: its tier, its features and limits, HDR, depth, and the most objects it draws. [EngineCapabilities](reference/engine.md#enginecapabilities) lists every field. [GPU tiers and backends](../concepts/backends.md) explains each.
|
|
174
|
+
- `engine.mode` gives how the engine runs on this device: its build, its threads, its quality preset and its memory maximum. [EngineMode](reference/engine.md#enginemode) lists every field. `presetCheck` is null while a check runs during play, and `engine.presetChecked` resolves when the check is done. The job workers start as the work grows ([Architecture](../concepts/architecture.md#when-the-job-workers-start)).
|
|
154
175
|
- `engine.report` holds every result of the start's tests, as plain JSON.
|
|
155
176
|
|
|
156
177
|
## The running engine
|
|
157
178
|
|
|
158
179
|
- `setPaused(true)` stops the sketch's frames, and `setPaused(false)` resumes them. The first step after a pause is 0 seconds.
|
|
159
180
|
- `detach()` takes the canvas off the page and pauses the engine, and `attach(container)` puts it back. Use them when a single-page app leaves the view with the canvas and comes back. The engine keeps its threads, its GPU resources and the scene.
|
|
160
|
-
- `onFailure(handler)` receives a failure after the start.
|
|
161
|
-
- `onStop(handler)` calls the handler once, when the engine stops drawing for good. That happens as `destroy()` begins, or at a failure after which it draws no new frames
|
|
181
|
+
- `onFailure(handler)` receives a failure after the start. A failure that ends the frames reaches these handlers before the `onStop` handlers. The first handler that attaches after a failure that no handler heard still receives it, and the engine also logs the failure to the console. The handler is the only place where these failures show: no promise rejects for them. [Failures after the start](#failures-after-the-start) lists each code and what happens next.
|
|
182
|
+
- `onStop(handler)` calls the handler once, when the engine stops drawing for good. That happens as `destroy()` begins, or at a failure after which it draws no new frames. At such a failure, the `onFailure` handlers hear it first.
|
|
183
|
+
- A handler added after that runs at once. A handler that throws reaches the console, and the other handlers and the stop go on. Use it to end the page's own work for the engine, such as a frame loop that sends the sketch messages. It returns a function that removes the handler.
|
|
162
184
|
- `onSketchError(handler)` receives each distinct error that the sketch's frame code threw, or a core call in a frame. The engine keeps drawing frames, so such an error does not stop it. `measure()` counts each frame whose update failed in `updateErrors`, and leaves it out of `updatedFps`. Without a handler, the error reaches the console. The `onSketchError` option adds a handler from the start.
|
|
163
185
|
- `simulateGpuLoss()` acts out a loss of the GPU, so you can test how the page handles one. The engine starts a new GPU device and draws the whole scene again.
|
|
164
186
|
- `measure(seconds)` measures the running engine: CPU time per frame by thread, GPU time, frame intervals, uploads, draw calls, memory and load time. [Performance guide](../guides/performance.md) explains the numbers. It measures whatever build the page runs. In a development build, the development checks add to the CPU times, so time a production build ([Measure fairly](../guides/performance.md#measure-fairly)).
|
|
165
|
-
- `stats(true)` shows the stats overlay over the canvas, and `stats(false)` hides it: [Stats overlay and frame figures](debug.md#stats-overlay-and-frame-figures). Options in place of `true` set whether the card starts closed, on a shown overlay too. The sketch's `debug.stats` shows and hides the same overlay, and the last call from either side wins.
|
|
187
|
+
- `stats(true)` shows the stats overlay over the canvas, and `stats(false)` hides it: [Stats overlay and frame figures](debug.md#stats-overlay-and-frame-figures). Options in place of `true` set whether the card starts closed and the canvas's corner that the overlay sits in, on a shown overlay too. The sketch's `debug.stats` shows and hides the same overlay, and the last call from either side wins.
|
|
166
188
|
- `capture()` resolves with a PNG image of the next frame that the engine draws: [Screenshots](#screenshots).
|
|
167
|
-
- `captureFrame()` returns the pixels of the next frame that the engine draws, as RGBA8 rows, top row first.
|
|
189
|
+
- `captureFrame()` returns the pixels of the next frame that the engine draws, as RGBA8 rows, top row first. Tests use it: [Testing your sketch](../guides/testing.md).
|
|
190
|
+
|
|
191
|
+
<details>
|
|
192
|
+
<summary>Technical details: how captureFrame reads a frame</summary>
|
|
193
|
+
|
|
194
|
+
The thread that draws waits for its frame loop to take a new frame, then draws that frame again offscreen and reads it back. So captures back to back give newer frames, even on a slow GPU whose readback holds that thread up. In hold mode it returns the held frame and draws nothing. On a transparent canvas the pixels keep their premultiplied alpha.
|
|
195
|
+
|
|
196
|
+
</details>
|
|
197
|
+
|
|
198
|
+
- `saveRecording()` resolves with the recording of the session so far, or `undefined` when the page records none. A page records with the `?record` switch, and `?replay=<file>` plays a saved recording: [Record a session that went wrong](../guides/testing.md#record-a-session-that-went-wrong).
|
|
168
199
|
- `postToSketch` and `onSketchMessage` send and receive [messages](page.md).
|
|
169
|
-
- `
|
|
200
|
+
- `inspect(call, args)` runs an inspection call against the live scene, for the in-page inspector and the MCP server. The method exists only in a development build, which carries the channel, and a production build leaves it out. Code that uses it checks for it first: `await engine.inspect?.('objects')`. [Debugging](../guides/debugging.md#the-in-page-inspector) shows the calls.
|
|
201
|
+
|
|
202
|
+
<details>
|
|
203
|
+
<summary>Technical details: the inspection calls</summary>
|
|
204
|
+
|
|
205
|
+
`inspect` takes `objects`, `object`, `setObject`, `setMaterial`, `stats`, `errors`, `graph`, `setQuality`, `highlight` and `info`. The call runs between frames, in the thread that runs the sketch, and returns a JSON-safe value. The page answers `capture` itself, with `{ png, bytes }`: the PNG image of the next frame as base64 text, and its size in bytes.
|
|
206
|
+
|
|
207
|
+
</details>
|
|
208
|
+
|
|
209
|
+
- `labels.bind(id, element)` moves an HTML element over the label that the sketch tracks under `id`: [Labels that follow objects](ui.md).
|
|
170
210
|
- `registerVideo(video, { name, maxSize, frameRate })` shows a video element on the page as a texture in the sketch, which makes it with `textures.fromVideo(name)`: [Video textures](../guides/video-textures.md). The page sends one image per frame that the video presents, scaled to `maxSize`, 512 texels by default. The call returns a function that stops the frames.
|
|
171
|
-
- `requestPointerLock()` locks the pointer to the canvas, for [first-person controls](controls.md#pointer-lock) and games that turn with the mouse. Call it in a click or key handler: browsers lock the pointer only right after the user acts. It resolves once the lock begins. It fails with [E1425](../errors/E1425.md) when the browser refuses the lock: on a phone, in a frame without `allow-pointer-lock`, or just after the user pressed Esc.
|
|
211
|
+
- `requestPointerLock()` locks the pointer to the canvas, for [first-person controls](controls.md#pointer-lock) and games that turn with the mouse. Call it in a click or key handler: browsers lock the pointer only right after the user acts. It resolves once the lock begins. It fails with [E1425](../errors/E1425.md) when the browser refuses the lock: on a phone, in a frame without `allow-pointer-lock`, or just after the user pressed Esc.
|
|
212
|
+
- While the lock holds, the sketch's `input.pointer.locked` is true. The user ends the lock with Esc, and the page with `document.exitPointerLock()`. Destroying the engine ends a lock that it took or that its input read.
|
|
213
|
+
|
|
214
|
+
<details>
|
|
215
|
+
<summary>Technical details: pointer lock in edge cases</summary>
|
|
216
|
+
|
|
217
|
+
The option `{ unadjustedMovement: true }` asks for the mouse's raw movement, which some browsers cannot give. On an engine started with `input: false`, the call fails with [E1426](../errors/E1426.md): the code that records the page's input locks the canvas itself. Destroying the engine then leaves that lock.
|
|
218
|
+
|
|
219
|
+
</details>
|
|
220
|
+
|
|
172
221
|
- `destroy()` stops the engine and its threads, and the engine cannot start again. The sketch's `onDestroy` runs first, and every later call from the sketch's code fails with [E1420](../errors/E1420.md). Wait for its promise before you start another engine on the same page.
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
222
|
+
|
|
223
|
+
### Failures after the start
|
|
224
|
+
|
|
225
|
+
| Code | What happens next |
|
|
226
|
+
| --- | --- |
|
|
227
|
+
| [E1302](../errors/E1302.md) | The browser took the GPU away, and no new device started. The engine stops drawing new frames: destroy it and start again. |
|
|
228
|
+
| [E1404](../errors/E1404.md) | An engine thread, or the drawing on the page, failed. The engine stops drawing new frames: destroy it and start again. |
|
|
229
|
+
| [E1424](../errors/E1424.md) | A file of a custom shader's builds that a pipeline needs did not download. The engine stops drawing new frames: destroy it and start again. |
|
|
230
|
+
| [E1405](../errors/E1405.md) | A job worker did not start. The engine draws on without that worker's share of the work. |
|
|
231
|
+
| [E1304](../errors/E1304.md) | The GPU ran out of memory. The engine draws on without the objects that failed. |
|
|
232
|
+
| [E1305](../errors/E1305.md) | The GPU rejected the engine's work. The engine draws on without the objects that failed. |
|
|
233
|
+
| [E1307](../errors/E1307.md) | The GPU's driver refused a pipeline of the scene's objects twice. The engine draws on without the objects that failed. |
|
|
234
|
+
|
|
235
|
+
### Destroy and start again
|
|
236
|
+
|
|
237
|
+
A new engine can start on the canvas of an engine that you destroyed. Its start waits until the old engine has stopped, so it can begin before `destroy()` resolves. React's StrictMode needs this, because it starts an effect twice on one `<canvas>`. A canvas that a worker drew on stays with that worker, so the new engine needs the same thread options as the old one. That worker ends when the canvas leaves the page or the page goes away.
|
|
238
|
+
|
|
239
|
+
It also ends when the browser refuses memory for a new engine while no engine runs on the canvas. A new engine on its canvas then fails with [E1419](../errors/E1419.md), as on a canvas whose engine still runs.
|
|
240
|
+
|
|
241
|
+
The page keeps the memory that a stopped engine's threads shared for about 30 seconds, and the next engine with the same maximum takes it. Call `destroy({ release: true })` when the page will not start the engine again soon: the browser can then free the memory at once. An engine whose threads did not all stop cleanly leaves no memory to reuse. The single-threaded build's memory is not shared, and the page keeps its core for the next engine.
|
|
242
|
+
|
|
243
|
+
In Safari, a stopped engine's canvas that stays in the page keeps the engine's memory, 1 GiB by default, until that worker ends. A new engine that needs the room gets it, but other code does not: a page that also loads a large WebAssembly module can run out of room. So remove the canvas from the page once you are done with it.
|
|
244
|
+
|
|
245
|
+
<details>
|
|
246
|
+
<summary>Technical details: memory and the GPU when a page goes away</summary>
|
|
247
|
+
|
|
248
|
+
React's StrictMode, route changes and hot reloads destroy and create the engine again. Such a page then asks the browser for no new memory, because the stopped engine's memory is reused. Safari can refuse a new memory for some seconds after a page drops one. The page keeps at most 2 memories, and their RAM stays in use until a new engine takes one, the 30 seconds end, or the page goes away.
|
|
249
|
+
|
|
250
|
+
A page that goes away without `destroy()`, such as a page in a frame that your app removes, still gives back the engine's memory. When the page hides, the engine wakes its job workers and ends their loops. Safari never frees the memory of a worker that it stops while the worker waits for work.
|
|
251
|
+
|
|
252
|
+
Without this, an iPad would run out of room after a few such pages. A page that the browser brings back from its back-forward cache runs on, with the job workers' share of the work on the sketch thread.
|
|
253
|
+
|
|
254
|
+
Where the engine keeps texture copies, as phones and tablets do by default, it gives its GPU back while the browser keeps the page in its back-forward cache. The thread that draws destroys its textures, its buffers and its device. When the page shows again, it starts a new device, as after a GPU loss, and builds every pipeline again before the scene shows. The cached page then leaves its GPU memory to the next page.
|
|
255
|
+
|
|
256
|
+
</details>
|
|
177
257
|
|
|
178
258
|
Each `on...` call returns a function that removes its handler.
|
|
179
259
|
|
|
180
260
|
## Screenshots
|
|
181
261
|
|
|
182
|
-
`engine.capture()` resolves with an image of the next frame that the engine draws, as a PNG `Blob`.
|
|
262
|
+
`engine.capture()` resolves with an image of the next frame that the engine draws, as a PNG `Blob`. The page cannot read a frame from the canvas itself: a worker usually draws on it, and the browser clears it after each frame.
|
|
183
263
|
|
|
184
264
|
```ts
|
|
185
265
|
shotButton.onclick = async () => {
|
|
@@ -242,6 +322,8 @@ The engine's own add-ons need no range. They ship in step with the engine and us
|
|
|
242
322
|
- [Hosting and cross-origin isolation](../getting-started/hosting.md): the headers that let the engine run threaded.
|
|
243
323
|
- [3D scenes on content pages](../guides/content-pages.md): fallbacks, load deadlines and pausing on product pages.
|
|
244
324
|
- [Color management](../concepts/color-management.md): HDR color, tone mapping and transparent canvases.
|
|
325
|
+
- [Large worlds](https://github.com/null3d-engine/null3d/tree/main/examples/large-world): a drive along a road on the Earth's surface, with the option on.
|
|
326
|
+
- [Input from the page](https://github.com/null3d-engine/null3d/tree/main/examples/replay): the engine starts with input off, and the demo's page takes the keys and the pointer lock.
|
|
245
327
|
|
|
246
328
|
## API reference
|
|
247
329
|
|
|
@@ -1,22 +1,20 @@
|
|
|
1
1
|
---
|
|
2
2
|
id: api/feature-draws
|
|
3
3
|
title: Add-on feature draws
|
|
4
|
-
status: experimental
|
|
5
|
-
since: "0.3"
|
|
6
4
|
summary: "scene.addFeatureDraw turns a draw feature description into a draw of your WGSL, your vertices, your uniforms and the description's sort place, on both GPU paths and in every thread mode; scene.addFeatureInstances repeats that shape once for each row of a batch."
|
|
7
5
|
---
|
|
8
6
|
|
|
9
7
|
# Add-on feature draws
|
|
10
8
|
|
|
11
|
-
>
|
|
9
|
+
> A draw records in the main view alone, and at the opaque, the transparent or the resolve point.
|
|
12
10
|
|
|
13
11
|
```mermaid
|
|
14
12
|
flowchart LR
|
|
15
|
-
description["defineFeature<br/>frame 'transparent', kind 'draw'"] -->
|
|
16
|
-
shader["Your WGSL"] -->
|
|
17
|
-
vertices["Your vertices"] -->
|
|
18
|
-
uniforms["Your uniforms"] -->
|
|
19
|
-
|
|
13
|
+
description["defineFeature<br/>frame 'transparent', kind 'draw'"] --> create["scene.addFeatureDraw"]
|
|
14
|
+
shader["Your WGSL"] --> create
|
|
15
|
+
vertices["Your vertices"] --> create
|
|
16
|
+
uniforms["Your uniforms"] --> create
|
|
17
|
+
create --> object["A scene object<br/>your shader, your vertex format"]
|
|
20
18
|
object --> list["The frame's draw list"]
|
|
21
19
|
list --> gpu["WebGPU or WebGL2"]
|
|
22
20
|
```
|
|
@@ -25,7 +23,7 @@ flowchart LR
|
|
|
25
23
|
|
|
26
24
|
This is the adapter for a [feature description](features.md) with `kind: 'draw'`. The description carries the sorting and the resources; the shader, the vertex format and the uniforms are the draw's own declaration, which this call takes.
|
|
27
25
|
|
|
28
|
-
##
|
|
26
|
+
## One soft point
|
|
29
27
|
|
|
30
28
|
```ts
|
|
31
29
|
import { defineFeature, defineSketch } from '@null3d/engine';
|
|
@@ -38,8 +36,8 @@ struct Uniforms {
|
|
|
38
36
|
|
|
39
37
|
fn surface(input: SurfaceInput) -> Surface {
|
|
40
38
|
var s = defaultSurface(input);
|
|
41
|
-
|
|
42
|
-
|
|
39
|
+
let away = length(input.uv - vec2f(0.5)) * 2.0;
|
|
40
|
+
let cover = smoothstep(1.0, 1.0 - material.softness, away);
|
|
43
41
|
s.baseColor = vec3f(0.0);
|
|
44
42
|
s.emissive = input.vertexColor.rgb * (material.gain * cover);
|
|
45
43
|
s.alpha = cover;
|
|
@@ -71,6 +69,12 @@ export default defineSketch(async ({ scene }) => {
|
|
|
71
69
|
});
|
|
72
70
|
```
|
|
73
71
|
|
|
72
|
+
This draws one point. For a cloud, put one square per point in the vertex arrays, or draw many copies of this shape with `scene.addFeatureInstances`, as [Many copies of one shape](#many-copies-of-one-shape) shows.
|
|
73
|
+
|
|
74
|
+

|
|
75
|
+
|
|
76
|
+
An opaque and a blended feature draw.
|
|
77
|
+
|
|
74
78
|
## The description
|
|
75
79
|
|
|
76
80
|
`addFeatureDraw` reads these fields of the description. The [feature description page](features.md) gives the others: `name`, `reads`, `writes`, `outputs`, `provides` and the callbacks.
|
|
@@ -101,7 +105,7 @@ Geometries are shared, so the engine allocates the draw's buffers once and draws
|
|
|
101
105
|
|
|
102
106
|
The uniforms that the add-on declares in `struct Uniforms` are the draw's payload. `uniforms` gives their first values, and `draw.setUniform(name, value)` or `draw.set(values)` changes them at any time without allocating. A uniform reaches the WGSL as `material.<name>`, in a surface function or a full shader. [Surface functions](../shaders/surface-functions.md#uniforms) gives the types and the 32-number limit.
|
|
103
107
|
|
|
104
|
-
The draw also takes the material's values, such as `color`, `alphaMode`, `blending`, `depthWrite`, `doubleSided` and `
|
|
108
|
+
The draw also takes the material's values, such as `color`, `alphaMode`, `blending`, `depthWrite`, `doubleSided`, `map` and `sceneInputs`, with the same names and meanings as `materials.shader`. A texture that its WGSL declares comes from `textures`, as `materials.shader` takes it. `sceneInputs: ['sceneDepth']` lets a blended draw read the opaque scene's depth behind it ([Materials](materials.md#the-scene-behind-a-surface)).
|
|
105
109
|
|
|
106
110
|
## Where it sorts
|
|
107
111
|
|
|
@@ -109,9 +113,10 @@ A draw's vertex data and material draw as one scene object. The engine culls it
|
|
|
109
113
|
|
|
110
114
|
- `'opaque'` draws with the pass's other opaque objects, in the engine's own order, which the depth test decides.
|
|
111
115
|
- `'transparent'` draws with the blended objects, back to front. The description's band and order place it among them, as `mesh.setRenderOrder` does: `draw.setRenderOrder(order)` changes the place later.
|
|
112
|
-
- `'resolve'` blends after the camera's other blended objects. While the scene has more than one sample per pixel (MSAA), the camera draws such surfaces back to front into a layer of one sample per pixel, tested against a one-sample copy of the opaque depth, and blends the layer over the scene. Thousands of overlapping blended cards, such as Gaussian splats, then cost one blend per pixel instead of one per sample.
|
|
116
|
+
- `'resolve'` blends after the camera's other blended objects. While the scene has more than one sample per pixel (MSAA), the camera draws such surfaces back to front into a layer of one sample per pixel, tested against a one-sample copy of the opaque depth, and blends the layer over the scene. Thousands of overlapping blended cards, such as Gaussian splats, then cost one blend per pixel instead of one per sample.
|
|
117
|
+
- Use it for a draw of soft, heavily overlapping surfaces. A glass or a particle in front of such a draw shows behind it, and a mesh's anti-aliased edge in front of it can show a faint fringe. With one sample, other views and frames before the layer's shaders are ready, the draw blends in the transparent pass, back to front with the other blended objects.
|
|
113
118
|
|
|
114
|
-
|
|
119
|
+
The draw's scene object, `draw.object`, takes the other object calls, such as `setPosition`, `setRotation`, `setScale` and `setLayers`. Its `setCastShadows(true)` makes the draw cast the shadows of every light that casts them, and its `setReceiveShadows(true)` makes the draw receive them. The draw's own `setVisible` shows and hides it. The draw's own `destroy()` frees its object, its material and its vertices, where `draw.object.destroy()` frees the object alone.
|
|
115
120
|
|
|
116
121
|
## Many copies of one shape
|
|
117
122
|
|
|
@@ -146,9 +151,9 @@ values.set([...]); // four numbers of yours for each row, read as `object.values
|
|
|
146
151
|
|
|
147
152
|
## Limits
|
|
148
153
|
|
|
149
|
-
- The adapter places the main view alone. A scene pass and a reflection pass do not draw a feature draw
|
|
150
|
-
- A draw has one shape and one material, repeated once for each row. A scene that draws a different shape for each copy
|
|
151
|
-
-
|
|
154
|
+
- The adapter places the main view alone. A scene pass and a reflection pass do not draw a feature draw, and a description that names one throws E1223.
|
|
155
|
+
- A draw has one shape and one material, repeated once for each row. A scene that draws a different shape for each copy needs another hook.
|
|
156
|
+
- An opaque set whose live count a compute pass writes on the GPU, such as grass that the GPU culls, needs [compute instances](feature-instances.md). Those draw at the opaque point only, so a blended set such as splats stays with this hook.
|
|
152
157
|
- The feature description's `reads`, `writes`, `outputs` and `provides` stay with the [feature registry](features.md): this draw reads and writes no scene resource and provides no lighting slot.
|
|
153
158
|
|
|
154
159
|
## Errors
|
|
@@ -166,6 +171,7 @@ values.set([...]); // four numbers of yours for each row, read as `object.values
|
|
|
166
171
|
- [Custom shaders](../guides/custom-shaders.md): the WGSL that the plugin compiles, surface functions and full shaders.
|
|
167
172
|
- [Surface functions](../shaders/surface-functions.md): the surface input, the surface record, uniforms and textures.
|
|
168
173
|
- [Render graph API](render.md): the sketch's own passes, which draw into textures.
|
|
174
|
+
- [Many copies and the resolve point](https://github.com/null3d-engine/null3d/tree/main/examples/splats): the splats add-on makes the draw, with its instances at the resolve point.
|
|
169
175
|
|
|
170
176
|
## API reference
|
|
171
177
|
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
---
|
|
2
2
|
id: api/feature-effects
|
|
3
3
|
title: Add-on feature effects
|
|
4
|
-
status: experimental
|
|
5
|
-
since: "0.3"
|
|
6
4
|
summary: "post.addFeatureEffect turns a full-screen feature description into a pass of your WGSL over the scene's color, at the resolve point, on both GPU paths and in every thread mode, and draws it only while the feature is ready."
|
|
7
5
|
---
|
|
8
6
|
|
|
9
7
|
# Add-on feature effects
|
|
10
8
|
|
|
11
|
-
>
|
|
9
|
+
> A full-screen effect records at the resolve point, in the main view alone.
|
|
12
10
|
|
|
13
11
|
```mermaid
|
|
14
12
|
flowchart LR
|
|
15
|
-
description["defineFeature<br/>frame 'resolve', kind 'fullscreen'"] -->
|
|
16
|
-
shader["Your WGSL"] -->
|
|
17
|
-
uniforms["Your uniforms"] -->
|
|
18
|
-
|
|
13
|
+
description["defineFeature<br/>frame 'resolve', kind 'fullscreen'"] --> create["post.addFeatureEffect"]
|
|
14
|
+
shader["Your WGSL"] --> create
|
|
15
|
+
uniforms["Your uniforms"] --> create
|
|
16
|
+
create --> chain["The chain of custom effects<br/>HDR color, before bloom"]
|
|
19
17
|
chain --> gpu["WebGPU or WebGL2"]
|
|
20
18
|
```
|
|
21
19
|
|
|
22
|
-
`post.addFeatureEffect` runs an add-on's pass over the whole image. The add-on gives the WGSL, its uniforms and its textures, as it would to [`post.addEffect`](post.md). The description says where the pass records. It says what the pass reads and writes, and whether it draws at all.
|
|
20
|
+
`post.addFeatureEffect` runs an add-on's pass over the whole image. The add-on gives the WGSL, its uniforms and its textures, as it would to [`post.addEffect`](post.md). The description says where the pass records. It says what the pass reads and writes, and whether it draws at all.
|
|
21
|
+
|
|
22
|
+
The engine places it in the chain of custom effects. That chain runs on the scene's high dynamic range color, after the exposure and before bloom and the tone curve. The pass therefore reaches WebGPU and WebGL2, in every thread mode, with the same picture.
|
|
23
23
|
|
|
24
24
|
This is the adapter for a [feature description](features.md) with `kind: 'fullscreen'`. The description carries the place, the resources and the readiness; the shader and its values are the pass's own declaration, which this call takes.
|
|
25
25
|
|
|
@@ -83,7 +83,7 @@ export default defineSketch(async ({ post, quality, engine, page }) => {
|
|
|
83
83
|
| Field | What a full-screen effect takes |
|
|
84
84
|
| --- | --- |
|
|
85
85
|
| `kind` | `'fullscreen'`. Any other kind throws E1223. |
|
|
86
|
-
| `frame` | `'resolve'`. No public pass draws an add-on's effect after the tone curve
|
|
86
|
+
| `frame` | `'resolve'`. No public pass draws an add-on's effect after the tone curve, so another frame point throws E1223. |
|
|
87
87
|
| `band` | `'before'`, `'normal'` or `'after'`. It places the pass among the sketch's other effects, whose orders the band's ranges keep in that order. |
|
|
88
88
|
| `order` | The place inside the band. A lower number runs first. |
|
|
89
89
|
| `reads` | `'sceneColor'`, and `'sceneDepth'` when the WGSL reads the depth. Another resource throws E1223. |
|
|
@@ -111,8 +111,8 @@ Add the feature to its `FeatureHost` before you place it. The host's quality cal
|
|
|
111
111
|
|
|
112
112
|
## Limits
|
|
113
113
|
|
|
114
|
-
- The pass records at the resolve point and in the main view alone. An add-on's effect after the tone curve, or in a scene or reflection pass
|
|
115
|
-
- The pass reads the scene's color and depth alone.
|
|
114
|
+
- The pass records at the resolve point and in the main view alone. An add-on's effect cannot run after the tone curve, or in a scene or reflection pass.
|
|
115
|
+
- The pass reads the scene's color and depth alone. It cannot read the normals, the motion vectors, the history or the shadow atlas.
|
|
116
116
|
- The pass publishes no texture and provides no lighting slot. A feature that publishes an output is a compute pass, and a lighting slot belongs to the pass that shades the surfaces.
|
|
117
117
|
- The chain runs in one place in the frame, so the band orders the pass among the sketch's other effects. The engine's own bloom and depth of field keep their own places around it.
|
|
118
118
|
|