@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
|
@@ -1,18 +1,10 @@
|
|
|
1
1
|
{
|
|
2
|
-
"about": "Maps three.js APIs to their null3D equivalents. Each entry gives a status
|
|
3
|
-
"version": "null3D 0.1 to 1.0",
|
|
2
|
+
"about": "Maps three.js APIs to their null3D equivalents. Each entry gives a status and a docs page ID.",
|
|
4
3
|
"statusLegend": {
|
|
5
4
|
"direct": "Same concept; the call or option changes name only.",
|
|
6
5
|
"changed": "Supported, with a different API or pattern. Follow the note.",
|
|
7
6
|
"manual": "Must be rewritten by hand, for example GLSL shaders or render hooks.",
|
|
8
|
-
"
|
|
9
|
-
"unsupported": "Out of scope for null3D. Use the workaround in the note."
|
|
10
|
-
},
|
|
11
|
-
"sinceLegend": {
|
|
12
|
-
"0.1": "the core renderer, with cameras, materials, lights and shadows",
|
|
13
|
-
"0.2": "content, such as glTF models, animation, raycasting and post-processing",
|
|
14
|
-
"0.3": "developer tools, such as the `null3d` command, templates and the porting tools",
|
|
15
|
-
"1.0": "the stable API"
|
|
7
|
+
"unsupported": "null3D has no equivalent. Use the workaround in the note."
|
|
16
8
|
},
|
|
17
9
|
"entries": [
|
|
18
10
|
{
|
|
@@ -20,9 +12,9 @@
|
|
|
20
12
|
"category": "Renderer and loop",
|
|
21
13
|
"three": "WebGLRenderer / WebGPURenderer",
|
|
22
14
|
"status": "changed",
|
|
23
|
-
"since": "0.1",
|
|
24
15
|
"target": "createEngine({ canvas, sketch }) on the page; scene code moves to sketch.ts inside defineSketch()",
|
|
25
|
-
"notes": "The engine picks WebGPU or WebGL2 itself. antialias: true
|
|
16
|
+
"notes": "The engine picks WebGPU or WebGL2 itself. `antialias: true` becomes `createEngine({ antialias: 'msaa' })`, and `false` becomes `'none'`. `alpha: true` becomes `transparent: true`, and `powerPreference` keeps its name.",
|
|
17
|
+
"details": "Without `antialias`, the quality preset picks FXAA on Low and MSAA 4x from Medium up. The default `powerPreference` is `'high-performance'`.",
|
|
26
18
|
"docs": "getting-started/first-scene",
|
|
27
19
|
"detect": "\\b(WebGL|WebGPU)Renderer\\b"
|
|
28
20
|
},
|
|
@@ -31,7 +23,6 @@
|
|
|
31
23
|
"category": "Renderer and loop",
|
|
32
24
|
"three": "renderer.setPixelRatio(devicePixelRatio)",
|
|
33
25
|
"status": "changed",
|
|
34
|
-
"since": "0.1",
|
|
35
26
|
"target": "createEngine({ maxPixelRatio }) and the quality presets; quality.set({ maxPixelRatio }) in the sketch",
|
|
36
27
|
"notes": "The engine sizes the canvas to its CSS size times the screen's pixel ratio, up to the quality preset's cap. The option replaces the cap, and quality.set changes it during play.",
|
|
37
28
|
"docs": "concepts/quality-presets",
|
|
@@ -42,7 +33,6 @@
|
|
|
42
33
|
"category": "Renderer and loop",
|
|
43
34
|
"three": "renderer.setSize / window resize handler / camera.aspect + updateProjectionMatrix",
|
|
44
35
|
"status": "changed",
|
|
45
|
-
"since": "0.1",
|
|
46
36
|
"target": "Automatic",
|
|
47
37
|
"notes": "The engine follows the canvas's CSS size. Perspective cameras, and orthographic cameras made with a height, follow its aspect ratio in every frame. Delete resize handlers and updateProjectionMatrix calls.",
|
|
48
38
|
"docs": "api/engine",
|
|
@@ -53,7 +43,6 @@
|
|
|
53
43
|
"category": "Renderer and loop",
|
|
54
44
|
"three": "requestAnimationFrame(animate) / renderer.setAnimationLoop / renderer.render(scene, camera)",
|
|
55
45
|
"status": "changed",
|
|
56
|
-
"since": "0.1",
|
|
57
46
|
"target": "onUpdate(dt) returned from defineSketch()",
|
|
58
47
|
"notes": "The engine renders every frame by itself; never call a render function. Per-frame logic goes in onUpdate, camera-follow logic in onLateUpdate.",
|
|
59
48
|
"docs": "api/sketch",
|
|
@@ -62,44 +51,53 @@
|
|
|
62
51
|
{
|
|
63
52
|
"id": "shadow-map",
|
|
64
53
|
"category": "Renderer and loop",
|
|
65
|
-
"three": "renderer.shadowMap.enabled / .type (
|
|
54
|
+
"three": "renderer.shadowMap.enabled / .type (PCFShadowMap, PCFSoftShadowMap)",
|
|
66
55
|
"status": "changed",
|
|
67
|
-
"since": "0.1",
|
|
68
56
|
"target": "castShadows: true on the light; the shadowFilter quality setting sets the filter",
|
|
69
|
-
"notes": "PCFShadowMap and PCFSoftShadowMap become the shadowFilter setting: 3 x 3 or 5 x 5 texels, by preset. quality.set({ shadowFilter }) changes it during play.
|
|
57
|
+
"notes": "PCFShadowMap and PCFSoftShadowMap become the shadowFilter setting: 3 x 3 or 5 x 5 texels, by preset. quality.set({ shadowFilter }) changes it during play.",
|
|
58
|
+
"docs": "concepts/shadows",
|
|
59
|
+
"detect": "\\.shadowMap\\.(enabled|type)|\\b(PCF|PCFSoft)ShadowMap\\b"
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"id": "shadow-map-types",
|
|
63
|
+
"category": "Renderer and loop",
|
|
64
|
+
"three": "BasicShadowMap / VSMShadowMap",
|
|
65
|
+
"status": "unsupported",
|
|
66
|
+
"target": "None; the shadowFilter quality setting chooses the filter",
|
|
67
|
+
"notes": "null3D filters every shadow with PCF, a 3 x 3 or 5 x 5 kernel chosen by the shadowFilter quality setting. It draws no basic or variance shadow map.",
|
|
70
68
|
"docs": "concepts/shadows",
|
|
71
|
-
"detect": "
|
|
69
|
+
"detect": "\\b(VSM|Basic)ShadowMap\\b"
|
|
72
70
|
},
|
|
73
71
|
{
|
|
74
72
|
"id": "tone-mapping",
|
|
75
73
|
"category": "Renderer and loop",
|
|
76
74
|
"three": "renderer.toneMapping (ACESFilmic, AgX, Neutral, Reinhard, Cineon, Custom, Linear) / toneMappingExposure",
|
|
77
75
|
"status": "changed",
|
|
78
|
-
"since": "0.1",
|
|
79
76
|
"target": "post.set({ toneMapping: 'agx' | 'agx-punchy' | 'neutral' | 'aces' | 'none' | curveWgsl, exposure })",
|
|
80
|
-
"notes": "The engine default is
|
|
77
|
+
"notes": "The engine default is `agx-punchy`, and three.js defaults to none, so a port of a scene with none sets `toneMapping: 'none'`. A port keeps its curve: AgX becomes `'agx'`, ACES `'aces'` and Neutral `'neutral'`. Copy `toneMappingExposure` to `exposure`, but keep `exposure` at 1 for NoToneMapping, which ignores it.",
|
|
78
|
+
"details": "`ReinhardToneMapping` and `CineonToneMapping` become the `reinhard` and `cineon` curves of `@null3d/three-compat`. `CustomToneMapping` becomes a custom tone curve: `post.set({ toneMapping: wgsl })`. The WGSL declares `fn toneCurve(color: vec3f) -> vec3f`. Leave out the curve's multiply by `toneMappingExposure`, because the color arrives exposed.\n\nThe curves use three.js's formulas. `'none'` applies the exposure, as `LinearToneMapping` does. null3D multiplies the exposure into each light rather than into the finished picture. This gives the same image, and bloom's threshold keeps its meaning. A scene in real units sets `ev100` instead, and exposure then acts as exposure compensation. At `ev100` 15, background and unlit colors draw black unless their values are in real units too.\n\nA custom curve needs HDR color, as bloom does. Compatibility mode then draws in HDR color with FXAA. A device without an HDR target keeps the built-in curve.",
|
|
81
79
|
"docs": "api/post",
|
|
82
80
|
"detect": "\\b\\w+ToneMapping\\b|\\.toneMapping(Exposure)?\\s*="
|
|
83
81
|
},
|
|
84
82
|
{
|
|
85
83
|
"id": "color-output",
|
|
86
84
|
"category": "Renderer and loop",
|
|
87
|
-
"three": "renderer.outputColorSpace / outputEncoding / ColorManagement",
|
|
85
|
+
"three": "renderer.outputColorSpace / outputEncoding / ColorManagement / material.dithering",
|
|
88
86
|
"status": "direct",
|
|
89
|
-
"since": "0.1",
|
|
90
87
|
"target": "Nothing to do",
|
|
91
|
-
"notes": "Output is sRGB
|
|
88
|
+
"notes": "Output is sRGB from a linear working space, as in three.js r152+ defaults. Hex colors are sRGB, and `[r, g, b]` arrays are linear, as three.js reads them. Delete the output and color management lines.",
|
|
89
|
+
"details": "The final pass encodes sRGB and dithers. three.js dithers only materials with `dithering: true`, so delete that option. The difference is at most one step of an 8-bit color.",
|
|
92
90
|
"docs": "concepts/color-management",
|
|
93
|
-
"detect": "\\.output(ColorSpace|Encoding)\\b|\\bColorManagement\\b"
|
|
91
|
+
"detect": "\\.output(ColorSpace|Encoding)\\b|\\bColorManagement\\b|\\bdithering\\s*[:=]"
|
|
94
92
|
},
|
|
95
93
|
{
|
|
96
94
|
"id": "stats",
|
|
97
95
|
"category": "Renderer and loop",
|
|
98
96
|
"three": "renderer.info / stats.js",
|
|
99
97
|
"status": "changed",
|
|
100
|
-
"since": "0.1",
|
|
101
98
|
"target": "debug.stats(true), or createEngine({ stats: true }) on the page; debug.frameStats() for numbers",
|
|
102
|
-
"notes": "The overlay shows
|
|
99
|
+
"notes": "The overlay shows frame rates, per-thread CPU time, draw calls, the GPU tier and the preset. Click it for a card of thread and GPU times, objects drawn and memory. In the sketch, `debug.frameStats()` also gives the textures' GPU bytes, their budget and their dropped mip levels.",
|
|
100
|
+
"details": "`debug.stats(true)`, `createEngine({ stats: true })`, `engine.stats(true)` or `?stats` turns the overlay on. It sits at the canvas's top right, or at its bottom right with `{ corner: 'bottom-right' }`. Its header shows the frame rate.\n\nThe card shows each thread's and the GPU's time against the target frame rate. It also shows the memory of the engine, the GPU's textures and buffers, the heap and the page.\n\nTriangles count every pass, shadow maps included, as `renderer.info.render.triangles` does. Objects count the instances of each draw, so an object counts once per pass that draws it. Each part of a mesh with several materials counts once, as each part is a mesh of its own in three.js. `engine.measure(seconds)` on the page gives percentiles of CPU and GPU time, and memory. `@null3d/engine/stats` shows a three.js page's own figures in the same panel, with `StatsPanel`, or as text, with `statsText`.",
|
|
103
101
|
"docs": "api/debug",
|
|
104
102
|
"detect": "\\.info\\.(render|programs)|from\\s+['\"][^'\"]*stats(\\.module)?(\\.js)?['\"]|\\bnew\\s+Stats\\s*\\("
|
|
105
103
|
},
|
|
@@ -108,9 +106,9 @@
|
|
|
108
106
|
"category": "Renderer and loop",
|
|
109
107
|
"three": "renderer.info.memory.textures",
|
|
110
108
|
"status": "changed",
|
|
111
|
-
"since": "0.2",
|
|
112
109
|
"target": "quality.textureMemory; textures.memoryBytes; the quality setting textureMemoryMiB; debug.frameStats().gpuTextureBytes and gpuBufferBytes",
|
|
113
|
-
"notes": "three.js counts the textures
|
|
110
|
+
"notes": "three.js counts the textures it holds and sets no byte budget. null3D reports the textures' GPU bytes and holds them under the preset's budget. Past it, textures from files drop their largest mip levels, which load again when room returns.",
|
|
111
|
+
"details": "`debug.frameStats()` gives the bytes of every GPU texture and buffer that the engine holds. Render targets and shadow maps are included.",
|
|
114
112
|
"docs": "concepts/quality-presets",
|
|
115
113
|
"detect": "\\.info\\.memory\\b"
|
|
116
114
|
},
|
|
@@ -119,7 +117,6 @@
|
|
|
119
117
|
"category": "Renderer and loop",
|
|
120
118
|
"three": "renderer.compile / compileAsync (pre-warming shaders)",
|
|
121
119
|
"status": "changed",
|
|
122
|
-
"since": "0.1",
|
|
123
120
|
"target": "await scene.warmUp() before hiding the loading screen",
|
|
124
121
|
"notes": "The first frame waits for its pipelines. warmUp resolves once every pipeline that the scene needs is built, hidden objects included, so warm up a later loading stage before you show it.",
|
|
125
122
|
"docs": "guides/loading-screens",
|
|
@@ -130,9 +127,9 @@
|
|
|
130
127
|
"category": "Renderer and loop",
|
|
131
128
|
"three": "renderer.setClearColor / scene.background = color or texture",
|
|
132
129
|
"status": "direct",
|
|
133
|
-
"
|
|
134
|
-
"
|
|
135
|
-
"
|
|
130
|
+
"target": "scene.setBackground('#rrggbb' | texture | environment | cube map | { sky }, options)",
|
|
131
|
+
"notes": "A texture background fills the view behind every object and stretches to its shape. An environment or cube map surrounds the scene, as a PMREM texture or CubeTexture does. For an exact page color, set `toneMapping: 'none'` or use `createEngine({ transparent: true })` over CSS.",
|
|
132
|
+
"details": "Exposure and tone mapping change the background, as in three.js's `WebGPURenderer`. `WebGLRenderer` draws a background color, and an sRGB background texture, without them. `setClearColor(color, 0)` on an alpha canvas becomes `transparent: true` with no background.",
|
|
136
133
|
"docs": "api/scene",
|
|
137
134
|
"detect": "\\.setClearColor\\s*\\(|\\.background\\s*="
|
|
138
135
|
},
|
|
@@ -141,7 +138,6 @@
|
|
|
141
138
|
"category": "Renderer and loop",
|
|
142
139
|
"three": "document.body.appendChild(renderer.domElement)",
|
|
143
140
|
"status": "changed",
|
|
144
|
-
"since": "0.1",
|
|
145
141
|
"target": "createEngine({ canvas })",
|
|
146
142
|
"notes": "Create the canvas in HTML or in page.ts and pass it in. The engine hands it to the render worker.",
|
|
147
143
|
"docs": "getting-started/first-scene",
|
|
@@ -152,7 +148,6 @@
|
|
|
152
148
|
"category": "Renderer and loop",
|
|
153
149
|
"three": "preserveDrawingBuffer + canvas.toDataURL / readRenderTargetPixels",
|
|
154
150
|
"status": "changed",
|
|
155
|
-
"since": "0.1",
|
|
156
151
|
"target": "await engine.capture() on the page",
|
|
157
152
|
"notes": "Resolves with a PNG Blob of the next frame that the engine draws. Tests read pixels with engine.captureFrame() instead.",
|
|
158
153
|
"docs": "api/engine",
|
|
@@ -163,9 +158,9 @@
|
|
|
163
158
|
"category": "Renderer and loop",
|
|
164
159
|
"three": "WebGLRenderTarget / RenderTarget / renderer.setRenderTarget (render to texture)",
|
|
165
160
|
"status": "changed",
|
|
166
|
-
"since": "0.2",
|
|
167
161
|
"target": "const pass = render.addPass({ kind: 'scene', camera, writes: 'myTexture', size: [width, height] }); materials.unlit({ map: textures.fromPass(pass) })",
|
|
168
|
-
"notes": "
|
|
162
|
+
"notes": "Declare a pass and let the render graph order it, run it while its texture shows, and plan its memory. A pass never draws objects that show its own texture. Scene passes draw point and spot lights and the background, but no ambient occlusion.",
|
|
163
|
+
"details": "The texture holds linear color after the exposure. It is upright, with `v = 0` at the bottom, as three.js's render target texture. A reflection pass's texture on the HDR WebGPU path starts at the top row instead. Read it with `reflection_uv`, which turns the rows.\n\nA scene pass draws the scene's background unless a `clearColor` replaces it. A light that only a pass sees casts no shadow there.\n\nA render target the size of the canvas or a share of it takes `scale: 1`, `0.5` or `0.25` in place of `size`. It then follows the render size. A render target that a `ShaderPass` fills becomes a full-screen pass: `render.addPass({ kind: 'fullscreen', wgsl, writes, size or scale, textures })`.",
|
|
169
164
|
"docs": "guides/custom-passes",
|
|
170
165
|
"detect": "\\b(WebGL)?RenderTarget\\b|\\.setRenderTarget\\s*\\("
|
|
171
166
|
},
|
|
@@ -174,9 +169,9 @@
|
|
|
174
169
|
"category": "Renderer and loop",
|
|
175
170
|
"three": "renderer.setViewport / setScissor (split screens, picture in picture)",
|
|
176
171
|
"status": "changed",
|
|
177
|
-
"since": "0.3",
|
|
178
172
|
"target": "scene.createView({ camera, rect }): one scene drawn again from another camera, into a rectangle of the canvas, after the camera's view",
|
|
179
|
-
"notes": "rect is [x, y, width, height] as fractions of the canvas from its top-left corner
|
|
173
|
+
"notes": "`rect` is `[x, y, width, height]` as fractions of the canvas from its top-left corner. Give each view its own camera, and call `setRect` to change the rectangle without allocating. The camera's own view draws the whole canvas first.",
|
|
174
|
+
"details": "A split screen that covers the canvas draws the scene once for the camera and once for each view. Each view costs one cull and one scene draw at its rectangle's pixels. The sun's shadows and the lights cost nothing more.\n\nA view's objects take no ambient occlusion or screen-space reflections. The camera's volumetric fog and outline reach the whole image, a view's rectangle included.\n\nFor a minimap that a material shows in the world, a scene pass into a texture (`textures.fromPass`) is cheaper than a view. `destroy` removes the view.",
|
|
180
175
|
"docs": "guides/multiple-views",
|
|
181
176
|
"detect": "\\.set(Scissor|Viewport)(Test)?\\s*\\("
|
|
182
177
|
},
|
|
@@ -185,7 +180,6 @@
|
|
|
185
180
|
"category": "Renderer and loop",
|
|
186
181
|
"three": "renderer.capabilities / renderer.extensions",
|
|
187
182
|
"status": "changed",
|
|
188
|
-
"since": "0.1",
|
|
189
183
|
"target": "engine.capabilities on the page, and ctx.engine.capabilities in the sketch",
|
|
190
184
|
"notes": "Reports the GPU tier, limits and features. Never branch on GPU names: some browsers hide them.",
|
|
191
185
|
"docs": "concepts/backends",
|
|
@@ -196,9 +190,9 @@
|
|
|
196
190
|
"category": "Renderer and loop",
|
|
197
191
|
"three": "logarithmicDepthBuffer / reverseDepthBuffer",
|
|
198
192
|
"status": "direct",
|
|
199
|
-
"
|
|
200
|
-
"
|
|
201
|
-
"
|
|
193
|
+
"target": "Nothing to do; createEngine({ largeWorld: true }) and batch origins for planet-scale scenes",
|
|
194
|
+
"notes": "The engine draws reversed depth in a 32-bit float buffer. On WebGL2 without `EXT_clip_control`, that depth keeps GL's range, which is less precise. `engine.capabilities.depth` says which depth the device draws.",
|
|
195
|
+
"details": "The engine renders relative to the camera through per-cell offsets. With `largeWorld: true`, positions keep their full precision at any distance. `createInstances` also takes an origin that its rows are relative to. The page switch `?depth=standard` draws depth as three.js's `WebGLRenderer` does by default. That helps compare pictures with a three.js original. The switch works on WebGL2 only and draws no shadows.",
|
|
202
196
|
"docs": "concepts/large-worlds",
|
|
203
197
|
"detect": "logarithmicDepthBuffer|reverseDepthBuffer"
|
|
204
198
|
},
|
|
@@ -207,7 +201,6 @@
|
|
|
207
201
|
"category": "Scene graph",
|
|
208
202
|
"three": "new THREE.Scene()",
|
|
209
203
|
"status": "changed",
|
|
210
|
-
"since": "0.1",
|
|
211
204
|
"target": "The scene from the sketch context: defineSketch(({ scene }) => ...)",
|
|
212
205
|
"notes": "Objects are created in the scene directly.",
|
|
213
206
|
"docs": "api/scene",
|
|
@@ -218,9 +211,9 @@
|
|
|
218
211
|
"category": "Scene graph",
|
|
219
212
|
"three": "scene.environment (PMREMGenerator, RoomEnvironment, HDR files)",
|
|
220
213
|
"status": "changed",
|
|
221
|
-
"since": "0.2",
|
|
222
214
|
"target": "scene.setEnvironment(await assets.loadEnvironment('/env/sunset.ktx2'))",
|
|
223
|
-
"notes": "`loadEnvironment` takes an HDR file
|
|
215
|
+
"notes": "`loadEnvironment` takes an HDR file, or a map from `bunx @null3d/cli assets env` that needs no filtering. `pmremGenerator.fromScene(new RoomEnvironment(), 0.04)` becomes `await assets.builtinEnvironment('room')`, with the same blur and no file. `scene.environmentIntensity` becomes the `intensity` option.",
|
|
216
|
+
"details": "`pmremGenerator.fromScene(sceneWithSky)` becomes `await assets.skyEnvironment()`, called once. Its map follows `scene.setBackground({ sky })`, so drop calls that rebuild the map after each change. The map leaves out the sun's disc, whose light the directional light gives.\n\nThe standard material takes the environment's light with three.js's split-sum table, energy compensation and specular occlusion. three.js's PMREM blurs a little less than GGX. So each roughness reads the level that matches three.js's light best.",
|
|
224
217
|
"docs": "concepts/lighting",
|
|
225
218
|
"detect": "\\.environment\\s*=|\\bRoomEnvironment\\b"
|
|
226
219
|
},
|
|
@@ -229,9 +222,9 @@
|
|
|
229
222
|
"category": "Scene graph",
|
|
230
223
|
"three": "scene.fog = new Fog(color, near, far)",
|
|
231
224
|
"status": "changed",
|
|
232
|
-
"since": "0.1",
|
|
233
225
|
"target": "scene.setFog({ curve: 'linear', color, near, far })",
|
|
234
|
-
"notes": "The linear curve keeps three.js's smooth step and its defaults of 1 and 1000. null3D measures the straight-line distance from the camera, where three.js measures
|
|
226
|
+
"notes": "The linear curve keeps three.js's smooth step and its defaults of 1 and 1000. null3D measures the straight-line distance from the camera, where three.js measures depth along the view. So fog at the screen's corners is a little thicker, and it no longer shifts as the camera turns.",
|
|
227
|
+
"details": "null3D mixes the fog in linear color before the tone mapping, as `WebGPURenderer` does. It does the same as `WebGLRenderer` when that draws into a half-float target. Only `WebGLRenderer`'s default 8-bit canvas mixes the fog after the sRGB encoding. There the same fog looks a little darker at middle distances.\n\nMaterials opt out with `fog: false`. For new scenes, the default exponential curve looks more like real haze. The fog can also thin with height (`heightFalloff`) and glow toward the sun (`sunGlow`).",
|
|
235
228
|
"docs": "api/scene",
|
|
236
229
|
"detect": "\\bFog\\b"
|
|
237
230
|
},
|
|
@@ -240,9 +233,9 @@
|
|
|
240
233
|
"category": "Scene graph",
|
|
241
234
|
"three": "scene.fog = new FogExp2(color, density)",
|
|
242
235
|
"status": "changed",
|
|
243
|
-
"since": "0.1",
|
|
244
236
|
"target": "scene.setFog({ curve: 'exp2', color, density })",
|
|
245
|
-
"notes": "Pass three.js's density
|
|
237
|
+
"notes": "Pass three.js's density; its default there is 0.00025, and null3D's is 0.01. null3D measures the straight-line distance from the camera, where three.js measures depth along the view. So fog at the screen's corners is a little thicker, and it no longer shifts as the camera turns.",
|
|
238
|
+
"details": "null3D mixes the fog in linear color before the tone mapping, as `WebGPURenderer` does. It does the same as `WebGLRenderer` when that draws into a half-float target. Only `WebGLRenderer`'s default 8-bit canvas mixes the fog after the sRGB encoding. There the same fog looks a little darker at middle distances. Materials opt out with `fog: false`.",
|
|
246
239
|
"docs": "api/scene",
|
|
247
240
|
"detect": "\\bFogExp2\\b"
|
|
248
241
|
},
|
|
@@ -251,9 +244,9 @@
|
|
|
251
244
|
"category": "Scene graph",
|
|
252
245
|
"three": "VolumeNodeMaterial (webgpu_volume_lighting) / GodRaysEffect",
|
|
253
246
|
"status": "changed",
|
|
254
|
-
"since": "0.2",
|
|
255
247
|
"target": "scene.setFog({ color, density, heightFalloff, volumetric: { intensity, anisotropy, distance } })",
|
|
256
|
-
"notes": "three.js has no lit fog in
|
|
248
|
+
"notes": "three.js has no lit fog in core. Its webgpu_volume_lighting example marches rays through a box, lit by point and spot lights with shadows. null3D lights the scene's own fog instead, in a grid that follows the camera's view, with the sun's cascades and the lights' shadows.",
|
|
249
|
+
"details": "Drop the box. The fog's `density` and `heightFalloff` say where the air holds haze, and its scattering intensity becomes `intensity`. The god ray effects of add-on libraries blur a mask of the sky toward the sun on the screen. null3D's rays also come from lamps and from shadows off the screen.\n\nThe rays draw where the quality setting `fogSlices` is above 0: Medium and up. On Low the fog keeps its `sunGlow`.",
|
|
257
250
|
"docs": "api/scene",
|
|
258
251
|
"detect": "\\bVolumeNodeMaterial\\b|\\bGodRays(Effect|Pass)?\\b"
|
|
259
252
|
},
|
|
@@ -262,7 +255,6 @@
|
|
|
262
255
|
"category": "Scene graph",
|
|
263
256
|
"three": "new Group() / new Object3D()",
|
|
264
257
|
"status": "direct",
|
|
265
|
-
"since": "0.1",
|
|
266
258
|
"target": "scene.createGroup({ name, position })",
|
|
267
259
|
"notes": "",
|
|
268
260
|
"docs": "api/objects",
|
|
@@ -273,9 +265,9 @@
|
|
|
273
265
|
"category": "Scene graph",
|
|
274
266
|
"three": "parent.add(child) / remove / attach / scene.add",
|
|
275
267
|
"status": "changed",
|
|
276
|
-
"since": "0.1",
|
|
277
268
|
"target": "child.setParent(parent); setParent(parent, { keepWorld: true }) for attach(); getParent() for object.parent; destroy() to remove",
|
|
278
|
-
"notes": "Objects are in the scene as soon as they are created. setParent keeps the local transform, like add()
|
|
269
|
+
"notes": "Objects are in the scene as soon as they are created. `setParent` keeps the local transform, like `add()`, and `getParent()` returns the parent, or null for a root object. Creating, destroying and re-parenting rebuild the draw tables in that frame, so hide with `setVisible` and pool with `setActiveCount` during play (guides/performance).",
|
|
270
|
+
"details": "Under a parent turned and scaled by different amounts per axis, `keepWorld` keeps the child in place. Its rotation and scale then come out close to the old ones, as with `attach()`.",
|
|
279
271
|
"docs": "api/objects",
|
|
280
272
|
"detect": "\\bscene\\.(add|remove)\\s*\\(|\\.attach\\s*\\("
|
|
281
273
|
},
|
|
@@ -284,7 +276,6 @@
|
|
|
284
276
|
"category": "Scene graph",
|
|
285
277
|
"three": "object.position.set / .x = / .copy / translateX/Y/Z",
|
|
286
278
|
"status": "changed",
|
|
287
|
-
"since": "0.1",
|
|
288
279
|
"target": "obj.setPosition(x, y, z); obj.translate(x, y, z) for translateX/Y/Z",
|
|
289
280
|
"notes": "translate moves along the object's own axes, as translateX, translateY and translateZ do together. For many moving objects, use an instance batch and write its positions array directly instead of calling setters.",
|
|
290
281
|
"docs": "api/objects",
|
|
@@ -295,7 +286,6 @@
|
|
|
295
286
|
"category": "Scene graph",
|
|
296
287
|
"three": "object.rotation (Euler) / rotateX/Y/Z / rotateOnAxis",
|
|
297
288
|
"status": "changed",
|
|
298
|
-
"since": "0.1",
|
|
299
289
|
"target": "obj.setRotationEuler(x, y, z, 'XYZ'), obj.rotateX/Y/Z(angle), or obj.setRotation(qx, qy, qz, qw)",
|
|
300
290
|
"notes": "Euler order strings match three.js. rotateX, rotateY and rotateZ turn the object about its own axes, as in three.js. For rotateOnAxis, multiply the quaternion from obj.getRotation by one from quat.setAxisAngle, and pass the product to setRotation.",
|
|
301
291
|
"docs": "api/objects",
|
|
@@ -306,7 +296,6 @@
|
|
|
306
296
|
"category": "Scene graph",
|
|
307
297
|
"three": "object.quaternion.set / slerp / setFromAxisAngle",
|
|
308
298
|
"status": "changed",
|
|
309
|
-
"since": "0.1",
|
|
310
299
|
"target": "obj.setRotation(x, y, z, w), with the quaternion from quat.setAxisAngle, quat.fromEuler, quat.multiply or quat.slerp",
|
|
311
300
|
"notes": "The quat helpers write into an array that you create once with quat.create(). Pass its four numbers to setRotation. The rotations array of an instance batch takes the same order.",
|
|
312
301
|
"docs": "api/math",
|
|
@@ -317,7 +306,6 @@
|
|
|
317
306
|
"category": "Scene graph",
|
|
318
307
|
"three": "object.scale.set / setScalar",
|
|
319
308
|
"status": "changed",
|
|
320
|
-
"since": "0.1",
|
|
321
309
|
"target": "obj.setScale(x, y, z)",
|
|
322
310
|
"notes": "",
|
|
323
311
|
"docs": "api/objects",
|
|
@@ -328,7 +316,6 @@
|
|
|
328
316
|
"category": "Scene graph",
|
|
329
317
|
"three": "object.lookAt(target)",
|
|
330
318
|
"status": "changed",
|
|
331
|
-
"since": "0.1",
|
|
332
319
|
"target": "obj.lookAt(x, y, z)",
|
|
333
320
|
"notes": "Meshes and groups turn their +Z axis to the point. Cameras and lights turn their -Z axis there, as in three.js. The call assumes that the object's parents are not rotated.",
|
|
334
321
|
"docs": "api/objects",
|
|
@@ -339,7 +326,6 @@
|
|
|
339
326
|
"category": "Scene graph",
|
|
340
327
|
"three": "object.getWorldPosition / getWorldQuaternion / matrixWorld",
|
|
341
328
|
"status": "changed",
|
|
342
|
-
"since": "0.1",
|
|
343
329
|
"target": "obj.getWorldPosition(out), obj.getWorldQuaternion(out), obj.getWorldMatrix(out)",
|
|
344
330
|
"notes": "Each getter copies into an array that you make once, with vec3.create(), quat.create() or mat4.create(). They read the engine's last transform update, so a change made in onUpdate shows in the same frame's onLateUpdate. getWorldMatrix gives 16 numbers, column by column, like matrixWorld.elements.",
|
|
345
331
|
"docs": "api/objects",
|
|
@@ -350,7 +336,6 @@
|
|
|
350
336
|
"category": "Scene graph",
|
|
351
337
|
"three": "matrixAutoUpdate = false / updateMatrix / updateMatrixWorld / matrixWorldNeedsUpdate",
|
|
352
338
|
"status": "changed",
|
|
353
|
-
"since": "0.1",
|
|
354
339
|
"target": "Nothing to do: objects are static by default and update when a setter changes them; create objects that move every frame with dynamic: true",
|
|
355
340
|
"notes": "Remove manual matrix calls. Move single objects with their setters. Only instance batches take writes to their typed arrays, and a static batch uploads only the rows you mark with markDirty.",
|
|
356
341
|
"docs": "concepts/static-dynamic",
|
|
@@ -361,9 +346,9 @@
|
|
|
361
346
|
"category": "Scene graph",
|
|
362
347
|
"three": "object.traverse / getObjectByName / children",
|
|
363
348
|
"status": "changed",
|
|
364
|
-
"
|
|
365
|
-
"
|
|
366
|
-
"
|
|
349
|
+
"target": "scene.find(name) for getObjectByName; scene.listObjects() at setup, or your own arrays of objects, instead of traverse and children",
|
|
350
|
+
"notes": "`scene.find(name)` returns the first object created with that name, from an index. `scene.listObjects()` returns every object as a new array, and `getParent()` returns an object's parent. No call returns an object's children, so keep the objects you need in arrays.",
|
|
351
|
+
"details": "`scene.listObjects` walks the whole scene and allocates. Call it at setup, never in every frame.",
|
|
367
352
|
"docs": "api/objects",
|
|
368
353
|
"detect": "\\.traverse(Visible|Ancestors)?\\s*\\(|getObjectBy(Name|Id|Property)\\s*\\("
|
|
369
354
|
},
|
|
@@ -372,9 +357,9 @@
|
|
|
372
357
|
"category": "Scene graph",
|
|
373
358
|
"three": "object.visible = false",
|
|
374
359
|
"status": "direct",
|
|
375
|
-
"since": "0.1",
|
|
376
360
|
"target": "obj.setVisible(false)",
|
|
377
|
-
"notes": "
|
|
361
|
+
"notes": "Hiding is cheap: it uploads the object's matrix and draw entry. It never rebuilds the draw tables, so use it instead of removing and adding objects during play. The objects under a hidden object, dynamic ones too, stop updating until it shows again.",
|
|
362
|
+
"details": "three.js updates the matrices of hidden objects anyway. So hide a pool of spare objects under one parent.",
|
|
378
363
|
"docs": "api/objects",
|
|
379
364
|
"detect": "\\.visible\\s*="
|
|
380
365
|
},
|
|
@@ -383,9 +368,9 @@
|
|
|
383
368
|
"category": "Scene graph",
|
|
384
369
|
"three": "object.castShadow / receiveShadow",
|
|
385
370
|
"status": "direct",
|
|
386
|
-
"since": "0.1",
|
|
387
371
|
"target": "mesh.setCastShadows(true) / setReceiveShadows(true), or the castShadows and receiveShadows options of createMesh",
|
|
388
|
-
"notes": "Both are false by default, as in three.js. The directional
|
|
372
|
+
"notes": "Both flags are false by default, as in three.js. The directional, spot and point lights cast them on both GPU paths. Point lights cast where the preset's `pointLightShadows` is on.",
|
|
373
|
+
"details": "Unlit materials show no shadows. An instance batch takes `castShadows` and `receiveShadows` in `createInstances`. `batch.setCastShadows(true)` and `setReceiveShadows(true)` set them for every row.",
|
|
389
374
|
"docs": "api/objects",
|
|
390
375
|
"detect": "\\.(castShadow|receiveShadow)\\s*="
|
|
391
376
|
},
|
|
@@ -394,9 +379,9 @@
|
|
|
394
379
|
"category": "Scene graph",
|
|
395
380
|
"three": "object.layers / camera.layers (set, enable, disable)",
|
|
396
381
|
"status": "changed",
|
|
397
|
-
"since": "0.1",
|
|
398
382
|
"target": "obj.setLayers(mask), obj.getLayers(), camera.setLayers(mask), batch.setLayers(mask); the layers option of createMesh, createInstances and createPerspectiveCamera",
|
|
399
|
-
"notes": "Masks
|
|
383
|
+
"notes": "Masks use the same 32 bits and the same default of layer 0 alone. A camera draws an object when their masks share a bit. `layers.set(n)` becomes `setLayers(1 << n)`, and `enableAll()` becomes `setLayers(0xffffffff)`.",
|
|
384
|
+
"details": "For enable and disable, read the mask with `getLayers()` and pass the new mask. `layers.mask` becomes `getLayers()`. An `InstancedMesh`'s layers become its batch's, for every row. Raycasts and declared passes take layer masks.\n\nShadow casters differ. three.js tests them against the camera's layers, and null3D tests them against the light's. Give each shadow-casting light the layers of every object that must cast. Otherwise those objects cast nothing.",
|
|
400
385
|
"docs": "concepts/render-layers",
|
|
401
386
|
"detect": "\\.layers\\.(set|enable|disable|toggle|enableAll|disableAll|mask)\\b"
|
|
402
387
|
},
|
|
@@ -405,9 +390,9 @@
|
|
|
405
390
|
"category": "Scene graph",
|
|
406
391
|
"three": "object.renderOrder",
|
|
407
392
|
"status": "direct",
|
|
408
|
-
"since": "0.1",
|
|
409
393
|
"target": "mesh.setRenderOrder(n)",
|
|
410
|
-
"notes": "
|
|
394
|
+
"notes": "Lower orders draw first, before their depth, as in three.js. An object's depth is the depth of its bounding sphere's center, as in three.js. The engine orders opaque and masked objects itself for speed.",
|
|
395
|
+
"details": "The rows of an instance batch sort by depth one by one. three.js sorts an `InstancedMesh` as one object.",
|
|
411
396
|
"docs": "api/objects",
|
|
412
397
|
"detect": "\\.renderOrder\\s*="
|
|
413
398
|
},
|
|
@@ -416,7 +401,6 @@
|
|
|
416
401
|
"category": "Scene graph",
|
|
417
402
|
"three": "object.frustumCulled = false",
|
|
418
403
|
"status": "direct",
|
|
419
|
-
"since": "0.1",
|
|
420
404
|
"target": "mesh.setFrustumCulled(false)",
|
|
421
405
|
"notes": "Usually needed only for shader-displaced geometry; prefer mesh.setBounds(center, radius) with larger bounds, which keeps culling at work.",
|
|
422
406
|
"docs": "api/objects",
|
|
@@ -427,7 +411,6 @@
|
|
|
427
411
|
"category": "Scene graph",
|
|
428
412
|
"three": "object.userData",
|
|
429
413
|
"status": "manual",
|
|
430
|
-
"since": "0.1",
|
|
431
414
|
"target": "Your own arrays, or a Map keyed by the object",
|
|
432
415
|
"notes": "Engine objects have no userData, and their TypeScript types refuse new properties. A Map from each object to its data keeps the data beside the object. Arrays indexed the way your sketch counts objects stay fastest in per-frame loops.",
|
|
433
416
|
"docs": "concepts/handles",
|
|
@@ -438,9 +421,8 @@
|
|
|
438
421
|
"category": "Scene graph",
|
|
439
422
|
"three": "object.onBeforeRender / onAfterRender",
|
|
440
423
|
"status": "manual",
|
|
441
|
-
"
|
|
442
|
-
"
|
|
443
|
-
"notes": "The engine draws from lists that the sketch records, so it calls no sketch code per draw. Move per-object work into onUpdate or onLateUpdate. Declared passes come with step 0.2.",
|
|
424
|
+
"target": "onUpdate / onLateUpdate, or a declared pass",
|
|
425
|
+
"notes": "The engine draws from lists that the sketch records, so it calls no sketch code per draw. Move per-object work into onUpdate or onLateUpdate.",
|
|
444
426
|
"docs": "api/sketch",
|
|
445
427
|
"detect": "\\.on(Before|After)Render\\s*="
|
|
446
428
|
},
|
|
@@ -449,7 +431,6 @@
|
|
|
449
431
|
"category": "Scene graph",
|
|
450
432
|
"three": "object.clone() / SkeletonUtils.clone(gltf.scene)",
|
|
451
433
|
"status": "changed",
|
|
452
|
-
"since": "0.2",
|
|
453
434
|
"target": "scene.instantiate(prefab) for loaded models; scene.clone(obj) for built objects",
|
|
454
435
|
"notes": "Each instantiate shares the model's meshes, materials and textures. scene.clone copies an object and every object below it, lights and cameras included, under the same parent. A copy of an animated model gets an animator of its own, as SkeletonUtils.clone gives a copy its own skeleton.",
|
|
455
436
|
"docs": "api/scene",
|
|
@@ -460,9 +441,9 @@
|
|
|
460
441
|
"category": "Scene graph",
|
|
461
442
|
"three": "geometry.dispose() / material.dispose() / texture.dispose()",
|
|
462
443
|
"status": "changed",
|
|
463
|
-
"
|
|
464
|
-
"
|
|
465
|
-
"
|
|
444
|
+
"target": "texture.destroy(); material.destroy(); mesh.destroy(); prefab.destroy() for a loaded glTF model",
|
|
445
|
+
"notes": "`texture.destroy()` frees a texture's GPU memory, and `material.destroy()` frees the material's place. `mesh.destroy()` frees a mesh's GPU memory at the next frame, and throws E1111 while an object or batch uses it. Destroy objects and batches first, then the mesh.",
|
|
446
|
+
"details": "Objects that still use a destroyed material draw nothing. A custom material's pipelines free with its last material. `prefab.destroy()` frees every mesh, material and texture of a loaded model, and its skeleton and clips. It waits until its copies are destroyed.\n\nthree.js's `dispose` leaves the object usable and uploads it again on the next render. null3D's destroy ends it, and later calls throw E1101.",
|
|
466
447
|
"docs": "api/textures",
|
|
467
448
|
"detect": "\\.dispose\\s*\\("
|
|
468
449
|
},
|
|
@@ -471,9 +452,9 @@
|
|
|
471
452
|
"category": "Scene graph",
|
|
472
453
|
"three": "scene.overrideMaterial",
|
|
473
454
|
"status": "direct",
|
|
474
|
-
"since": "0.3",
|
|
475
455
|
"target": "scene.overrideMaterial = material, and null for each object's own material",
|
|
476
|
-
"notes": "
|
|
456
|
+
"notes": "The material draws every mesh and instance batch of the main pass. Each keeps its mesh, place and instances, as three.js does. Sprites, points, lines and particle systems keep their own materials, and the shadow maps keep each object's material.",
|
|
457
|
+
"details": "A masked caster still cuts its shadow. A sprite, point or line material throws E1224. The change rebuilds the draw tables in the next frame, and adds no draw call or pipeline after that.",
|
|
477
458
|
"docs": "api/scene",
|
|
478
459
|
"detect": "\\.overrideMaterial\\s*="
|
|
479
460
|
},
|
|
@@ -482,7 +463,6 @@
|
|
|
482
463
|
"category": "Scene graph",
|
|
483
464
|
"three": "scene.environmentRotation / backgroundRotation / material.envMapRotation",
|
|
484
465
|
"status": "direct",
|
|
485
|
-
"since": "0.2",
|
|
486
466
|
"target": "scene.setEnvironment(env, { rotation }) and scene.setBackground(env, { rotation })",
|
|
487
467
|
"notes": "Rotation is an Euler array in radians, in the order X, Y, Z, as in three.js. Each material shares the scene's rotation, so material.envMapRotation has none of its own. scene.setBackground turns environments and cube maps, not textures or the sky.",
|
|
488
468
|
"docs": "api/scene",
|
|
@@ -493,9 +473,9 @@
|
|
|
493
473
|
"category": "Scene graph",
|
|
494
474
|
"three": "scene.backgroundBlurriness / backgroundIntensity",
|
|
495
475
|
"status": "direct",
|
|
496
|
-
"since": "0.2",
|
|
497
476
|
"target": "scene.setBackground(env, { blur, intensity })",
|
|
498
|
-
"notes": "Each setBackground call sets
|
|
477
|
+
"notes": "Each `setBackground` call sets that background's options, where three.js keeps them on the scene. The blur reads the environment's level for that roughness, so it costs nothing extra. Only environments blur: ask `assets.loadEnvironment` for one.",
|
|
478
|
+
"details": "three.js turns a blurred `CubeTexture` into a PMREM texture. `intensity` applies to textures, environments, cube maps and the sky.",
|
|
499
479
|
"docs": "api/scene",
|
|
500
480
|
"detect": "background(Blurriness|Intensity)\\b"
|
|
501
481
|
},
|
|
@@ -504,9 +484,8 @@
|
|
|
504
484
|
"category": "Cameras",
|
|
505
485
|
"three": "PerspectiveCamera(fov, aspect, near, far)",
|
|
506
486
|
"status": "direct",
|
|
507
|
-
"since": "0.1",
|
|
508
487
|
"target": "scene.createPerspectiveCamera({ fov, near, far, position, target })",
|
|
509
|
-
"notes": "fov is vertical and in degrees, as in three.js
|
|
488
|
+
"notes": "`fov` is vertical and in degrees, as in three.js, and the aspect ratio is automatic. The `fov`, `near` and `far` properties are read-only: change them with `camera.setFov` and `camera.setNearFar`. The defaults are three.js's: fov 50, near 0.1 and far 2000.",
|
|
510
489
|
"docs": "api/cameras",
|
|
511
490
|
"detect": "\\bPerspectiveCamera\\b"
|
|
512
491
|
},
|
|
@@ -515,9 +494,9 @@
|
|
|
515
494
|
"category": "Cameras",
|
|
516
495
|
"three": "PerspectiveCamera.setFocalLength / getFocalLength / filmGauge",
|
|
517
496
|
"status": "changed",
|
|
518
|
-
"since": "0.2",
|
|
519
497
|
"target": "camera.setFocalLength(mm) and camera.focalLength",
|
|
520
|
-
"notes": "null3D's sensor is
|
|
498
|
+
"notes": "null3D's sensor is full frame, 24 mm tall along the canvas's height, so a focal length gives the same view on every canvas shape. three.js measures its 35 mm `filmGauge` along the longer side. The two agree on a square canvas with `filmGauge` 24.",
|
|
499
|
+
"details": "Depth of field takes the camera's focal length unless its settings give one.",
|
|
521
500
|
"docs": "api/cameras",
|
|
522
501
|
"detect": "\\b(set|get)FocalLength\\b|\\bfilmGauge\\b"
|
|
523
502
|
},
|
|
@@ -526,20 +505,31 @@
|
|
|
526
505
|
"category": "Cameras",
|
|
527
506
|
"three": "OrthographicCamera(left, right, top, bottom, near, far)",
|
|
528
507
|
"status": "direct",
|
|
529
|
-
"since": "0.1",
|
|
530
508
|
"target": "scene.createOrthographicCamera({ height, near, far, position, target }), or left, right, top and bottom in place of height",
|
|
531
|
-
"notes": "With height alone, the width follows the canvas's aspect ratio, so code
|
|
509
|
+
"notes": "With `height` alone, the width follows the canvas's aspect ratio, so resize code goes away. The four edges keep their shape on any canvas, as in three.js. To zoom, call `camera.setOrthoHeight` with the original height divided by three.js's zoom.",
|
|
510
|
+
"details": "The default height of 2 gives the same view as three.js's default edges, -1 to 1.",
|
|
532
511
|
"docs": "api/cameras",
|
|
533
512
|
"detect": "\\bOrthographicCamera\\b"
|
|
534
513
|
},
|
|
514
|
+
{
|
|
515
|
+
"id": "view-offset",
|
|
516
|
+
"category": "Cameras",
|
|
517
|
+
"three": "camera.setViewOffset(fullWidth, fullHeight, x, y, width, height) / clearViewOffset()",
|
|
518
|
+
"status": "changed",
|
|
519
|
+
"target": "camera.setLensShift(x, y) and camera.lensShift, on perspective and orthographic cameras",
|
|
520
|
+
"notes": "A lens shift moves the view off the camera's axis and keeps the perspective. It counts in fractions of the view's width and height, with y up. A full-size view offset becomes `setLensShift(x / fullWidth, -y / fullHeight)`, and `clearViewOffset()` becomes `setLensShift(0, 0)`.",
|
|
521
|
+
"details": "For an offset that draws one tile of a larger picture, also narrow the lens on a canvas of the tile's shape. Set the half angle's tangent to `tan(fov / 2) * height / fullHeight`. An orthographic camera's height becomes `height / fullHeight` of the full one. Then shift by `((x + width / 2) / fullWidth - 0.5) * fullWidth / width` across. Shift by `(0.5 - (y + height / 2) / fullHeight) * fullHeight / height` up.\n\nCulling, shadows, picking, `screenToRay`, `worldToScreen`, labels and views all follow the shift. Delete code that turns the camera to move a subject off center. A turn makes upright lines lean.",
|
|
522
|
+
"docs": "api/cameras",
|
|
523
|
+
"detect": "\\.(set|clear)ViewOffset\\s*\\("
|
|
524
|
+
},
|
|
535
525
|
{
|
|
536
526
|
"id": "screen-projection",
|
|
537
527
|
"category": "Cameras",
|
|
538
528
|
"three": "Vector3.project(camera) / Vector3.unproject(camera)",
|
|
539
529
|
"status": "changed",
|
|
540
|
-
"since": "0.2",
|
|
541
530
|
"target": "camera.worldToScreen(point, out) for [x, y, depth]; camera.screenToRay(x, y, ray) for a ray through a point",
|
|
542
|
-
"notes": "Both take and give CSS pixels from the canvas's top-left corner, not device coordinates
|
|
531
|
+
"notes": "Both take and give CSS pixels from the canvas's top-left corner, not device coordinates. The depth is the distance in front of the camera, and below 0 behind it. A ray through the pointer uses the camera of the frame on screen at the event.",
|
|
532
|
+
"details": "three.js starts an orthographic ray on the camera's plane. `screenToRay` starts it on the near plane.",
|
|
543
533
|
"docs": "api/cameras",
|
|
544
534
|
"detect": "\\.(un)?project\\s*\\(\\s*\\w*[Cc]amera\\b"
|
|
545
535
|
},
|
|
@@ -548,9 +538,9 @@
|
|
|
548
538
|
"category": "Cameras",
|
|
549
539
|
"three": "CubeCamera (dynamic reflections)",
|
|
550
540
|
"status": "changed",
|
|
551
|
-
"since": "0.2",
|
|
552
541
|
"target": "scene.createReflectionProbe({ box: { min, max }, position, refresh: 'always' }); a reflection pass for a flat mirror: render.addPass({ kind: 'reflection', writes, plane })",
|
|
553
|
-
"notes": "A CubeCamera with a WebGLCubeRenderTarget
|
|
542
|
+
"notes": "A `CubeCamera` with a `WebGLCubeRenderTarget`, filtered by `PMREMGenerator`, becomes a reflection probe. The probe captures the scene from its position on the GPU and filters it for each roughness. `cubeCamera.update()` in every frame becomes `refresh: 'always'`, and one update after a change becomes `probe.capture()`.",
|
|
543
|
+
"details": "The probe lights every surface inside its box, not one material. Its box projects the reflections, so walls reflect at their own distance. Give the probe a box around the space that the object moves in. `boxProjection: false` reads it as three.js reads a cube map, as light from far away.\n\nThe near and far of the `CubeCamera` fall away. Captures draw from 5 cm out to the camera's far plane. Leave the reflecting object out of its own probe's captures with layers.",
|
|
554
544
|
"docs": "api/scene",
|
|
555
545
|
"detect": "\\bCubeCamera\\b"
|
|
556
546
|
},
|
|
@@ -559,9 +549,8 @@
|
|
|
559
549
|
"category": "Cameras",
|
|
560
550
|
"three": "ArrayCamera / StereoCamera",
|
|
561
551
|
"status": "unsupported",
|
|
562
|
-
"since": null,
|
|
563
552
|
"target": "None; split screens use scene.createView with one camera for each view",
|
|
564
|
-
"notes": "
|
|
553
|
+
"notes": "null3D has no stereo rendering. For split screens, give each view a camera and a rectangle of the canvas.",
|
|
565
554
|
"docs": "porting/threejs-unsupported",
|
|
566
555
|
"detect": "\\b(Array|Stereo)Camera\\b"
|
|
567
556
|
},
|
|
@@ -570,9 +559,9 @@
|
|
|
570
559
|
"category": "Lights and shadows",
|
|
571
560
|
"three": "DirectionalLight (+ target, shadow.camera bounds)",
|
|
572
561
|
"status": "changed",
|
|
573
|
-
"since": "0.1",
|
|
574
562
|
"target": "scene.createDirectionalLight({ direction, color, intensity, castShadows, shadow })",
|
|
575
|
-
"notes": "The light is an object. Pass the target minus the position as direction
|
|
563
|
+
"notes": "The light is an object. Pass the target minus the position as `direction`, or call `light.lookAt(x, y, z)` again whenever the target moves. Surfaces show up to four directional lights: the first created casts shadows, and up to three more add fill and rim light.",
|
|
564
|
+
"details": "Delete `shadow.camera` bounds. The engine's shadow cascades fit the view, and the shadow distance follows the farthest visible receiver by default. A port with its own `shadow.camera.far` passes that number as `shadow: { distance }`. The engine also draws contact shadows, which three.js lacks: on High and Ultra, and on Medium on WebGL2. Set `shadow: { contactDistance: 0 }` to match three.js's look.\n\n`intensity` stays in lux, three.js's unit. three.js has no hero shadow. A port that fits a second shadowed light, or a shadow camera, to one object uses `light.setShadow({ hero: object })`, which follows it.",
|
|
576
565
|
"docs": "api/lights",
|
|
577
566
|
"detect": "\\bDirectionalLight\\b"
|
|
578
567
|
},
|
|
@@ -581,9 +570,9 @@
|
|
|
581
570
|
"category": "Lights and shadows",
|
|
582
571
|
"three": "PointLight(color, intensity, distance, decay)",
|
|
583
572
|
"status": "direct",
|
|
584
|
-
"since": "0.1",
|
|
585
573
|
"target": "scene.createPointLight({ position, color, intensity, range, decay, castShadows, shadow, intensityUnit })",
|
|
586
|
-
"notes": "distance becomes range
|
|
574
|
+
"notes": "`distance` becomes `range`, which every point light needs; 0 is refused. `intensity` stays in candela, and `light.power` in lumens becomes `intensity` with `intensityUnit: 'lumen'`. `castShadow` becomes `castShadows`; `shadow` takes `bias` and `normalBias` in meters, and `shadow.camera` has no equivalent.",
|
|
575
|
+
"details": "`intensityUnit: 'lumen'` divides by 4π as `power` does, and `setIntensity` then takes lumens. The quality preset sets the tile size in place of `shadow.mapSize`.",
|
|
587
576
|
"docs": "api/lights",
|
|
588
577
|
"detect": "\\bPointLight\\b"
|
|
589
578
|
},
|
|
@@ -592,9 +581,9 @@
|
|
|
592
581
|
"category": "Lights and shadows",
|
|
593
582
|
"three": "SpotLight(color, intensity, distance, angle, penumbra, decay)",
|
|
594
583
|
"status": "direct",
|
|
595
|
-
"since": "0.1",
|
|
596
584
|
"target": "scene.createSpotLight({ position, direction | target, angle, penumbra, range, decay, intensity, map, castShadows, shadow, intensityUnit })",
|
|
597
|
-
"notes": "distance becomes range
|
|
585
|
+
"notes": "`distance` becomes `range`, which every spot light needs, and `intensity` stays in candela. `light.power` in lumens becomes `intensity` with `intensityUnit: 'lumen'`, and `target` is a point. `shadow.camera` has no equivalent: call `light.lookAt(x, y, z)` when the target moves.",
|
|
586
|
+
"details": "`intensityUnit: 'lumen'` divides by π at any cone angle, as `power` does. `castShadow` becomes `castShadows`, and `shadow` takes `bias` and `normalBias` in meters. The quality preset sets the tile size in place of `shadow.mapSize`.\n\n`light.map` becomes `map`: sRGB pixels as `{ width, height, data }`, or an engine texture. `setMap` takes the same. The light projects it over its cone as three.js projects it. Its top row follows the world's up, as three.js aims its map's camera. So a light rolled about its axis shows the same map.\n\nThe engine copies a texture into its own light image once. A texture that changes every frame, a `VideoTexture` included, throws E1112. The engine keeps the picture's detail up to 512 texels a side, and reduces a larger texture to that. three.js samples the texture itself. Up to 32 lights show a map at once.",
|
|
598
587
|
"docs": "api/lights",
|
|
599
588
|
"detect": "\\bSpotLight\\b"
|
|
600
589
|
},
|
|
@@ -603,9 +592,9 @@
|
|
|
603
592
|
"category": "Lights and shadows",
|
|
604
593
|
"three": "HemisphereLight",
|
|
605
594
|
"status": "changed",
|
|
606
|
-
"since": "0.2",
|
|
607
595
|
"target": "scene.createHemisphereLight({ skyColor, groundColor, intensity })",
|
|
608
596
|
"notes": "The sky lies along the light's +Y axis: turn the light to tilt it, where three.js moves it. It lights surfaces as three.js's does, diffuse only, and its light adds to the environment's. Any number of them cost the same per pixel.",
|
|
597
|
+
"details": "`intensity` stays in lux, three.js's unit.",
|
|
609
598
|
"docs": "api/lights",
|
|
610
599
|
"detect": "\\bHemisphereLight\\b"
|
|
611
600
|
},
|
|
@@ -614,9 +603,8 @@
|
|
|
614
603
|
"category": "Lights and shadows",
|
|
615
604
|
"three": "AmbientLight",
|
|
616
605
|
"status": "direct",
|
|
617
|
-
"since": "0.1",
|
|
618
606
|
"target": "scene.createAmbientLight({ color, intensity })",
|
|
619
|
-
"notes": "Several ambient lights add up.",
|
|
607
|
+
"notes": "Several ambient lights add up. intensity stays in lux, three.js's unit.",
|
|
620
608
|
"docs": "api/lights",
|
|
621
609
|
"detect": "\\bAmbientLight\\b"
|
|
622
610
|
},
|
|
@@ -625,9 +613,9 @@
|
|
|
625
613
|
"category": "Lights and shadows",
|
|
626
614
|
"three": "RectAreaLight",
|
|
627
615
|
"status": "changed",
|
|
628
|
-
"since": "0.2",
|
|
629
616
|
"target": "scene.createRectAreaLight({ color, intensity, width, height, range })",
|
|
630
|
-
"notes": "
|
|
617
|
+
"notes": "It needs a `range`, where three.js's light has no end. The light leaves along -Z, as in three.js, and casts no shadows. The engine shades it with linearly transformed cosines, as three.js does.",
|
|
618
|
+
"details": "Delete `RectAreaLightUniformsLib.init()`. `intensity` stays in nits, three.js's unit.",
|
|
631
619
|
"docs": "api/lights",
|
|
632
620
|
"detect": "\\bRectAreaLight\\b"
|
|
633
621
|
},
|
|
@@ -636,7 +624,6 @@
|
|
|
636
624
|
"category": "Lights and shadows",
|
|
637
625
|
"three": "RectAreaLightUniformsLib / RectAreaLightTexturesLib",
|
|
638
626
|
"status": "changed",
|
|
639
|
-
"since": "0.2",
|
|
640
627
|
"target": "Nothing: the engine loads the area lights' tables with the first area light",
|
|
641
628
|
"notes": "Remove the init() call.",
|
|
642
629
|
"docs": "api/lights",
|
|
@@ -647,9 +634,9 @@
|
|
|
647
634
|
"category": "Lights and shadows",
|
|
648
635
|
"three": "LightProbe / LightProbeGenerator",
|
|
649
636
|
"status": "changed",
|
|
650
|
-
"since": "0.2",
|
|
651
637
|
"target": "scene.setLightProbeGrid: a grid of irradiance probes lights the scene where a surface stands",
|
|
652
|
-
"notes": "One LightProbe that lights the whole scene is an environment: scene.setEnvironment takes
|
|
638
|
+
"notes": "One `LightProbe` that lights the whole scene is an environment: `scene.setEnvironment` takes its diffuse spherical harmonics with the environment map. `bunx @null3d/cli assets env` computes that map offline. For light that changes from place to place, bake a grid with `bakeProbes` and set it with `scene.setLightProbeGrid`.",
|
|
639
|
+
"details": "The grid holds L1 spherical harmonics per probe, where three.js's `LightProbeGrid` holds L2. The scene page's light probe grid section shows both calls.",
|
|
653
640
|
"docs": "api/scene",
|
|
654
641
|
"detect": "\\bLightProbe(Generator)?\\b"
|
|
655
642
|
},
|
|
@@ -658,9 +645,9 @@
|
|
|
658
645
|
"category": "Lights and shadows",
|
|
659
646
|
"three": "LightProbeGrid (addons: a baked grid of L2 irradiance probes)",
|
|
660
647
|
"status": "changed",
|
|
661
|
-
"since": "0.2",
|
|
662
648
|
"target": "scene.setLightProbeGrid with a grid that bakeProbes bakes in the sketch",
|
|
663
|
-
"notes": "three.js's grid stores L2 spherical harmonics per probe
|
|
649
|
+
"notes": "three.js's grid stores L2 spherical harmonics per probe, and null3D's stores L1. That takes four texture reads per pixel in place of seven: three of coefficients and one of its masks. The light keeps its direction, but small bright patches spread a little wider.",
|
|
650
|
+
"details": "three.js adds the grid's light to the environment's diffuse light. null3D's grid takes the environment's place, and the live environment's light times each probe's sky visibility. Bake the grid again with `bakeProbes` when the scene changes.",
|
|
664
651
|
"docs": "api/scene",
|
|
665
652
|
"detect": "\\bLightProbeGrid\\b"
|
|
666
653
|
},
|
|
@@ -669,7 +656,6 @@
|
|
|
669
656
|
"category": "Lights and shadows",
|
|
670
657
|
"three": "ClusteredLighting / ClusteredLightsNode (addons, webgpu_lights_clustered)",
|
|
671
658
|
"status": "changed",
|
|
672
|
-
"since": "0.1",
|
|
673
659
|
"target": "Built in: scene.createPointLight and scene.createSpotLight; the engine clusters every light",
|
|
674
660
|
"notes": "Delete the add-on and its setup. null3D sorts point and spot lights into clusters on both GPU paths, and they may cast shadows. three.js's add-on takes point lights without shadows, on WebGPU only.",
|
|
675
661
|
"docs": "api/lights",
|
|
@@ -680,9 +666,9 @@
|
|
|
680
666
|
"category": "Lights and shadows",
|
|
681
667
|
"three": "CSM addon (three/addons/csm)",
|
|
682
668
|
"status": "direct",
|
|
683
|
-
"since": "0.1",
|
|
684
669
|
"target": "Built in: shadow: { cascades } on the directional light",
|
|
685
|
-
"notes": "Delete the addon
|
|
670
|
+
"notes": "Delete the addon: its `cascades`, `maxFar` and `shadowMapSize` become the `cascades`, `distance` and `mapSize` settings. The cascades keep still edges as the camera turns, and far cascades draw every few frames. The `mode` setting has no equivalent.",
|
|
671
|
+
"details": "The `farCascadeInterval` quality setting says how often far cascades draw. The `fade` option is on by default: neighboring cascades blend over a band, which the `shadowCascadeBlend` quality setting sizes. `fade: false` maps to `shadowCascadeBlend: 0`.\n\nThe `mode` setting has no equivalent. The engine's split leans a little more toward the camera than the addon's practical mode, so its near cascade is shorter. `debug.shadowCamera(camera)` lets the cascades follow a camera other than the one that renders, as the addon's `camera` option does. It works in development builds only.",
|
|
686
672
|
"docs": "concepts/shadows",
|
|
687
673
|
"detect": "\\bCSM\\b|csm/CSM"
|
|
688
674
|
},
|
|
@@ -691,9 +677,9 @@
|
|
|
691
677
|
"category": "Lights and shadows",
|
|
692
678
|
"three": "SunLight / SunLightShadow / SunShadowNode (addons)",
|
|
693
679
|
"status": "changed",
|
|
694
|
-
"since": "0.1",
|
|
695
680
|
"target": "scene.createDirectionalLight({ direction, castShadows: true, shadow: { cascades: 2 } })",
|
|
696
|
-
"notes": "Delete the add-on. The directional light's shadow takes cascades fitted to the camera's view, with a blend between
|
|
681
|
+
"notes": "Delete the add-on. The directional light's shadow takes cascades fitted to the camera's view, with a blend between neighbors. SunLight's two cascades become `cascades: 2`.",
|
|
682
|
+
"details": "The CSM entry maps the other settings.",
|
|
697
683
|
"docs": "concepts/shadows",
|
|
698
684
|
"detect": "\\bSun(Light|LightShadow|ShadowNode)\\b"
|
|
699
685
|
},
|
|
@@ -702,9 +688,9 @@
|
|
|
702
688
|
"category": "Lights and shadows",
|
|
703
689
|
"three": "SSSNode / sss() (screen-space shadows)",
|
|
704
690
|
"status": "changed",
|
|
705
|
-
"
|
|
706
|
-
"
|
|
707
|
-
"
|
|
691
|
+
"target": "Contact shadows of the directional light: scene.createDirectionalLight({ castShadows: true, shadow: { contactDistance } })",
|
|
692
|
+
"notes": "Both search the camera's depth toward the main light for short shadows where objects touch. `shadow.contactDistance` sets their reach in meters, 0.3 by default. Only the first directional light draws them, while it casts shadows.",
|
|
693
|
+
"details": "They draw where the quality setting `contactShadowSteps` is above 0: on High and Ultra, and on Medium on WebGL2.",
|
|
708
694
|
"docs": "api/lights",
|
|
709
695
|
"detect": "\\bSSSNode\\b"
|
|
710
696
|
},
|
|
@@ -713,9 +699,9 @@
|
|
|
713
699
|
"category": "Lights and shadows",
|
|
714
700
|
"three": "light.shadow.mapSize / bias / normalBias / intensity / radius / camera",
|
|
715
701
|
"status": "changed",
|
|
716
|
-
"since": "0.1",
|
|
717
702
|
"target": "shadow: { mapSize, bias, normalBias, intensity, cascades, distance } in the directional light's options, or light.setShadow()",
|
|
718
|
-
"notes": "mapSize is one number, the texels on each side. bias and normalBias are in meters, where three.js gives bias in depth units, so start from the defaults.
|
|
703
|
+
"notes": "`mapSize` is one number, the texels on each side. `bias` and `normalBias` are in meters, where three.js gives `bias` in depth units, so start from the defaults. `shadow.camera` has no equivalent, and `shadowSide` has no option.",
|
|
704
|
+
"details": "`intensity` is 0 to 1 and carries over as it stands. The directional light's map stores 16-bit depth. In each cascade, `bias` covers at least 1.5 of its depth steps. That is about 2 cm in a far cascade 200 m out.\n\n`radius` and `blurSamples` become the `shadowFilter` quality setting, 3 or 5 texels on each side. `shadow.camera` has no equivalent: the cascades fit the camera's view. The shader mixes each shadow lookup toward full light by the rest, at no cost to the frame.\n\nCasters draw only the faces that point away from the light, as three.js's default `shadowSide` does. Double-sided materials draw both.",
|
|
719
705
|
"docs": "concepts/shadows",
|
|
720
706
|
"detect": "\\.shadow\\.(mapSize|bias|normalBias|intensity|camera|radius|blurSamples)\\b"
|
|
721
707
|
},
|
|
@@ -724,7 +710,6 @@
|
|
|
724
710
|
"category": "Lights and shadows",
|
|
725
711
|
"three": "physicallyCorrectLights / useLegacyLights",
|
|
726
712
|
"status": "changed",
|
|
727
|
-
"since": "0.1",
|
|
728
713
|
"target": "Physical light units, as in three.js r155 and later",
|
|
729
714
|
"notes": "Scenes tuned in three.js's legacy light mode need new intensities: retune them with parity images.",
|
|
730
715
|
"docs": "concepts/lighting",
|
|
@@ -735,9 +720,9 @@
|
|
|
735
720
|
"category": "Geometry",
|
|
736
721
|
"three": "Box / Sphere / Plane / Cylinder / Cone / Torus / Capsule / Circle / Ring Geometry",
|
|
737
722
|
"status": "direct",
|
|
738
|
-
"since": "0.1",
|
|
739
723
|
"target": "geometry.box({ width, height, depth }), geometry.sphere({ radius }), and one generator for each class",
|
|
740
|
-
"notes": "
|
|
724
|
+
"notes": "Constructor arguments become options with the same names and defaults. `new CylinderGeometry(0.3, 0.4, 2)` is `geometry.cylinder({ radiusTop: 0.3, radiusBottom: 0.4, height: 2 })`. The meshes match three.js's vertices, normals, texture coordinates and triangles.",
|
|
725
|
+
"details": "Each object has one material. An array of materials for the face groups of a box or a cylinder needs one object for each group.",
|
|
741
726
|
"docs": "api/geometry",
|
|
742
727
|
"detect": "\\b(Box|Sphere|Plane|Cylinder|Cone|Torus|Capsule|Circle|Ring)Geometry\\b"
|
|
743
728
|
},
|
|
@@ -746,9 +731,8 @@
|
|
|
746
731
|
"category": "Geometry",
|
|
747
732
|
"three": "geometry.rotateX / rotateY / rotateZ / translate / scale / center / applyMatrix4",
|
|
748
733
|
"status": "changed",
|
|
749
|
-
"since": "0.1",
|
|
750
734
|
"target": "obj.setRotationEuler(x, y, z), obj.setPosition(x, y, z) or obj.setScale(x, y, z) on the object that draws the mesh",
|
|
751
|
-
"notes": "A mesh keeps the vertices its generator built, so the transform goes on
|
|
735
|
+
"notes": "A mesh keeps the vertices its generator built, so the transform goes on the object or instance row. `floor.setRotationEuler(-Math.PI / 2, 0, 0)` lays a plane flat. To build the transform into the vertices, transform the arrays and pass them to `geometry.fromArrays`.",
|
|
752
736
|
"docs": "api/geometry",
|
|
753
737
|
"detect": "\\w*[Gg]eo(metry)?\\w*\\s*\\.\\s*(rotate[XYZ]|translate|scale|center|applyMatrix4)\\s*\\(|Geometry\\([^()]*\\)\\s*\\.\\s*(rotate[XYZ]|translate|scale|center|applyMatrix4)\\s*\\("
|
|
754
738
|
},
|
|
@@ -757,9 +741,9 @@
|
|
|
757
741
|
"category": "Geometry",
|
|
758
742
|
"three": "TorusKnot / Icosahedron / Octahedron / Tetrahedron / Dodecahedron / Polyhedron / Lathe / Extrude / Shape / Tube Geometry",
|
|
759
743
|
"status": "direct",
|
|
760
|
-
"since": "0.2",
|
|
761
744
|
"target": "geometry.fromArrays(torusKnot({ radius, tube, tubularSegments, radialSegments, p, q })), and icosahedron, octahedron, tetrahedron, dodecahedron, polyhedron, lathe, shape, extrude and tube, from @null3d/geometry",
|
|
762
|
-
"notes": "Install
|
|
745
|
+
"notes": "Install `@null3d/geometry`. Each function takes the constructor's arguments as named options with three.js's defaults, and returns arrays for `geometry.fromArrays`. `Shape`, `Path`, the curves and `ShapeUtils` keep their names and methods, but points are arrays.",
|
|
746
|
+
"details": "`ExtrudeGeometry`'s caps and sides form one mesh, which takes one material. `CurvePath.getPoint(t)`, and `Path`'s and `Shape`'s, throws a `RangeError` when `t` is above 1 or the path is empty. three.js returns null there. A custom `UVGenerator`'s `generateTopUV` and `generateSideWallUV` take no geometry argument first, so drop it. A list of shapes makes one mesh with one material, where `ShapeGeometry` gives each shape a group. Make one shape call per material.",
|
|
763
747
|
"docs": "api/geometry",
|
|
764
748
|
"detect": "\\b(TorusKnot|Icosahedron|Octahedron|Tetrahedron|Dodecahedron|Polyhedron|Lathe|Extrude|Shape|Tube)Geometry\\b|\\bnew\\s+(THREE\\.)?Shape\\s*\\("
|
|
765
749
|
},
|
|
@@ -768,29 +752,28 @@
|
|
|
768
752
|
"category": "Geometry",
|
|
769
753
|
"three": "BufferGeometry + setAttribute / setIndex / BufferAttribute",
|
|
770
754
|
"status": "changed",
|
|
771
|
-
"since": "0.1",
|
|
772
755
|
"target": "geometry.fromArrays({ positions, normals, uvs, uvs1, colors, tangents, joints, weights, indices })",
|
|
773
|
-
"notes": "
|
|
756
|
+
"notes": "`geometry.fromArrays` returns a mesh that `createMesh` and `createInstances` accept. The attributes `position`, `normal`, `uv`, `uv1`, `color` and `tangent` each become one array, and `setIndex` becomes `indices`, 16-bit or 32-bit. The engine copies the arrays.",
|
|
757
|
+
"details": "`skinIndex` and `skinWeight` become `joints` and `weights`. 8-bit and 16-bit integer arrays stay integers on the GPU. `{ array, normalized: true }` keeps a `BufferAttribute`'s normalized flag.",
|
|
774
758
|
"docs": "api/geometry",
|
|
775
759
|
"detect": "\\bBufferGeometry\\b|\\.setAttribute\\s*\\(|\\.setIndex\\s*\\(|\\b(Float32|Uint16|Uint32)?BufferAttribute\\b"
|
|
776
760
|
},
|
|
777
761
|
{
|
|
778
762
|
"id": "geo-dynamic",
|
|
779
763
|
"category": "Geometry",
|
|
780
|
-
"three": "attribute.needsUpdate / setUsage(DynamicDrawUsage) (vertices changing every frame)",
|
|
764
|
+
"three": "attribute.needsUpdate / setUsage(DynamicDrawUsage) / addUpdateRange (vertices changing every frame)",
|
|
781
765
|
"status": "changed",
|
|
782
|
-
"since": "0.2",
|
|
783
766
|
"target": "mesh.updateVertices(name, values, start, count)",
|
|
784
|
-
"notes": "Pass the attribute's values of every vertex, in the array type the mesh was made with
|
|
767
|
+
"notes": "Pass the attribute's values of every vertex, in the array type the mesh was made with. `start` and `count` pick the vertices that change, as `addUpdateRange` does, but in vertices. The mesh keeps the bounding sphere it was made with, so call `setBounds` when vertices move outside it.",
|
|
768
|
+
"details": "Meshes with joints or morph targets take no updates. For many moving objects, use instances instead of rewriting vertices.",
|
|
785
769
|
"docs": "api/geometry",
|
|
786
|
-
"detect": "\\.attributes\\.\\w+\\.needsUpdate|\\.setUsage\\s*\\(|DynamicDrawUsage"
|
|
770
|
+
"detect": "\\.attributes\\.\\w+\\.needsUpdate|\\.setUsage\\s*\\(|DynamicDrawUsage|\\.addUpdateRange\\s*\\("
|
|
787
771
|
},
|
|
788
772
|
{
|
|
789
773
|
"id": "geo-compute",
|
|
790
774
|
"category": "Geometry",
|
|
791
775
|
"three": "computeVertexNormals / computeTangents / computeBoundingSphere",
|
|
792
776
|
"status": "changed",
|
|
793
|
-
"since": "0.1",
|
|
794
777
|
"target": "geometry.fromArrays({ ..., computeNormals: true, computeTangents: true })",
|
|
795
778
|
"notes": "The results match three.js's bit for bit. computeTangents needs uvs, and works without indices too. Bounds are always automatic, so computeBoundingSphere and computeBoundingBox need no call.",
|
|
796
779
|
"docs": "api/geometry",
|
|
@@ -801,7 +784,6 @@
|
|
|
801
784
|
"category": "Geometry",
|
|
802
785
|
"three": "EdgesGeometry / WireframeGeometry",
|
|
803
786
|
"status": "changed",
|
|
804
|
-
"since": "0.2",
|
|
805
787
|
"target": "WireframeGeometry: a material with wireframe: true on the mesh itself. EdgesGeometry: scene.createLines({ positions, mode: 'segments' }) with two points per edge",
|
|
806
788
|
"notes": "A wireframe material draws each triangle's three edges, as WireframeGeometry lists them, with no copy of the mesh. null3D does not find a mesh's feature edges for you, as EdgesGeometry does with its angle threshold. Build that list of edge points from the mesh's arrays, or with EdgesGeometry at build time, and draw it as pairs of points.",
|
|
807
789
|
"docs": "api/lines",
|
|
@@ -812,9 +794,8 @@
|
|
|
812
794
|
"category": "Geometry",
|
|
813
795
|
"three": "TextGeometry / FontLoader / troika-three-text",
|
|
814
796
|
"status": "changed",
|
|
815
|
-
"since": "0.3",
|
|
816
797
|
"target": "DOM labels (ui.trackLabel), a texture with pre-rendered text, or a text mesh baked into glTF",
|
|
817
|
-
"notes": "
|
|
798
|
+
"notes": "null3D draws no text of its own. Use DOM labels for text that follows an object, a texture for text on a surface, and a baked mesh for 3D letters.",
|
|
818
799
|
"docs": "porting/threejs-unsupported",
|
|
819
800
|
"detect": "\\bTextGeometry\\b|\\bFontLoader\\b|troika-three-text"
|
|
820
801
|
},
|
|
@@ -823,9 +804,9 @@
|
|
|
823
804
|
"category": "Geometry",
|
|
824
805
|
"three": "morphAttributes / morphTargetInfluences / morphTargetDictionary",
|
|
825
806
|
"status": "changed",
|
|
826
|
-
"since": "0.2",
|
|
827
807
|
"target": "mesh.setMorphWeight(indexOrName, weight) and mesh.getMorphWeight(indexOrName); geometry.fromArrays({ ..., morphTargets: { positions, normals, colors, names } })",
|
|
828
|
-
"notes": "glTF morph targets and their default weights load with the model, and its clips animate the weights. Targets are deltas, as with morphTargetsRelative = true
|
|
808
|
+
"notes": "glTF morph targets and their default weights load with the model, and its clips animate the weights. Targets are deltas, as with `morphTargetsRelative = true`. `mesh.mesh.morphTargetNames` lists the names in target order, in place of `morphTargetDictionary`.",
|
|
809
|
+
"details": "Color targets (`morphAttributes.color`, glTF's COLOR_0 targets) change vertex colors, so the mesh needs colors too. The colors stay between 0 and 1 as glTF asks; three.js does not clamp them. A glTF target without COLOR_0, while another target has it, changes no color, as glTF says. three.js r186 adds the base color there.\n\nTangent targets morph tangents, as glTF gives them, which three.js does not do. A clip blends its weights with the object's own, as `AnimationMixer` does. On WebGL2 each object draws only its largest weights, by the `morphTargets` quality setting: 8 on Low up to 64 on Ultra.",
|
|
829
810
|
"docs": "api/animation",
|
|
830
811
|
"detect": "morphAttributes|morphTargetInfluences|morphTargetDictionary"
|
|
831
812
|
},
|
|
@@ -834,9 +815,9 @@
|
|
|
834
815
|
"category": "Materials",
|
|
835
816
|
"three": "MeshStandardMaterial",
|
|
836
817
|
"status": "direct",
|
|
837
|
-
"since": "0.1",
|
|
838
818
|
"target": "materials.standard({ color, map, metalness, roughness, normalMap, aoMap, emissive, ... })",
|
|
839
|
-
"notes": "Both follow glTF's metallic-roughness model with the same formulas, so color, metalness, roughness and emissive
|
|
819
|
+
"notes": "Both follow glTF's metallic-roughness model with the same formulas, so color, metalness, roughness and emissive carry over. `roughnessMap` and `metalnessMap` become one `metalnessRoughnessMap`. A texture's repeat, offset and rotation become the material's `uvTransform`, or a per-map `mapUvTransforms` entry.",
|
|
820
|
+
"details": "Roughness has three.js r187's floor of 0.045. Highlights on small curved shapes widen by Filament's specular anti-aliasing. three.js adds its own term, so they are a little brighter and narrower there. A normal map that tilts a reflection below the surface fades the environment's reflection, which three.js does not. A normal map on a mesh without tangents takes its frame from how positions and texture coordinates change between pixels, as in three.js.",
|
|
840
821
|
"docs": "api/materials",
|
|
841
822
|
"detect": "\\bMeshStandardMaterial\\b"
|
|
842
823
|
},
|
|
@@ -845,9 +826,8 @@
|
|
|
845
826
|
"category": "Materials",
|
|
846
827
|
"three": "MeshPhysicalMaterial (clearcoat, transmission, dispersion, sheen, iridescence, anisotropy, specular)",
|
|
847
828
|
"status": "changed",
|
|
848
|
-
"since": "0.1",
|
|
849
829
|
"target": "materials.standard, with ior, specularIntensity, specularColor and their maps, transmission, dispersion, clearcoat, sheen, iridescence and anisotropy",
|
|
850
|
-
"notes": "materials.standard takes ior
|
|
830
|
+
"notes": "`materials.standard` takes `ior`, `specularIntensity`, `specularColor` and their maps, `transmission`, `dispersion`, `clearcoat`, `sheen`, `iridescence` and `anisotropy`. Each uses three.js's names and formulas, with the detail on its own entry.",
|
|
851
831
|
"docs": "api/materials",
|
|
852
832
|
"detect": "\\bMeshPhysicalMaterial\\b"
|
|
853
833
|
},
|
|
@@ -856,9 +836,9 @@
|
|
|
856
836
|
"category": "Materials",
|
|
857
837
|
"three": "MeshPhysicalMaterial ior / reflectivity / specularIntensity / specularColor / specularIntensityMap / specularColorMap",
|
|
858
838
|
"status": "direct",
|
|
859
|
-
"since": "0.2",
|
|
860
839
|
"target": "materials.standard({ ior, specularIntensity, specularColor, specularIntensityMap, specularColorMap })",
|
|
861
|
-
"notes": "Same names, ranges and formulas, so the values carry over, and glTF's KHR_materials_ior and KHR_materials_specular load into them. specularColor takes linear components above 1, as three.js's Color does. reflectivity has no option: set ior = (1 + 0.4 * reflectivity) / (1 - 0.4 * reflectivity)
|
|
840
|
+
"notes": "Same names, ranges and formulas, so the values carry over, and glTF's `KHR_materials_ior` and `KHR_materials_specular` load into them. `specularColor` takes linear components above 1, as three.js's Color does. `reflectivity` has no option: set `ior = (1 + 0.4 * reflectivity) / (1 - 0.4 * reflectivity)`, as three.js converts it.",
|
|
841
|
+
"details": "A glTF `ior` of 0 becomes 1000, as `GLTFLoader` reads it.",
|
|
862
842
|
"docs": "api/materials",
|
|
863
843
|
"detect": "\\bspecular(Intensity|Color)(Map)?\\b|\\.ior\\b|\\bior\\s*:"
|
|
864
844
|
},
|
|
@@ -867,9 +847,9 @@
|
|
|
867
847
|
"category": "Materials",
|
|
868
848
|
"three": "MeshPhysicalMaterial transmission / thickness / attenuationColor / attenuationDistance / dispersion",
|
|
869
849
|
"status": "changed",
|
|
870
|
-
"since": "0.2",
|
|
871
850
|
"target": "materials.standard({ transmission, thickness, ior, dispersion, roughness, attenuationColor, attenuationDistance })",
|
|
872
|
-
"notes": "Same names, ranges and formulas
|
|
851
|
+
"notes": "Same names, ranges and formulas, and glTF's transmission, volume and dispersion extensions load into them. Give `transmission` when you create the material, even as 0, to change it later. A masked material keeps its transmission, and the hash alpha mode has no counterpart and throws.",
|
|
852
|
+
"details": "The surface samples a mipmapped copy of the opaque objects' colors where its bent ray leaves the volume, as three.js does. The copy holds opaque objects only. three.js also draws the back faces of double-sided glass into it. Where the bent ray lands on an opaque object in front of the surface, null3D shows what lies straight behind. three.js shows that object's color.\n\n`transmissionMap` and `thicknessMap` keep row slots of their own and sample the specular slots' arrays. The red and green channels there scale the transmission and the thickness. So a material with them may also give the specular maps where the two textures share an array.\n\nA thickness map never shares a specular color map's array, because one is linear and the other sRGB. A development build refuses that pair. A layered material keeps the two maps beside its layers, unless a layer map fills the array that one of them samples. A development build refuses that too.\n\n`dispersion` spreads the index of refraction over three rays, one per color, with red taking the lowest. A prism then separates the light behind it into colors. Its cost falls on the materials that set it. A custom material sets `s.transmission` in its surface function.",
|
|
873
853
|
"docs": "api/materials",
|
|
874
854
|
"detect": "\\b(transmission|thickness|attenuationColor|attenuationDistance|dispersion)\\s*[:=]"
|
|
875
855
|
},
|
|
@@ -878,9 +858,9 @@
|
|
|
878
858
|
"category": "Materials",
|
|
879
859
|
"three": "MeshSSSNodeMaterial / SubsurfaceScatteringShader (thicknessColor, thicknessDistortion, thicknessAmbient, thicknessAttenuation, thicknessPower, thicknessScale, thicknessMap)",
|
|
880
860
|
"status": "changed",
|
|
881
|
-
"since": "0.2",
|
|
882
861
|
"target": "materials.standard({ diffuseTransmission, diffuseTransmissionColor, diffuseTransmissionMap, doubleSided: true }), with subsurfaceRadius and subsurfaceColor for skin",
|
|
883
|
-
"notes": "Light from behind a thin surface shows on its front through glTF's diffuse transmission, which
|
|
862
|
+
"notes": "Light from behind a thin surface shows on its front through glTF's diffuse transmission, which `KHR_materials_diffuse_transmission` also loads. Map `thicknessColor`, `thicknessScale` and `thicknessMap` to the diffuse transmission options. `thicknessDistortion` and `thicknessPower` have no option, and the front keeps `1 - diffuseTransmission` of its light.",
|
|
863
|
+
"details": "`thicknessScale` stays between 0 and 1, and the thickness map's value sits in alpha. `thicknessAmbient` maps to the ambient and environment light, which shine through by themselves.\n\nthree.js's term glows most when the camera looks toward the light. `thicknessDistortion` and `thicknessPower` shape the glow. null3D's light from behind spreads evenly, as glTF describes. So those two have no option, and the glow looks softer head on.\n\nFor skin, wax and marble, add `subsurfaceRadius` and `subsurfaceColor`. The subsurface blur spreads the diffuse light on the High and Ultra presets. A custom material sets `s.diffuseTransmission` in its surface function.",
|
|
884
864
|
"docs": "api/materials",
|
|
885
865
|
"detect": "\\b(MeshSSSNodeMaterial|SubsurfaceScatteringShader|thicknessColor|thicknessDistortion|thicknessPower)\\b"
|
|
886
866
|
},
|
|
@@ -889,9 +869,9 @@
|
|
|
889
869
|
"category": "Materials",
|
|
890
870
|
"three": "MeshPhysicalMaterial clearcoat / clearcoatRoughness / clearcoatNormalScale / clearcoatMap / clearcoatRoughnessMap / clearcoatNormalMap",
|
|
891
871
|
"status": "changed",
|
|
892
|
-
"since": "0.2",
|
|
893
872
|
"target": "materials.standard({ clearcoat, clearcoatRoughness, clearcoatNormalScale, clearcoatMap, clearcoatRoughnessMap, clearcoatNormalMap })",
|
|
894
|
-
"notes": "Same names, ranges and formulas, and glTF's KHR_materials_clearcoat loads into them. Give a clear coat option when you create the material, even as 0, to change it later. clearcoatMap and clearcoatRoughnessMap must be one texture, with the coat in red and its roughness in green
|
|
873
|
+
"notes": "Same names, ranges and formulas, and glTF's `KHR_materials_clearcoat` loads into them. Give a clear coat option when you create the material, even as 0, to change it later. `clearcoatMap` and `clearcoatRoughnessMap` must be one texture, with the coat in red and its roughness in green.",
|
|
874
|
+
"details": "Pack two textures into one for that pair. A material with a clear coat or a sheen takes no `lightMap`, `specularIntensityMap` or `specularColorMap`. A custom material sets `s.clearcoat` in its surface function.\n\nThe car paint example add-on (guides/car-paint) builds metal flakes and panel seams over this clear coat. three.js has no flake lobe: its metal flakes are a normal map.",
|
|
895
875
|
"docs": "api/materials",
|
|
896
876
|
"detect": "\\bclearcoat(Roughness|NormalScale|Map|RoughnessMap|NormalMap)?\\b"
|
|
897
877
|
},
|
|
@@ -900,9 +880,9 @@
|
|
|
900
880
|
"category": "Materials",
|
|
901
881
|
"three": "MeshPhysicalMaterial iridescence / iridescenceIOR / iridescenceThicknessRange / iridescenceMap / iridescenceThicknessMap",
|
|
902
882
|
"status": "changed",
|
|
903
|
-
"since": "0.3",
|
|
904
883
|
"target": "materials.standard({ iridescence, iridescenceIor, iridescenceThicknessRange, iridescenceMap, iridescenceThicknessMap })",
|
|
905
|
-
"notes": "The same thin-film formulas, and glTF's KHR_materials_iridescence loads into them. three.js names the index of refraction iridescenceIOR and takes its thickness as one range
|
|
884
|
+
"notes": "The same thin-film formulas apply, and glTF's `KHR_materials_iridescence` loads into them. three.js names the index of refraction `iridescenceIOR` and takes its thickness as one range. Give `iridescenceIor` and `iridescenceThicknessRange`, in nanometers.",
|
|
885
|
+
"details": "Give an iridescence option when you create the material to change it later. A material with iridescence takes no `lightMap`, `specularIntensityMap` or `specularColorMap`, and no clear coat's or sheen's maps. A custom material sets `s.iridescence`, `s.iridescenceIor` and `s.iridescenceThickness` in its surface function.",
|
|
906
886
|
"docs": "api/materials",
|
|
907
887
|
"detect": "\\biridescence(IOR|Ior|ThicknessRange|Map|ThicknessMap)?\\b"
|
|
908
888
|
},
|
|
@@ -911,9 +891,9 @@
|
|
|
911
891
|
"category": "Materials",
|
|
912
892
|
"three": "MeshPhysicalMaterial anisotropy / anisotropyRotation / anisotropyMap",
|
|
913
893
|
"status": "changed",
|
|
914
|
-
"since": "0.3",
|
|
915
894
|
"target": "materials.standard({ anisotropy, anisotropyRotation, anisotropyMap })",
|
|
916
|
-
"notes": "The same anisotropic GGX lobe with three.js's formulas, and glTF's KHR_materials_anisotropy loads into it. Leave the map out and the stretch still draws: its direction comes from the mesh's tangents, else the texture coordinates
|
|
895
|
+
"notes": "The same anisotropic GGX lobe applies, with three.js's formulas, and glTF's `KHR_materials_anisotropy` loads into it. Leave the map out and the stretch still draws: its direction comes from the mesh's tangents, else the texture coordinates. A surface with neither takes a steady direction of its own.",
|
|
896
|
+
"details": "It takes no `lightMap`, `specularIntensityMap` or `specularColorMap`, and no clear coat's or sheen's maps. Rectangles and tubes of light shade it as three.js does, without the stretch.",
|
|
917
897
|
"docs": "api/materials",
|
|
918
898
|
"detect": "\\banisotropy(Strength|Rotation|Map)\\b|[{,]\\s*anisotropy\\s*:"
|
|
919
899
|
},
|
|
@@ -922,9 +902,9 @@
|
|
|
922
902
|
"category": "Materials",
|
|
923
903
|
"three": "MeshPhysicalMaterial sheen / sheenColor / sheenRoughness / sheenColorMap / sheenRoughnessMap",
|
|
924
904
|
"status": "changed",
|
|
925
|
-
"since": "0.2",
|
|
926
905
|
"target": "materials.standard({ sheenColor, sheenRoughness, sheenColorMap, sheenRoughnessMap })",
|
|
927
|
-
"notes": "The same Charlie sheen with three.js's formulas, and glTF's KHR_materials_sheen loads into it. There is no sheen option: give sheenColor times three.js's sheen
|
|
906
|
+
"notes": "The same Charlie sheen applies, with three.js's formulas, and glTF's `KHR_materials_sheen` loads into it. There is no `sheen` option: give `sheenColor` times three.js's `sheen`, which defaults to 0. Give a sheen option when you create the material to change it later.",
|
|
907
|
+
"details": "A three.js material without sheen shows none, so its port leaves the sheen options out. `sheenColorMap` and `sheenRoughnessMap` must be one texture, with the roughness in alpha, as glTF packs them. A material with a clear coat or a sheen takes no `lightMap`, `specularIntensityMap` or `specularColorMap`.",
|
|
928
908
|
"docs": "api/materials",
|
|
929
909
|
"detect": "\\bsheen(Color|Roughness|ColorMap|RoughnessMap)?\\b"
|
|
930
910
|
},
|
|
@@ -933,9 +913,9 @@
|
|
|
933
913
|
"category": "Geometry",
|
|
934
914
|
"three": "DecalGeometry (addon), with a material that has polygonOffset",
|
|
935
915
|
"status": "changed",
|
|
936
|
-
"since": "0.2",
|
|
937
916
|
"target": "scene.createMesh({ mesh: geometry.box(), material: materials.decal({ map, normalMap, roughness }), position, rotation, scale: size })",
|
|
938
|
-
"notes": "No geometry is cut: the box projects the material onto every opaque surface inside it
|
|
917
|
+
"notes": "No geometry is cut: the box projects the material onto every opaque surface inside it. It draws in a pass after the opaque objects, lit by every light and shadow. `DecalGeometry`'s position, orientation and size become the box's position, rotation and scale.",
|
|
918
|
+
"details": "The image lies on the box's x and y sides and looks along its z axis, as `DecalGeometry` lays it. There is no target mesh: the decal marks every opaque surface in its box. `polygonOffset`, `depthWrite: false` and `transparent: true` are not needed.\n\n`angleFade` and `edgeFade` fade the decal on surfaces that turn away and near the box's ends, where `DecalGeometry` stretches the image. A batch of boxes with one decal material draws many decals in one draw. Blended surfaces show no decals. Projected texture libraries, such as three-projected-material, become a large decal box.",
|
|
939
919
|
"docs": "api/materials",
|
|
940
920
|
"detect": "\\bDecalGeometry\\b"
|
|
941
921
|
},
|
|
@@ -944,9 +924,8 @@
|
|
|
944
924
|
"category": "Materials",
|
|
945
925
|
"three": "MeshBasicMaterial",
|
|
946
926
|
"status": "direct",
|
|
947
|
-
"since": "0.1",
|
|
948
927
|
"target": "materials.unlit({ color, map, opacity, alphaMode, vertexColors })",
|
|
949
|
-
"notes": "Its map's alpha and the vertex alpha join the opacity, as in three.js.",
|
|
928
|
+
"notes": "Its map's alpha and the vertex alpha join the opacity, as in three.js. The exposure and the tone mapping apply to it, as three.js applies them.",
|
|
950
929
|
"docs": "api/materials",
|
|
951
930
|
"detect": "\\bMeshBasicMaterial\\b"
|
|
952
931
|
},
|
|
@@ -955,7 +934,6 @@
|
|
|
955
934
|
"category": "Materials",
|
|
956
935
|
"three": "MeshLambertMaterial / MeshPhongMaterial",
|
|
957
936
|
"status": "changed",
|
|
958
|
-
"since": "0.1",
|
|
959
937
|
"target": "materials.standard with metalness 0 and roughness near 1 (Lambert), or roughness tuned to the Phong shininess",
|
|
960
938
|
"notes": "Expect small visual differences: the standard material adds a faint highlight and keeps energy as three.js's MeshStandardMaterial does. Compare screenshots of both versions, then accept or tune.",
|
|
961
939
|
"docs": "api/materials",
|
|
@@ -966,9 +944,9 @@
|
|
|
966
944
|
"category": "Materials",
|
|
967
945
|
"three": "MeshToonMaterial",
|
|
968
946
|
"status": "manual",
|
|
969
|
-
"since": "0.1",
|
|
970
947
|
"target": "materials.shader({ wgsl, uniforms }) with a toon surface function",
|
|
971
|
-
"notes": "
|
|
948
|
+
"notes": "A surface function cannot read the scene's lights. Pass the light direction as a uniform, step the light into bands, and return the result as emissive. A lobe function, `fn lobe(input: LobeInput) -> vec3f`, does read each light.",
|
|
949
|
+
"details": "The engine calls the lobe for the main directional light and for each point and spot light, with the light's direction and its shadowed irradiance. It adds the lobe's color to that light's specular, beside the base lighting. So bands made there follow every such light and its shadows.\n\nSet the surface's `baseColor` to black and its roughness to 1, as the uniform recipe does, so the base lighting adds little beside the bands. The engine calls no lobe for the fill directional lights and the area lights. So the bands do not follow them.",
|
|
972
950
|
"docs": "shaders/surface-functions",
|
|
973
951
|
"detect": "\\bMeshToonMaterial\\b"
|
|
974
952
|
},
|
|
@@ -977,8 +955,7 @@
|
|
|
977
955
|
"category": "Materials",
|
|
978
956
|
"three": "MeshNormalMaterial / MeshDepthMaterial / MeshDistanceMaterial / MeshMatcapMaterial",
|
|
979
957
|
"status": "changed",
|
|
980
|
-
"
|
|
981
|
-
"target": "debug.view('normals' | 'depth') for debugging; matcap is a surface-function recipe (0.2)",
|
|
958
|
+
"target": "debug.view('normals' | 'depth') for debugging; matcap is a recipe with an unlit function, fn unlit",
|
|
982
959
|
"notes": "debug.view shades the whole scene, in development builds only. Its normals are in world space, where MeshNormalMaterial's are in view space. Its depth is white at the near plane, on a logarithmic scale for a perspective camera.",
|
|
983
960
|
"docs": "api/debug",
|
|
984
961
|
"detect": "\\bMesh(Normal|Depth|Distance|Matcap)Material\\b"
|
|
@@ -988,9 +965,9 @@
|
|
|
988
965
|
"category": "Materials",
|
|
989
966
|
"three": "ShaderMaterial / RawShaderMaterial (GLSL)",
|
|
990
967
|
"status": "manual",
|
|
991
|
-
"
|
|
992
|
-
"
|
|
993
|
-
"
|
|
968
|
+
"target": "materials.shader({ wgsl, uniforms, textures }) with a WGSL surface function, an unlit function (fn unlit), or a full WGSL shader",
|
|
969
|
+
"notes": "Rewrite in WGSL, in one literal tagged `/* wgsl */`. Prefer a surface function, so lighting, shadows, fog and instancing keep working. A shader that ignores the lights becomes an unlit function, `fn unlit`, which keeps the uniforms, the textures and the fog.",
|
|
970
|
+
"details": "The built-ins that `ShaderMaterial` adds have WGSL names of their own (see the ShaderMaterial built-ins entry). Declare the uniforms once, as `struct Uniforms`. Updates such as `material.uniforms.uSpeed.value = 2` become `material.set({ speed: 2 })`. The type check rejects a name that `struct Uniforms` lacks.\n\nA `sampler2D` uniform becomes `var name: texture_2d<f32>;` in the WGSL and an entry of the `textures` option. Sample it with `textureSample(name, nameSampler, uv)`. Textures are fixed when the material is created. Full shaders take no textures.",
|
|
994
971
|
"docs": "shaders/surface-functions",
|
|
995
972
|
"detect": "\\b(Raw)?ShaderMaterial\\b"
|
|
996
973
|
},
|
|
@@ -999,9 +976,8 @@
|
|
|
999
976
|
"category": "Materials",
|
|
1000
977
|
"three": "material.onBeforeCompile (shader-chunk patching)",
|
|
1001
978
|
"status": "manual",
|
|
1002
|
-
"since": "0.1",
|
|
1003
979
|
"target": "materials.shader({ wgsl }) with a surface function or a vertex-offset function",
|
|
1004
|
-
"notes": "The engine has no shader chunks to patch. Keep the standard options on the new material: defaultSurface applies them. A custom material takes no standard maps (map, normalMap and the rest): declare textures in the WGSL and pass them with the textures option
|
|
980
|
+
"notes": "The engine has no shader chunks to patch. Keep the standard options on the new material: defaultSurface applies them. A custom material takes no standard maps (map, normalMap and the rest): declare textures in the WGSL and pass them with the textures option.",
|
|
1005
981
|
"docs": "shaders/surface-functions",
|
|
1006
982
|
"detect": "\\.onBeforeCompile\\s*="
|
|
1007
983
|
},
|
|
@@ -1010,19 +986,20 @@
|
|
|
1010
986
|
"category": "Materials",
|
|
1011
987
|
"three": "A ShaderMaterial that samples the scene's depth texture",
|
|
1012
988
|
"status": "changed",
|
|
1013
|
-
"since": "0.3",
|
|
1014
989
|
"target": "materials.shader({ sceneInputs: ['sceneDepth'], wgsl }) with sceneDepth(uv) or sceneDistance(uv)",
|
|
1015
|
-
"notes": "Declare sceneInputs: ['sceneDepth'] and read the opaque scene's depth in the surface function, with uv = input.fragCoord.xy / frame.resolution
|
|
1016
|
-
"
|
|
990
|
+
"notes": "Declare `sceneInputs: ['sceneDepth']` and read the opaque scene's depth in the surface function, with `uv = input.fragCoord.xy / frame.resolution`. The engine binds a copy of the opaque depth. `sceneDepth` gives 1 at the near plane and 0 at the far plane, and `sceneDistance` gives the distance in world units.",
|
|
991
|
+
"details": "A surface in the opaque pass, or in a scene or reflection pass, reads 0, the far plane.",
|
|
992
|
+
"docs": "api/materials",
|
|
993
|
+
"detect": "\\b(DepthTexture|perspectiveDepthToViewZ|viewportDepthTexture|viewportLinearDepth)\\b|\\.depthTexture\\b"
|
|
1017
994
|
},
|
|
1018
995
|
{
|
|
1019
996
|
"id": "mat-shader-builtins",
|
|
1020
997
|
"category": "Materials",
|
|
1021
998
|
"three": "ShaderMaterial built-ins: uv1, gl_FragCoord, gl_InstanceID / instanceIndex, modelMatrix, normalMatrix, viewMatrix, projectionMatrix, cameraNear, cameraFar",
|
|
1022
999
|
"status": "changed",
|
|
1023
|
-
"since": "0.2",
|
|
1024
1000
|
"target": "input.uv1, input.fragCoord, input.instance, object.worldMatrix, object.normalMatrix, camera.view, camera.projection, camera.near, camera.far",
|
|
1025
|
-
"notes": "The engine works relative to the camera, so its matrices do too. object.worldMatrix has its translation relative to the camera, and camera.view holds the camera's rotation only
|
|
1001
|
+
"notes": "The engine works relative to the camera, so its matrices do too. `object.worldMatrix` has its translation relative to the camera, and `camera.view` holds the camera's rotation only. `camera.projection * camera.view * object.worldMatrix` places a vertex, as `projectionMatrix * modelViewMatrix` does.",
|
|
1002
|
+
"details": "`object.position` gives the origin in the world. `object.normalMatrix` turns normals into world space, where three.js's `normalMatrix` turns them into view space. Multiply by `camera.view` for view space. `camera.projection` has reversed depth, 1 at the near plane. `input.fragCoord` counts from the top left, so `gl_FragCoord.y` becomes `frame.resolution.y - input.fragCoord.y`.\n\n`input.instance` is the row in an instance batch, 0 for an object of the scene. `object.id` and `mesh.shaderId` tell objects apart, which three.js leaves to uniforms. Only WGSL that reads `uv1`, `instance`, an id or the object's matrices pays for them.",
|
|
1026
1003
|
"docs": "shaders/builtins",
|
|
1027
1004
|
"detect": "\\b(modelMatrix|normalMatrix|viewMatrix|projectionMatrix|cameraNear|cameraFar|gl_FragCoord|gl_InstanceID|instanceIndex)\\b"
|
|
1028
1005
|
},
|
|
@@ -1031,7 +1008,6 @@
|
|
|
1031
1008
|
"category": "Materials",
|
|
1032
1009
|
"three": "TSL / NodeMaterial (three/tsl, three/webgpu)",
|
|
1033
1010
|
"status": "manual",
|
|
1034
|
-
"since": "0.1",
|
|
1035
1011
|
"target": "materials.shader({ wgsl }) with a WGSL surface function",
|
|
1036
1012
|
"notes": "Most TSL nodes map to one WGSL expression; see the shader porting reference.",
|
|
1037
1013
|
"docs": "shaders/surface-functions",
|
|
@@ -1042,9 +1018,9 @@
|
|
|
1042
1018
|
"category": "Materials",
|
|
1043
1019
|
"three": "transparent / opacity / alphaTest / depthWrite / depthTest / blending / vertexColors / flatShading / colorWrite",
|
|
1044
1020
|
"status": "changed",
|
|
1045
|
-
"
|
|
1046
|
-
"
|
|
1047
|
-
"
|
|
1021
|
+
"target": "alphaMode: 'blend' | 'mask' (with alphaCutoff), depthWrite, depthTest, colorWrite, blending: 'normal' | 'additive' | 'multiply' | 'weighted', vertexColors, flatShading",
|
|
1022
|
+
"notes": "`transparent: true` becomes `alphaMode: 'blend'`, and `alphaTest` becomes `alphaMode: 'mask'` with `alphaCutoff`. `depthTest: false` writes no depth either, as in three.js's WebGL renderer. `colorWrite: false` writes depth and no color.",
|
|
1023
|
+
"details": "Its objects draw before the opaque objects that write color, so the depth holds back their color behind the surface. three.js orders that by material. `blending` takes effect with `alphaMode: 'blend'` only. three.js blends an opaque material with additive or multiply blending too. A mask's cut edges are smoothed by default; `alphaToCoverage: false` keeps three.js's hard edges.\n\nThe engine blends in linear color before the tone mapping, as `WebGPURenderer` does. `WebGLRenderer` blends after its tone mapping and sRGB encoding. So see-through surfaces look a little lighter in null3D, and additive glows a little weaker. A blended material writes depth by default, as three.js's transparent materials do. Set `depthWrite: false` on glows and on surfaces that cross, so they never hide each other.",
|
|
1048
1024
|
"docs": "api/materials",
|
|
1049
1025
|
"detect": "\\b(transparent|alphaTest|depthWrite|depthTest|colorWrite|blending|vertexColors|flatShading)\\s*[:=]"
|
|
1050
1026
|
},
|
|
@@ -1053,9 +1029,9 @@
|
|
|
1053
1029
|
"category": "Materials",
|
|
1054
1030
|
"three": "oitPass(scene, camera) (OITPassNode)",
|
|
1055
1031
|
"status": "changed",
|
|
1056
|
-
"since": "0.2",
|
|
1057
1032
|
"target": "alphaMode: 'blend' with blending: 'weighted' on each material that the pass blended, or the quality setting momentTransparency: true for the better layer",
|
|
1058
|
-
"notes": "The same weighted blended order-independent transparency
|
|
1033
|
+
"notes": "The same weighted blended order-independent transparency applies, with three.js's default weight. three.js's pass takes every transparent material of normal blending without transmission; null3D takes the materials that ask for it. The weighted surfaces blend over the other see-through surfaces, test the scene's depth and write none, and `weightNode` has no counterpart.",
|
|
1034
|
+
"details": "The coverage sums `-log2(1 - alpha)` instead of multiplying `1 - alpha`, so both targets blend alike. Compatibility mode needs that; the result is the same. The layer draws at one sample on every path, where three.js's matches the scene's samples on WebGPU. Custom materials do not take it.\n\nThe quality setting `momentTransparency` blends the same surfaces with a store of four depth moments. That is nearer an exact back-to-front blend than the weighted average is, and it draws them twice. It is off on every preset. It takes the standard, basic and sprite materials whose blending is normal or weighted.",
|
|
1059
1035
|
"docs": "api/materials",
|
|
1060
1036
|
"detect": "\\boitPass\\s*\\(|\\bOITPassNode\\b"
|
|
1061
1037
|
},
|
|
@@ -1064,9 +1040,9 @@
|
|
|
1064
1040
|
"category": "Materials",
|
|
1065
1041
|
"three": "side: DoubleSide",
|
|
1066
1042
|
"status": "changed",
|
|
1067
|
-
"since": "0.1",
|
|
1068
1043
|
"target": "doubleSided: true",
|
|
1069
|
-
"notes": "
|
|
1044
|
+
"notes": "A back face lights as if it faced the camera, as in three.js. A double-sided material with `alphaMode: 'blend'` draws its back faces first, then its front faces, as three.js does. `BackSide` has no equivalent: flip the geometry.",
|
|
1045
|
+
"details": "`side` is fixed when the material is created.",
|
|
1070
1046
|
"docs": "api/materials",
|
|
1071
1047
|
"detect": "\\bside\\s*[:=]"
|
|
1072
1048
|
},
|
|
@@ -1075,7 +1051,6 @@
|
|
|
1075
1051
|
"category": "Materials",
|
|
1076
1052
|
"three": "forceSinglePass: true",
|
|
1077
1053
|
"status": "direct",
|
|
1078
|
-
"since": "0.2",
|
|
1079
1054
|
"target": "forceSinglePass: true",
|
|
1080
1055
|
"notes": "With alphaMode: 'blend' and doubleSided: true, both faces draw in one draw, in the mesh's triangle order. Fixed when the material is created.",
|
|
1081
1056
|
"docs": "api/materials",
|
|
@@ -1086,9 +1061,9 @@
|
|
|
1086
1061
|
"category": "Materials",
|
|
1087
1062
|
"three": "alphaToCoverage: true (with alphaTest)",
|
|
1088
1063
|
"status": "changed",
|
|
1089
|
-
"since": "0.2",
|
|
1090
1064
|
"target": "alphaMode: 'mask', alphaCutoff (alphaToCoverage is on by default)",
|
|
1091
|
-
"notes": "The cut edges fade over one pixel above the cutoff and MSAA covers that share of each pixel, as in three.js. null3D turns it on for every mask; alphaToCoverage: false turns it off. Without MSAA it is a plain mask.
|
|
1065
|
+
"notes": "The cut edges fade over one pixel above the cutoff, and MSAA covers that share of each pixel, as in three.js. null3D turns it on for every mask; `alphaToCoverage: false` turns it off. Without MSAA it is a plain mask.",
|
|
1066
|
+
"details": "Without `alphaTest`, three.js turns raw alpha into coverage: use `alphaMode: 'hash'` for that look. A custom material takes it too, where its WGSL sets or reads the surface's alpha. Its shadow caster then keeps the mask's holes. The mode is fixed when the material is created. Its shadow cuts at `alphaCutoff`, where three.js's shadow cuts at 0.5.",
|
|
1092
1067
|
"docs": "api/materials",
|
|
1093
1068
|
"detect": "\\balphaToCoverage\\s*[:=]"
|
|
1094
1069
|
},
|
|
@@ -1097,9 +1072,9 @@
|
|
|
1097
1072
|
"category": "Materials",
|
|
1098
1073
|
"three": "alphaHash: true",
|
|
1099
1074
|
"status": "changed",
|
|
1100
|
-
"since": "0.2",
|
|
1101
1075
|
"target": "alphaMode: 'hash'",
|
|
1102
|
-
"notes": "Three.js's cells and threshold
|
|
1076
|
+
"notes": "Three.js's cells and threshold apply to each point's place on the mesh, so the alpha sets the share of the surface that draws. The noise pattern differs: null3D hashes each cell with integer math, so every GPU draws the same pattern. `alphaCutoff` has no effect in this mode.",
|
|
1077
|
+
"details": "three.js's sine hash changes from GPU to GPU. A hashed surface casts a hashed shadow, where three.js casts the whole shape. A custom material takes the mode where its WGSL sets or reads the surface's alpha, and its shadow and motion keep the same pattern.",
|
|
1103
1078
|
"docs": "api/materials",
|
|
1104
1079
|
"detect": "\\balphaHash\\s*[:=]"
|
|
1105
1080
|
},
|
|
@@ -1108,9 +1083,9 @@
|
|
|
1108
1083
|
"category": "Materials",
|
|
1109
1084
|
"three": "material.wireframe = true",
|
|
1110
1085
|
"status": "direct",
|
|
1111
|
-
"since": "0.2",
|
|
1112
1086
|
"target": "materials.standard({ wireframe: true }), and the same option on unlit and custom materials",
|
|
1113
|
-
"notes": "Each triangle's edges draw as lines one pixel wide with the material's own shading, from an edge list that the engine keeps for each mesh
|
|
1087
|
+
"notes": "Each triangle's edges draw as lines one pixel wide with the material's own shading, from an edge list that the engine keeps for each mesh. Its shadows draw lines too. Flat shading and bump maps have no effect, as in three.js, and `wireframeLinewidth` has none either.",
|
|
1088
|
+
"details": "The option is fixed when the material is created.",
|
|
1114
1089
|
"docs": "api/materials",
|
|
1115
1090
|
"detect": "\\bwireframe\\s*[:=]"
|
|
1116
1091
|
},
|
|
@@ -1119,7 +1094,6 @@
|
|
|
1119
1094
|
"category": "Materials",
|
|
1120
1095
|
"three": "material.envMap / envMapIntensity",
|
|
1121
1096
|
"status": "changed",
|
|
1122
|
-
"since": "0.2",
|
|
1123
1097
|
"target": "scene.setEnvironment(env); materials.standard({ envIntensity })",
|
|
1124
1098
|
"notes": "One environment lights the scene; a material takes no environment of its own. envMapIntensity becomes `envIntensity`, which multiplies the scene's intensity. three.js uses scene.environmentIntensity in place of envMapIntensity under scene.environment.",
|
|
1125
1099
|
"docs": "concepts/lighting",
|
|
@@ -1130,7 +1104,6 @@
|
|
|
1130
1104
|
"category": "Materials",
|
|
1131
1105
|
"three": "material.needsUpdate = true",
|
|
1132
1106
|
"status": "changed",
|
|
1133
|
-
"since": "0.1",
|
|
1134
1107
|
"target": "Nothing to do",
|
|
1135
1108
|
"notes": "Options that change the shader or the pipeline, such as texture maps, vertexColors, doubleSided and flatShading, are fixed when a material is created. Create each variant during loading: a new one compiles a pipeline, which can make a frame late.",
|
|
1136
1109
|
"docs": "concepts/materials",
|
|
@@ -1141,9 +1114,9 @@
|
|
|
1141
1114
|
"category": "Materials",
|
|
1142
1115
|
"three": "ShadowMaterial (shadow-catcher planes)",
|
|
1143
1116
|
"status": "direct",
|
|
1144
|
-
"since": "0.2",
|
|
1145
1117
|
"target": "materials.shadowCatcher({ color, opacity })",
|
|
1146
|
-
"notes": "The plane shows the main directional light's shadow in the material's color where the shadow falls, and nothing where the light reaches it. The default color is black, as three.js's. Create the mesh with receiveShadows: true
|
|
1118
|
+
"notes": "The plane shows the main directional light's shadow in the material's color where the shadow falls, and nothing where the light reaches it. The default color is black, as three.js's. Create the mesh with `receiveShadows: true`, or call `setReceiveShadows(true)`.",
|
|
1119
|
+
"details": "Point and spot light shadows do not show on it. The scene's fog leaves it alone. Put the plane just above the surface whose shadows it catches.",
|
|
1147
1120
|
"docs": "api/materials",
|
|
1148
1121
|
"detect": "\\bShadowMaterial\\b"
|
|
1149
1122
|
},
|
|
@@ -1152,7 +1125,6 @@
|
|
|
1152
1125
|
"category": "Materials",
|
|
1153
1126
|
"three": "material fog: false",
|
|
1154
1127
|
"status": "direct",
|
|
1155
|
-
"since": "0.1",
|
|
1156
1128
|
"target": "fog: false in the material options",
|
|
1157
1129
|
"notes": "",
|
|
1158
1130
|
"docs": "api/materials",
|
|
@@ -1163,9 +1135,9 @@
|
|
|
1163
1135
|
"category": "Materials",
|
|
1164
1136
|
"three": "material.bumpMap / bumpScale",
|
|
1165
1137
|
"status": "direct",
|
|
1166
|
-
"since": "0.2",
|
|
1167
1138
|
"target": "materials.standard({ bumpMap, bumpScale })",
|
|
1168
|
-
"notes": "The same formula
|
|
1139
|
+
"notes": "The same formula applies: the red channel's change from one pixel to the next bends the normal. The look is the same, and it depends on the surface's size on screen as three.js's does. A normal map wins over it, as in three.js, and `bumpScale` changes with `set`.",
|
|
1140
|
+
"details": "A normal map converted offline costs less at run time: `bunx @null3d/cli assets normal-from-bump bump.png normal.ktx2 --scale <bumpScale>`.",
|
|
1169
1141
|
"docs": "api/materials",
|
|
1170
1142
|
"detect": "\\bbump(Map|Scale)\\b"
|
|
1171
1143
|
},
|
|
@@ -1174,9 +1146,9 @@
|
|
|
1174
1146
|
"category": "Materials",
|
|
1175
1147
|
"three": "material.displacementMap / displacementScale / displacementBias",
|
|
1176
1148
|
"status": "changed",
|
|
1177
|
-
"since": "0.2",
|
|
1178
1149
|
"target": "materials.standard({ displacementMap, displacementScale, displacementBias })",
|
|
1179
|
-
"notes": "Vertices move as in three.js: along the normal by the red channel times the scale, plus the bias, after skinning and morph targets. Shadows and the depth prepass follow, and culling grows each object's bounds by the farthest move
|
|
1150
|
+
"notes": "Vertices move as in three.js: along the normal by the red channel times the scale, plus the bias, after skinning and morph targets. Shadows and the depth prepass follow, and culling grows each object's bounds by the farthest move. No `setBounds` call is needed.",
|
|
1151
|
+
"details": "Without a `normalMap` or `bumpMap`, null3D bends the normals by the map's slope, so the light follows the moved surface. three.js keeps the flat mesh's normals, so a displaced surface without a normal map shades as if it were flat. With a normal map, both engines light it the same. `parallax: true` adds parallax occlusion mapping from the same map, which three.js does not have. Raycasts see the mesh before the map moves it, in both engines.",
|
|
1180
1152
|
"docs": "api/materials",
|
|
1181
1153
|
"detect": "\\bdisplacement(Map|Scale|Bias)\\b"
|
|
1182
1154
|
},
|
|
@@ -1185,8 +1157,7 @@
|
|
|
1185
1157
|
"category": "Materials",
|
|
1186
1158
|
"three": "material.alphaMap",
|
|
1187
1159
|
"status": "manual",
|
|
1188
|
-
"
|
|
1189
|
-
"target": "Alpha packed into the base color map's alpha channel offline, or a surface function that sets s.alpha from the texture (0.2)",
|
|
1160
|
+
"target": "Alpha packed into the base color map's alpha channel offline, or a surface function that sets s.alpha from the texture",
|
|
1190
1161
|
"notes": "three.js reads the alpha map from its green channel. Copy that channel into the base color map's alpha, and set alphaMode to 'mask' or 'blend'.",
|
|
1191
1162
|
"docs": "api/materials",
|
|
1192
1163
|
"detect": "\\balphaMap\\b"
|
|
@@ -1196,9 +1167,9 @@
|
|
|
1196
1167
|
"category": "Materials",
|
|
1197
1168
|
"three": "renderer.clippingPlanes / material.clippingPlanes / localClippingEnabled",
|
|
1198
1169
|
"status": "manual",
|
|
1199
|
-
"since": "0.1",
|
|
1200
1170
|
"target": "A surface function with alphaMode 'mask' that sets alpha to 0 beyond the plane, using input.worldPosition",
|
|
1201
|
-
"notes": "Pass the plane as a vec4f uniform.
|
|
1171
|
+
"notes": "Pass the plane as a `vec4f` uniform. The shadow is cut at the plane too, as three.js does with `clipShadows: true`. A masked material's shadow caster runs the alpha that its surface function sets.",
|
|
1172
|
+
"details": "three.js's default is `clipShadows: false`, which keeps the whole shadow. For that, also declare `fn coverage(input: SurfaceInput) -> f32` and return 1.0. The shadow caster then tests the coverage in place of the alpha.",
|
|
1202
1173
|
"docs": "shaders/surface-functions",
|
|
1203
1174
|
"detect": "clippingPlanes|localClippingEnabled|clipIntersection"
|
|
1204
1175
|
},
|
|
@@ -1207,20 +1178,29 @@
|
|
|
1207
1178
|
"category": "Materials",
|
|
1208
1179
|
"three": "material.polygonOffset / polygonOffsetFactor / polygonOffsetUnits",
|
|
1209
1180
|
"status": "direct",
|
|
1210
|
-
"since": "0.1",
|
|
1211
1181
|
"target": "depthBias: { constant, slopeScale } in the material options",
|
|
1212
|
-
"notes": "Signs differ because WebGPU uses reversed depth: the engine converts, so keep the three.js intent (push away from the camera).",
|
|
1182
|
+
"notes": "depthBias.constant takes polygonOffsetUnits, and depthBias.slopeScale takes polygonOffsetFactor. Signs differ because WebGPU uses reversed depth: the engine converts, so keep the three.js intent (push away from the camera).",
|
|
1213
1183
|
"docs": "api/materials",
|
|
1214
1184
|
"detect": "polygonOffset(Factor|Units)?\\b"
|
|
1215
1185
|
},
|
|
1186
|
+
{
|
|
1187
|
+
"id": "light-map",
|
|
1188
|
+
"category": "Materials",
|
|
1189
|
+
"three": "material.lightMap / lightMapIntensity, with the light map texture's offset and repeat",
|
|
1190
|
+
"status": "changed",
|
|
1191
|
+
"target": "materials.standard({ lightMap, lightMapIntensity, lightMapOffset, lightMapRepeat })",
|
|
1192
|
+
"notes": "The light map adds baked light to the ambient light, times `lightMapIntensity`. The texture's offset and repeat become `lightMapOffset` and `lightMapRepeat`, fixed when the material is created. The engine computes `uv × repeat + offset` for the light map alone, and the other maps keep their transform.",
|
|
1193
|
+
"details": "Load the map with `uvSet: 1` where three.js sets its channel to 1. A material with a clear coat, a sheen, iridescence or anisotropy takes no light map.",
|
|
1194
|
+
"docs": "api/materials",
|
|
1195
|
+
"detect": "\\blightMap(Intensity)?\\b"
|
|
1196
|
+
},
|
|
1216
1197
|
{
|
|
1217
1198
|
"id": "tone-mapped-flag",
|
|
1218
1199
|
"category": "Materials",
|
|
1219
1200
|
"three": "material.toneMapped = false",
|
|
1220
1201
|
"status": "changed",
|
|
1221
|
-
"since": "0.3",
|
|
1222
1202
|
"target": "toneMapped: false in the material's options, fixed when the material is created",
|
|
1223
|
-
"notes": "The material keeps its
|
|
1203
|
+
"notes": "The material keeps its display color on both paths. The 8-bit path handles it in the material's shader; the HDR path's final pass reads a mask. For the exact color on a blended surface, use the 8-bit path with `hdr: false`.",
|
|
1224
1204
|
"docs": "porting/threejs-postprocessing",
|
|
1225
1205
|
"detect": "\\btoneMapped\\s*[:=]\\s*false"
|
|
1226
1206
|
},
|
|
@@ -1229,7 +1209,6 @@
|
|
|
1229
1209
|
"category": "Textures",
|
|
1230
1210
|
"three": "new TextureLoader().load / loadAsync",
|
|
1231
1211
|
"status": "changed",
|
|
1232
|
-
"since": "0.1",
|
|
1233
1212
|
"target": "await assets.loadTexture(url, { colorSpace, flipY, wrap, filter, mipmaps, anisotropy, uvSet, premultipliedAlpha })",
|
|
1234
1213
|
"notes": "It returns a promise of the texture, which draws once its texels upload. flipY is true by default, as in three.js, and colorSpace is 'srgb'.",
|
|
1235
1214
|
"docs": "api/textures",
|
|
@@ -1240,9 +1219,9 @@
|
|
|
1240
1219
|
"category": "Textures",
|
|
1241
1220
|
"three": "texture.colorSpace = SRGBColorSpace (older: encoding = sRGBEncoding)",
|
|
1242
1221
|
"status": "direct",
|
|
1243
|
-
"since": "0.1",
|
|
1244
1222
|
"target": "colorSpace: 'srgb' for color maps, 'linear' for data maps",
|
|
1245
|
-
"notes": "Same rule as three.js: base color and emissive maps are sRGB; normal, roughness, metalness and AO maps are linear. The default is 'srgb' for images and 'linear' for data. glTF models
|
|
1223
|
+
"notes": "Same rule as three.js: base color and emissive maps are sRGB; normal, roughness, metalness and AO maps are linear. The default is `'srgb'` for images and `'linear'` for data. glTF models set them automatically.",
|
|
1224
|
+
"details": "`NoColorSpace` and `LinearSRGBColorSpace` become `colorSpace: 'linear'`.",
|
|
1246
1225
|
"docs": "concepts/color-management",
|
|
1247
1226
|
"detect": "\\.colorSpace\\s*=|\\b(Linear)?SRGBColorSpace\\b|sRGBEncoding"
|
|
1248
1227
|
},
|
|
@@ -1251,9 +1230,8 @@
|
|
|
1251
1230
|
"category": "Textures",
|
|
1252
1231
|
"three": "texture.flipY",
|
|
1253
1232
|
"status": "direct",
|
|
1254
|
-
"since": "0.1",
|
|
1255
1233
|
"target": "flipY in the loadTexture options",
|
|
1256
|
-
"notes": "The default is true, as in three.js. A KTX2 file takes no flipY: true, so encode it flipped. glTF textures
|
|
1234
|
+
"notes": "The default is true, as in three.js. A KTX2 file takes no flipY: true, so encode it flipped. glTF textures never flip.",
|
|
1257
1235
|
"docs": "api/textures",
|
|
1258
1236
|
"detect": "\\.flipY\\s*="
|
|
1259
1237
|
},
|
|
@@ -1262,9 +1240,9 @@
|
|
|
1262
1240
|
"category": "Textures",
|
|
1263
1241
|
"three": "wrapS / wrapT / repeat / offset / rotation / center",
|
|
1264
1242
|
"status": "changed",
|
|
1265
|
-
"since": "0.1",
|
|
1266
1243
|
"target": "wrap: 'repeat' | 'clamp' | 'mirror' in the texture options; repeat, offset and rotation go in the material's uvTransform",
|
|
1267
|
-
"notes": "uvTransform takes three.js's repeat, offset and rotation with the default center, and places every map of the material with it. mapUvTransforms gives one map, by its option name such as emissiveMap
|
|
1244
|
+
"notes": "`uvTransform` takes three.js's repeat, offset and rotation with the default center, and places every map of the material with it. `mapUvTransforms` gives one map, by its option name such as `emissiveMap`, a transform of its own. A glTF file's transforms stay per map.",
|
|
1245
|
+
"details": "The default wrap is `'clamp'`, as three.js's default is `ClampToEdgeWrapping`.",
|
|
1268
1246
|
"docs": "api/textures",
|
|
1269
1247
|
"detect": "\\.(wrapS|wrapT)\\s*=|\\.repeat\\.set\\s*\\(|\\.offset\\.set\\s*\\(|\\b(Repeat|ClampToEdge|MirroredRepeat)Wrapping\\b"
|
|
1270
1248
|
},
|
|
@@ -1273,7 +1251,6 @@
|
|
|
1273
1251
|
"category": "Textures",
|
|
1274
1252
|
"three": "minFilter / magFilter / generateMipmaps / anisotropy",
|
|
1275
1253
|
"status": "changed",
|
|
1276
|
-
"since": "0.1",
|
|
1277
1254
|
"target": "filter: 'linear' | 'nearest', mipmaps, anisotropy (capped by the preset)",
|
|
1278
1255
|
"notes": "",
|
|
1279
1256
|
"docs": "api/textures",
|
|
@@ -1284,9 +1261,9 @@
|
|
|
1284
1261
|
"category": "Textures",
|
|
1285
1262
|
"three": "DataTexture / DataArrayTexture / Data3DTexture",
|
|
1286
1263
|
"status": "changed",
|
|
1287
|
-
"since": "0.1",
|
|
1288
1264
|
"target": "textures.fromData({ width, height, depth, format, data })",
|
|
1289
|
-
"notes": "
|
|
1265
|
+
"notes": "`textures.fromData` takes `rgba8unorm` and `rgba16float` data. A depth above 1 makes a texture array, and the standard materials read its first layer. Filters are linear by default, where three.js's `DataTexture` is nearest: pass `filter: 'nearest'`.",
|
|
1266
|
+
"details": "A custom material declares an array as `var name: texture_2d_array<f32>` and samples a layer with `textureSample(name, nameSampler, uv, layer)`. `rgba16float` takes a `Uint16Array` of half floats or a `Float32Array`.\n\nA `Data3DTexture` made as a color grading table for `LUTPass` becomes `assets.lutFromData({ size, data })`. Data textures have no mip levels unless `mipmaps` is true, as `DataTexture`'s `generateMipmaps` is false.",
|
|
1290
1267
|
"docs": "api/textures",
|
|
1291
1268
|
"detect": "\\bData(Array|3D)?Texture\\b"
|
|
1292
1269
|
},
|
|
@@ -1295,9 +1272,9 @@
|
|
|
1295
1272
|
"category": "Textures",
|
|
1296
1273
|
"three": "CanvasTexture (a 2D canvas redrawn at run time)",
|
|
1297
1274
|
"status": "changed",
|
|
1298
|
-
"since": "0.2",
|
|
1299
1275
|
"target": "Draw on an OffscreenCanvas in the sketch, then textures.fromCanvas(canvas, { refreshHz }) and texture.refresh(rect)",
|
|
1300
|
-
"notes": "The sketch worker has no DOM canvas; OffscreenCanvas with a 2D context works in workers. The canvas's last row goes to v = 0
|
|
1276
|
+
"notes": "The sketch worker has no DOM canvas; `OffscreenCanvas` with a 2D context works in workers. The canvas's last row goes to `v = 0`, so it stands upright on a plane, as three.js shows a `CanvasTexture`. `refresh` uploads only the rectangle, where three.js's `needsUpdate` uploads the whole canvas.",
|
|
1277
|
+
"details": "Ask for the 2D context with `willReadFrequently: true`, so the browser keeps the pixels where the engine reads them.",
|
|
1301
1278
|
"docs": "api/textures",
|
|
1302
1279
|
"detect": "\\bCanvasTexture\\b"
|
|
1303
1280
|
},
|
|
@@ -1306,9 +1283,9 @@
|
|
|
1306
1283
|
"category": "Textures",
|
|
1307
1284
|
"three": "VideoTexture",
|
|
1308
1285
|
"status": "changed",
|
|
1309
|
-
"since": "0.3",
|
|
1310
1286
|
"target": "engine.registerVideo(video, { name }) on the page, then textures.fromVideo(name) in the sketch",
|
|
1311
|
-
"notes": "A video element lives on the page, where it plays with its own controls and sound
|
|
1287
|
+
"notes": "A video element lives on the page, where it plays with its own controls and sound. The page sends each presented frame, scaled down to `maxSize`, and the sketch uploads the newest one within the frame's budget. A paused video presents no frame, so it costs nothing.",
|
|
1288
|
+
"details": "The sketch's call then sends the frame that the video holds. Keep a frame within the upload budget, 2 MiB on Low: 512 texels of a 16:9 video is 576 KiB. Safari and Firefox cannot make a `VideoFrame` from a video element. So every browser reads frames through `createImageBitmap`.",
|
|
1312
1289
|
"docs": "guides/video-textures",
|
|
1313
1290
|
"detect": "\\bVideoTexture\\b"
|
|
1314
1291
|
},
|
|
@@ -1317,9 +1294,9 @@
|
|
|
1317
1294
|
"category": "Textures",
|
|
1318
1295
|
"three": "CubeTextureLoader / CubeTexture",
|
|
1319
1296
|
"status": "changed",
|
|
1320
|
-
"since": "0.2",
|
|
1321
1297
|
"target": "assets.loadCubemap([px, nx, py, ny, pz, nz]) for sky boxes with scene.setBackground; assets.loadEnvironment for lighting",
|
|
1322
|
-
"notes": "The faces come in three.js's order and draw as three.js draws a CubeTexture background, mirrored across x. Each face is square, of one size, at most 2,048 pixels a side. A cube map does not light materials and does not blur
|
|
1298
|
+
"notes": "The faces come in three.js's order and draw as three.js draws a `CubeTexture` background, mirrored across x. Each face is square, of one size, at most 2,048 pixels a side. A cube map does not light materials and does not blur.",
|
|
1299
|
+
"details": "For `envMap` or a blurred background, load an environment from an HDR or EXR image with `assets.loadEnvironment`.",
|
|
1323
1300
|
"docs": "api/assets",
|
|
1324
1301
|
"detect": "\\bCubeTexture(Loader)?\\b"
|
|
1325
1302
|
},
|
|
@@ -1328,9 +1305,9 @@
|
|
|
1328
1305
|
"category": "Textures",
|
|
1329
1306
|
"three": "RGBELoader / EXRLoader / HDRLoader / UltraHDRLoader + PMREMGenerator",
|
|
1330
1307
|
"status": "changed",
|
|
1331
|
-
"since": "0.2",
|
|
1332
1308
|
"target": "await assets.loadEnvironment('sunset.hdr'), or `bunx @null3d/cli assets env sunset.hdr sunset.ktx2` and assets.loadEnvironment('sunset.ktx2')",
|
|
1333
|
-
"notes": "One call loads a Radiance (.hdr) or OpenEXR (.exr) file and prefilters it on the GPU, as HDRLoader or EXRLoader with PMREMGenerator.fromEquirectangular do. No loader object and no generator to dispose. The tool's file skips the filtering at load.
|
|
1309
|
+
"notes": "One call loads a Radiance (.hdr) or OpenEXR (.exr) file and prefilters it on the GPU, as `HDRLoader` or `EXRLoader` with `PMREMGenerator.fromEquirectangular` do. No loader object and no generator to dispose. The tool's file skips the filtering at load.",
|
|
1310
|
+
"details": "`UltraHDRLoader`'s JPEG files with gain maps do not load: convert them to .hdr or .exr. EXR files with DWAA or DWAB compression, tiled or multi-part EXR files, do not load either.",
|
|
1334
1311
|
"docs": "api/assets",
|
|
1335
1312
|
"detect": "\\b(RGBE|EXR|HDR|UltraHDR)Loader\\b|\\bPMREMGenerator\\b"
|
|
1336
1313
|
},
|
|
@@ -1339,9 +1316,9 @@
|
|
|
1339
1316
|
"category": "Textures",
|
|
1340
1317
|
"three": "KTX2Loader + setTranscoderPath + detectSupport",
|
|
1341
1318
|
"status": "direct",
|
|
1342
|
-
"since": "0.1",
|
|
1343
1319
|
"target": "assets.loadTexture('x.ktx2')",
|
|
1344
|
-
"notes": "
|
|
1320
|
+
"notes": "The engine loads the transcoder with the first KTX2 file and picks the device's format, so delete the setup. The file's first row is at `v = 0`, as with `KTX2Loader`. UASTC HDR files load too: as BC6H where the device has BC formats, else as `rgb9e5ufloat`.",
|
|
1321
|
+
"details": "three.js uses ASTC HDR or half floats there. Both stay linear, so keep tone mapping on. The engine keeps each transcoded texture in its cache of derived data, so a repeat visit skips the transcoder. `KTX2Loader` transcodes on every visit.",
|
|
1345
1322
|
"docs": "api/textures",
|
|
1346
1323
|
"detect": "\\bKTX2Loader\\b|setTranscoderPath|\\.detectSupport\\s*\\("
|
|
1347
1324
|
},
|
|
@@ -1350,7 +1327,6 @@
|
|
|
1350
1327
|
"category": "Textures",
|
|
1351
1328
|
"three": "CompressedTexture / CompressedArrayTexture",
|
|
1352
1329
|
"status": "changed",
|
|
1353
|
-
"since": "0.1",
|
|
1354
1330
|
"target": "assets.loadTexture('x.ktx2'); texture.format names the compressed format",
|
|
1355
1331
|
"notes": "Compressed textures come from KTX2 files of ETC1S or UASTC data, with the file's mip levels. No call takes compressed blocks from code.",
|
|
1356
1332
|
"docs": "api/textures",
|
|
@@ -1361,9 +1337,8 @@
|
|
|
1361
1337
|
"category": "Textures",
|
|
1362
1338
|
"three": "texture.channel (which UV set a map uses)",
|
|
1363
1339
|
"status": "direct",
|
|
1364
|
-
"since": "0.1",
|
|
1365
1340
|
"target": "uvSet: 0 or 1 in the texture's options",
|
|
1366
|
-
"notes": "Each map of a material reads the set that its texture names. glTF models
|
|
1341
|
+
"notes": "Each map of a material reads the set that its texture names. glTF models carry this per texture, so loaded models need nothing.",
|
|
1367
1342
|
"docs": "api/textures",
|
|
1368
1343
|
"detect": "\\.channel\\s*="
|
|
1369
1344
|
},
|
|
@@ -1372,9 +1347,9 @@
|
|
|
1372
1347
|
"category": "Textures",
|
|
1373
1348
|
"three": "material.premultipliedAlpha / texture.premultiplyAlpha",
|
|
1374
1349
|
"status": "changed",
|
|
1375
|
-
"since": "0.1",
|
|
1376
1350
|
"target": "loadTexture(url, { premultipliedAlpha: true }), which multiplies each color by its alpha as the image decodes",
|
|
1377
|
-
"notes": "Blending needs no material flag: the engine blends premultiplied colors. On a blended material, a base color map loaded with premultipliedAlpha: true looks the same as
|
|
1351
|
+
"notes": "Blending needs no material flag: the engine blends premultiplied colors. On a blended material, a base color map loaded with `premultipliedAlpha: true` looks the same as one loaded without it. The shader divides its colors by their alpha before it lights them.",
|
|
1352
|
+
"details": "Other materials show the multiplied colors, as three.js does.",
|
|
1378
1353
|
"docs": "api/textures",
|
|
1379
1354
|
"detect": "premultipl(ied|y)Alpha\\b"
|
|
1380
1355
|
},
|
|
@@ -1383,9 +1358,9 @@
|
|
|
1383
1358
|
"category": "Loaders",
|
|
1384
1359
|
"three": "GLTFLoader().load / loadAsync",
|
|
1385
1360
|
"status": "changed",
|
|
1386
|
-
"since": "0.2",
|
|
1387
1361
|
"target": "const prefab = await assets.loadGltf(url); scene.instantiate(prefab)",
|
|
1388
|
-
"notes": "A worker parses the file. Named nodes
|
|
1362
|
+
"notes": "A worker parses the file, and `scene.instantiate(prefab)` makes a copy. Named nodes come from `prefab.find(name)`, a copy's objects from `instance.find(name)`, and its maps from `prefab.find(name).maps`. KTX2, WebP, AVIF and meshopt need no decoder setup.",
|
|
1363
|
+
"details": "`prefab.bounds` frames the model. Clips play through the copy's animator: `scene.instantiate(prefab).animator().play(name)`, with the names in `prefab.clips`. Joints are not objects. Morph targets draw, and clips animate their weights.\n\nMaterials follow `GLTFLoader`'s rules. Vertex colors turn on, a mesh without normals shades flat, and blended materials write no depth. A mesh without tangents turns the normal map's green channel over. `KHR_lights_punctual` lights load with the intensities that three.js gives them. A clip without a name is named `animation_0`, `animation_1` and so on, as three.js names it.\n\n`KHR_animation_pointer` needs no plugin: the loader reads it. It moves the same texture transform values as three.js's plugin. `assets.registerGltfExtension(handler)` takes the place of `GLTFLoader.register()` for an add-on's extensions. `GLTFLoader` ignores the MSFT_lod levels of `bunx @null3d/cli assets optimize --lod` and draws the full mesh.",
|
|
1389
1364
|
"docs": "api/assets",
|
|
1390
1365
|
"detect": "\\bGLTFLoader\\b"
|
|
1391
1366
|
},
|
|
@@ -1394,7 +1369,6 @@
|
|
|
1394
1369
|
"category": "Loaders",
|
|
1395
1370
|
"three": "LoadingManager.setURLModifier",
|
|
1396
1371
|
"status": "changed",
|
|
1397
|
-
"since": "0.2",
|
|
1398
1372
|
"target": "assets.loadGltf(url, { rewriteUrl: (address) => address })",
|
|
1399
1373
|
"notes": "Checks or changes each address that a glTF file names, for its buffers and images. Return null to refuse the file with E1416. It covers glTF files only.",
|
|
1400
1374
|
"docs": "api/assets",
|
|
@@ -1405,7 +1379,6 @@
|
|
|
1405
1379
|
"category": "Loaders",
|
|
1406
1380
|
"three": "DRACOLoader + setDecoderPath",
|
|
1407
1381
|
"status": "direct",
|
|
1408
|
-
"since": "0.2",
|
|
1409
1382
|
"target": "Built in: assets.loadGltf(url) decodes Draco data",
|
|
1410
1383
|
"notes": "Delete the setup and the decoder files. The engine ships Draco's glTF decoder and downloads it, about 60 KB after Brotli, with the first Draco file. Convert the files to meshopt with `bunx @null3d/cli assets optimize`: meshopt files decode faster, with a decoder of about 6 KB.",
|
|
1411
1384
|
"docs": "concepts/assets",
|
|
@@ -1416,7 +1389,6 @@
|
|
|
1416
1389
|
"category": "Loaders",
|
|
1417
1390
|
"three": "MeshoptDecoder / setMeshoptDecoder",
|
|
1418
1391
|
"status": "direct",
|
|
1419
|
-
"since": "0.2",
|
|
1420
1392
|
"target": "Built in: assets.loadGltf(url) decodes meshopt data",
|
|
1421
1393
|
"notes": "Delete the setup. The loader reads KHR_meshopt_compression and EXT_meshopt_compression, and downloads the decoder with the first compressed file.",
|
|
1422
1394
|
"docs": "concepts/assets",
|
|
@@ -1427,9 +1399,9 @@
|
|
|
1427
1399
|
"category": "Loaders",
|
|
1428
1400
|
"three": "FBXLoader / OBJLoader / MTLLoader / ColladaLoader / STLLoader / PLYLoader / 3DMLoader / USDZLoader",
|
|
1429
1401
|
"status": "changed",
|
|
1430
|
-
"since": "0.2",
|
|
1431
1402
|
"target": "Convert to glTF before release: `bunx @null3d/cli assets convert model.fbx model.glb` for FBX, OBJ with MTL, STL and PLY; Blender for Collada, 3DM and USDZ",
|
|
1432
1403
|
"notes": "The engine loads glTF only. The command keeps FBX skins, blend shapes and clips, turns materials into metal-rough ones, and puts units in meters with Y up. Bump maps become normal maps.",
|
|
1404
|
+
"details": "The command is `bunx @null3d/cli assets convert model.fbx model.glb` for FBX, OBJ with MTL, STL and PLY; Blender handles Collada, 3DM and USDZ. The engine draws no glTF points, so a converted PLY point cloud loads with nothing to draw. three.js draws it.",
|
|
1433
1405
|
"docs": "guides/assets-pipeline",
|
|
1434
1406
|
"detect": "\\b(FBX|OBJ|MTL|Collada|STL|PLY|3DM|USDZ|TDS|VRML|VTK|Rhino3dm)Loader\\b"
|
|
1435
1407
|
},
|
|
@@ -1438,9 +1410,8 @@
|
|
|
1438
1410
|
"category": "Loaders",
|
|
1439
1411
|
"three": "LoadingManager / onProgress callbacks",
|
|
1440
1412
|
"status": "changed",
|
|
1441
|
-
"since": "0.1",
|
|
1442
1413
|
"target": "assets.onProgress((loaded, total) => ...) and assets.preload([...urls])",
|
|
1443
|
-
"notes": "loaded and total count bytes, not files
|
|
1414
|
+
"notes": "`loaded` and `total` count bytes, not files. A download that announces no length still adds its bytes to `loaded`, while `total` stays unknown. Divide by `Math.max(total, loaded)`.",
|
|
1444
1415
|
"docs": "guides/loading-screens",
|
|
1445
1416
|
"detect": "\\bLoadingManager\\b"
|
|
1446
1417
|
},
|
|
@@ -1449,9 +1420,8 @@
|
|
|
1449
1420
|
"category": "Loaders",
|
|
1450
1421
|
"three": "FileLoader / ImageLoader / ImageBitmapLoader",
|
|
1451
1422
|
"status": "changed",
|
|
1452
|
-
"since": "0.1",
|
|
1453
1423
|
"target": "assets.loadBinary(url), assets.loadJson(url), assets.loadImageBitmap(url)",
|
|
1454
|
-
"notes": "",
|
|
1424
|
+
"notes": "ImageBitmapLoader's texture becomes textures.fromImageBitmap, which puts the bitmap's first row at v = 0. assets.loadImageBitmap flips the rows by default, as createImageBitmap does with imageOrientation: 'flipY', so the texture stands upright, as three.js's TextureLoader shows it.",
|
|
1455
1425
|
"docs": "api/assets",
|
|
1456
1426
|
"detect": "\\b(File|Image|ImageBitmap)Loader\\b"
|
|
1457
1427
|
},
|
|
@@ -1460,9 +1430,8 @@
|
|
|
1460
1430
|
"category": "Loaders",
|
|
1461
1431
|
"three": "THREE.Cache.enabled",
|
|
1462
1432
|
"status": "changed",
|
|
1463
|
-
"since": "0.1",
|
|
1464
1433
|
"target": "Nothing to do",
|
|
1465
|
-
"notes": "Loads of one URL at the same time share one download
|
|
1434
|
+
"notes": "Loads of one URL at the same time share one download. Files that `assets.preload` downloaded wait in memory until a load takes them. The HTTP cache keeps the rest.",
|
|
1466
1435
|
"docs": "api/assets",
|
|
1467
1436
|
"detect": "\\bCache\\.enabled\\b"
|
|
1468
1437
|
},
|
|
@@ -1471,9 +1440,9 @@
|
|
|
1471
1440
|
"category": "Instancing and batching",
|
|
1472
1441
|
"three": "InstancedMesh + setMatrixAt / setColorAt / instanceMatrix.needsUpdate",
|
|
1473
1442
|
"status": "changed",
|
|
1474
|
-
"since": "0.1",
|
|
1475
1443
|
"target": "scene.createInstances(mesh, count, { material, dynamic, colors }); write batch.positions / rotations / scales / colors",
|
|
1476
|
-
"notes": "Static batches call markDirty(start, count) after writes; dynamic batches upload every frame without it. colors: true adds the colors array: linear RGBA per row, which multiplies the base color and opacity
|
|
1444
|
+
"notes": "Static batches call `markDirty(start, count)` after writes; dynamic batches upload every frame without it. `colors: true` adds the colors array: linear RGBA per row, which multiplies the base color and opacity. `scene.createInstances(prefab, count)` instances a glTF model, with one set of rows for all its meshes.",
|
|
1445
|
+
"details": "`setColorAt`'s color works the same as a row color. `castShadow` and `receiveShadow` become `castShadows` and `receiveShadows`, or `batch.setCastShadows` and `setReceiveShadows`. An `InstancedMesh`'s `boundingSphere` becomes `batch.setBoundingRadius(radius)` for that batch. Each row's sphere then holds that radius around the row's origin.",
|
|
1477
1446
|
"docs": "concepts/instances",
|
|
1478
1447
|
"detect": "\\bInstancedMesh\\b|\\.set(Matrix|Color)At\\s*\\(|\\binstance(Matrix|Color)\\b"
|
|
1479
1448
|
},
|
|
@@ -1482,7 +1451,6 @@
|
|
|
1482
1451
|
"category": "Instancing and batching",
|
|
1483
1452
|
"three": "BatchedMesh",
|
|
1484
1453
|
"status": "changed",
|
|
1485
|
-
"since": "0.1",
|
|
1486
1454
|
"target": "Nothing special: the engine batches objects that share a mesh and material",
|
|
1487
1455
|
"notes": "Use createInstances for many copies of one mesh, and separate meshes for varied geometry.",
|
|
1488
1456
|
"docs": "concepts/instances",
|
|
@@ -1493,7 +1461,6 @@
|
|
|
1493
1461
|
"category": "Instancing and batching",
|
|
1494
1462
|
"three": "InstancedBufferGeometry / InstancedBufferAttribute (custom per-instance data)",
|
|
1495
1463
|
"status": "changed",
|
|
1496
|
-
"since": "0.2",
|
|
1497
1464
|
"target": "createInstances(mesh, count, { material, values: true }) adds batch.values, four floats per row, which a custom material's vertexOffset and surface functions read as object.values",
|
|
1498
1465
|
"notes": "Four floats per row replace named attributes: pack a phase, an age, a tint or a size into them. A shader that read an instanced attribute reads object.values.x to .w instead. A material with a vertexOffset casts shadows that follow it.",
|
|
1499
1466
|
"docs": "concepts/instances",
|
|
@@ -1504,31 +1471,30 @@
|
|
|
1504
1471
|
"category": "Instancing and batching",
|
|
1505
1472
|
"three": "A BufferGeometry with no attributes, drawn from a vertex count in a ShaderMaterial (gl_VertexID and gl_InstanceID)",
|
|
1506
1473
|
"status": "changed",
|
|
1507
|
-
"since": "0.2",
|
|
1508
1474
|
"target": "scene.createVertexDraw({ shader, vertices, instances, bounds, ...material options })",
|
|
1509
|
-
"notes": "The shader makes every vertex from
|
|
1475
|
+
"notes": "The shader makes every vertex from `@builtin(vertex_index)` and `@builtin(instance_index)`, so a frame uploads nothing. three.js needs a geometry with a placeholder attribute and an `InstancedBufferGeometry` for the instance count. A draw blends, sorts as one object, takes no texture, casts no shadow, and a raycast does not hit its shapes.",
|
|
1510
1476
|
"docs": "api/vertex-draws",
|
|
1511
1477
|
"detect": "\\bgl_VertexID\\b|\\bgl_InstanceID\\b|\\binstanceCount\\s*="
|
|
1512
1478
|
},
|
|
1513
1479
|
{
|
|
1514
1480
|
"id": "lod",
|
|
1515
1481
|
"category": "Instancing and batching",
|
|
1516
|
-
"three": "LOD (addLevel)",
|
|
1482
|
+
"three": "LOD (addLevel) / SimplifyModifier",
|
|
1517
1483
|
"status": "changed",
|
|
1518
|
-
"since": "0.2",
|
|
1519
1484
|
"target": "Nothing for a mesh made in code of 4,096 triangles or more, or of 256 or more whose copies hold 65,536: it plans its levels on the job workers at its first draw, and `await mesh.buildLevels()` plans another; or baseMesh.setLevels([{ mesh, distance }]) on the base mesh, then draw the base mesh; or levels from `bunx @null3d/cli assets optimize --lod`, which assets.loadGltf reads",
|
|
1520
|
-
"notes": "Levels belong to the mesh, and
|
|
1485
|
+
"notes": "Levels belong to the mesh, and each object and instance row picks its own level each frame. It measures to the nearest point of an object's bounds, where three.js measures to its position, so a large object switches later. `getCurrentLevel` and `autoUpdate` have no match.",
|
|
1486
|
+
"details": "A mesh made in code plans measured levels with the asset tool's planner, as three.js's `SimplifyModifier` would make far copies by hand. They switch at once while the threshold stays small. `levels: false` in its arrays opts out.\n\nEach object and row picks its level on the GPU or on job workers, by the level's error, distance or screen coverage. A distance holds on every screen height, and so does a coverage. A hand-set level fades over a dithered band, which replaces hysteresis. A level with a measured error switches at once while the threshold stays small, and fades above about one and a half pixels. A mesh whose bound covers fewer pixels than the threshold draws nothing.\n\nEach shadow map picks a caster's level in its own texels, so the level holds while the camera moves. A level may name a material of its own, so a far level shades more cheaply.\n\n`object.setLevelBias(bias)` moves one object's threshold, as the inverse of Godot's `lod_bias`: a Godot bias of 2 is about a null3D bias of 0.5. Above 1 it draws coarser levels, and below 1 it keeps more detail. `object.setDrawRange(start, end)` draws a mesh only inside a band of distances, and fades it at each edge.\n\nFar copies can also draw as impostor cards or as one merged mesh per far cell, from `@null3d/impostors`. The cards blend the three nearest stored views and light from the normals the bake stores. So a moving sun relights them with the meshes.\n\nA large static mesh can also take a tree of cluster patches from `bunx @null3d/cli assets optimize --clusters`. The engine then draws fine patches near the camera and coarse ones far from it. It does so on both GPU paths where the browser draws many ranges in one call, and whole levels elsewhere. three.js has no equivalent, and its LOD picks one level for the whole object.",
|
|
1521
1487
|
"docs": "concepts/lod",
|
|
1522
|
-
"detect": "new\\s+(THREE\\.)?LOD\\s*\\(|\\.addLevel\\s*\\("
|
|
1488
|
+
"detect": "new\\s+(THREE\\.)?LOD\\s*\\(|\\.addLevel\\s*\\(|\\bSimplifyModifier\\b"
|
|
1523
1489
|
},
|
|
1524
1490
|
{
|
|
1525
1491
|
"id": "mixer",
|
|
1526
1492
|
"category": "Animation",
|
|
1527
1493
|
"three": "AnimationMixer / clipAction / play / crossFadeTo / fadeIn / fadeOut / time / setEffectiveWeight / timeScale / mixer.update(dt)",
|
|
1528
1494
|
"status": "changed",
|
|
1529
|
-
"since": "0.2",
|
|
1530
1495
|
"target": "const anim = obj.animator(); anim.play('run', { fade: 0.2, loop: true, speed: 1 }); anim.crossFade('walk', 0.3); anim.play('walk', { time: 0.4, weight: 0.7 }); anim.setWeight('walk', 0.5); anim.setLayerWeight(1, 0.5); anim.setTimeScale(0.5); anim.onEvent('finished', handler)",
|
|
1531
|
-
"notes": "No update call: the engine advances and blends every animator on its job workers. action.time = t before play() becomes play(name, { time: t })
|
|
1496
|
+
"notes": "No update call: the engine advances and blends every animator on its job workers. `action.time = t` before `play()` becomes `play(name, { time: t })`. `setLoop(LoopOnce)` becomes `loop: false`, which holds the last frame, as `clampWhenFinished` does; `startAt` has no counterpart.",
|
|
1497
|
+
"details": "`setEffectiveWeight(w)` on actions that play together becomes `play(name, { weight: w })`, then `setWeight(name, w)`. A play with a weight joins its layer's clips, and a play without one fades them out. `setWeight` leaves a running fade in place, which multiplies the weight. A fade out starts from the clip's current weight, not from full weight.\n\n`fadeOut(duration)` becomes `stop(name, { fade: duration })`. A clip with a negative speed starts at its end. Filtered clips for upper and lower body become layers with `setLayerMask`. Walk and run blends become `playBlend` and `setBlend`, which keep the clips in step. This covers blends whose weights and time scales the code works out from a speed.\n\n`crossFadeTo` and `crossFadeFrom` map to `crossFade`, which keeps the weighted blend that three.js shows. It never uses an inertial transition, which samples only the new clip. `startAt` has no direct call: call `play` at that time. `mixer.addEventListener('loop' or 'finished')` becomes `anim.onEvent('loop' or 'finished', handler)`, which also gets the events in the clip's data. Handlers run at the start of the next frame, before `onUpdate`. So code sees what the clips reached in the frame before, as after `mixer.update`.\n\nA clip blends only where it has tracks, as in three.js. Poses, fades, masked layers, additive clips and blends match three.js's within 0.0004. A clip whose keys follow no single grid is stored at 30 keys per second. Its fastest joints can then cut corners by up to 0.005.",
|
|
1532
1498
|
"docs": "api/animation",
|
|
1533
1499
|
"detect": "\\bAnimationMixer\\b|\\.clipAction\\s*\\(|\\.crossFade(To|From)\\s*\\(|\\.fade(In|Out)\\s*\\(|setEffectiveWeight|\\bmixer\\.update\\s*\\("
|
|
1534
1500
|
},
|
|
@@ -1538,7 +1504,8 @@
|
|
|
1538
1504
|
"three": "AnimationClip / KeyframeTrack built in code",
|
|
1539
1505
|
"status": "changed",
|
|
1540
1506
|
"target": "const pulse = scene.animateProperty(lamp, 'light.intensity', { times: [0, 1, 2], values: [0, 5, 0], loop: true }); const recolor = scene.animateProperty(material, 'color', { times: [0, 1], values: [1, 0, 0, 0, 0, 1] })",
|
|
1541
|
-
"notes": "A track names a value of a light, a camera, a material or an object
|
|
1507
|
+
"notes": "A track names a value of a light, a camera, a material or an object. Keys hold one number, two for a map's offset or scale, three for a color, position or scale, and four for a rotation. glTF files play their `KHR_animation_pointer` tracks through the model's animator.",
|
|
1508
|
+
"details": "The values include `'light.intensity'`, `'light.color'`, `'camera.fov'`, a material value that `setUniform` takes, `'material.uvOffset'` or `'material.uvScale'`, and `'position'`, `'rotation'`, `'scale'` and `'visible'`.\n\nInterpolation is `'linear'`, `'step'` or glTF's cubic spline (`'cubic'`). A cubic key holds an in-tangent, the value and an out-tangent. `animation.setTime(t)` places the animation. `setSpeed`, `setPaused`, `setLoop` and `stop` control it. A material animation changes every object that uses the material.\n\nThe glTF tracks carry the clip's time, speed, fades and weights. They cover a light's intensity, color and range, a material's values, and the offset and scale of a base color or emissive texture's transform. They also cover a node's visibility, and a node's transform or morph weights.\n\nA material keeps a transform for each of its maps, so a file that moves two of them apart plays both. Each plays on its own map. A pointer the engine does not read leaves its value as the file has it, with a warning in development builds. three.js needs a plugin for the extension.",
|
|
1542
1509
|
"docs": "api/animation",
|
|
1543
1510
|
"detect": "\\bAnimationClip\\b|\\b\\w+KeyframeTrack\\b"
|
|
1544
1511
|
},
|
|
@@ -1547,9 +1514,9 @@
|
|
|
1547
1514
|
"category": "Animation",
|
|
1548
1515
|
"three": "SkinnedMesh / Skeleton / Bone built by hand",
|
|
1549
1516
|
"status": "manual",
|
|
1550
|
-
"since": "0.2",
|
|
1551
1517
|
"target": "Author the skeleton in a modeling tool and export glTF: const hero = scene.instantiate(await assets.loadGltf(url)); hero.animator().play('walk')",
|
|
1552
1518
|
"notes": "Building skeletons in code is not supported, and joints are not objects. Meshes that hang on bones, such as a sword in a hand, follow their joints when the file puts them under the bone. To turn a joint from code, use the animator's joint calls (see the bone rotation entry).",
|
|
1519
|
+
"details": "The mesh's own world matrix places the skinned vertices, as three.js draws a `SkinnedMesh`. Each pass skins the mesh in its vertex shader, as three.js does, custom materials included.",
|
|
1553
1520
|
"docs": "api/animation",
|
|
1554
1521
|
"detect": "\\bSkinnedMesh\\b|new\\s+(THREE\\.)?(Skeleton|Bone)\\s*\\("
|
|
1555
1522
|
},
|
|
@@ -1558,9 +1525,9 @@
|
|
|
1558
1525
|
"category": "Animation",
|
|
1559
1526
|
"three": "bone.quaternion / bone.rotation set after mixer.update(dt); bone.lookAt(target); skeleton.getBoneByName",
|
|
1560
1527
|
"status": "changed",
|
|
1561
|
-
"since": "0.2",
|
|
1562
1528
|
"target": "const head = anim.joint('Head'); anim.setJointRotation(head, q, weight); anim.addJointRotation(head, q, weight); anim.lookAt(target, { joints: ['Spine', 'Neck', 'Head'], limit }, weight)",
|
|
1563
|
-
"notes": "Setting bone.quaternion after the mixer's update becomes setJointRotation
|
|
1529
|
+
"notes": "Setting `bone.quaternion` after the mixer's update becomes `setJointRotation`, and multiplying it becomes `addJointRotation`, which turns the joint in its own frame. Turn a `bone.rotation` Euler into a quaternion with `quat.fromEuler` first. Both take a weight from 0 to 1 that blends with the animated rotation.",
|
|
1530
|
+
"details": "A rotation holds in every frame until `clearJoint`, where three.js's mixer overwrites the bone in its next update. `bone.lookAt` becomes `lookAt`, which turns a chain of up to 4 joints toward a point in the world. Each turns within its limit, and it aims again every frame until `lookAt(null)`. The joints below follow, so a held rifle aims with the arms.",
|
|
1564
1531
|
"docs": "api/animation",
|
|
1565
1532
|
"detect": "\\bgetBoneByName\\s*\\(|\\b\\w*(bone|Bone|head|Head|spine|Spine|neck|Neck)\\.(quaternion|rotation)\\.(copy|set|multiply|premultiply|slerp|setFromEuler|setFromAxisAngle)\\s*\\("
|
|
1566
1533
|
},
|
|
@@ -1569,7 +1536,6 @@
|
|
|
1569
1536
|
"category": "Animation",
|
|
1570
1537
|
"three": "AnimationUtils.subclip / makeClipAdditive",
|
|
1571
1538
|
"status": "changed",
|
|
1572
|
-
"since": "0.2",
|
|
1573
1539
|
"target": "anim.play(name, { additive: true }) for makeClipAdditive. Split clips for subclip in the modeling tool",
|
|
1574
1540
|
"notes": "An additive play adds the clip's change from its first frame, as makeClipAdditive does with its default reference frame. The engine makes the additive form once, at the first additive play.",
|
|
1575
1541
|
"docs": "api/animation",
|
|
@@ -1580,9 +1546,9 @@
|
|
|
1580
1546
|
"category": "Interaction and controls",
|
|
1581
1547
|
"three": "Raycaster.setFromCamera + intersectObject(s)",
|
|
1582
1548
|
"status": "changed",
|
|
1583
|
-
"since": "0.2",
|
|
1584
1549
|
"target": "camera.screenToRay(x, y, ray); scene.raycast(ray.origin, ray.direction, { layers }, hit)",
|
|
1585
|
-
"notes": "scene.raycast writes the closest hit into a hit object that you create once, and scene.raycastAll writes every hit, nearest first
|
|
1550
|
+
"notes": "`scene.raycast` writes the closest hit into a hit object that you create once, and `scene.raycastAll` writes every hit, nearest first. A layer mask defaults to layer 0 alone, as `Raycaster`'s does, and hidden objects are never hit. A skinned mesh is tested in its bind pose, not its animated pose.",
|
|
1551
|
+
"details": "A hit has `object`, `instance` (`instanceId`), `point`, `normal`, `distance` and `triangle` (`faceIndex`). It also has `uv` (`intersection.uv`) with `hasUv`, which says whether the hit triangle has texture coordinates. `camera.screenToRay` uses the camera of the frame on screen at the pointer's event. For clicks and hover on objects, `obj.on('click', fn)` casts the ray itself. Acceleration structures are built in. Rays hit sprites, points and lines as they draw.\n\n`raycaster.far` becomes `maxDistance`. `params.Points.threshold` and `params.Line.threshold` become the `pointThreshold` and `lineThreshold` options. three.js gives both a default of 1 world unit, and null3D none. Without them, a ray hits a point's square, or a line within half its width. A hit near a line, or near a point within a threshold, is the ray's closest point. three.js puts a `Line`'s hit on the line instead.\n\nTriangles hit as their material draws them, front faces only or both with `doubleSided: true`, as `Raycaster` reads `material.side`. A ray hits a dashed line's gaps, and a sprite or point where its map is clear, as in three.js. `scene.pick(x, y)` tests the pixel that the image shows, through the GPU, and returns a promise. three.js has no pixel pick.\n\nSprites, points and lines sized in pixels use the active camera, or the camera of the event's frame, in place of `raycaster.camera`. three.js's `Line2` and `LineSegments2` ignore `raycaster.far`; `maxDistance` limits every null3D hit, lines too.",
|
|
1586
1552
|
"docs": "api/raycast",
|
|
1587
1553
|
"detect": "\\bRaycaster\\b|\\.setFromCamera\\s*\\(|\\.intersectObjects?\\s*\\("
|
|
1588
1554
|
},
|
|
@@ -1591,31 +1557,41 @@
|
|
|
1591
1557
|
"category": "Interaction and controls",
|
|
1592
1558
|
"three": "DOM pointer, mouse, touch and keyboard listeners",
|
|
1593
1559
|
"status": "changed",
|
|
1594
|
-
"
|
|
1595
|
-
"
|
|
1596
|
-
"
|
|
1560
|
+
"target": "input.pointer, input.isDown('KeyW'), input.wasPressed('Mouse0'), input.touches, input.actions.define(); obj.on('click' | 'pointerdown' | 'pointerup' | 'pointermove' | 'pointerenter' | 'pointerleave', fn)",
|
|
1561
|
+
"notes": "The page forwards pointer, touch, keyboard and gamepad input to the sketch, which reads it once per frame and adds no DOM listeners. Keys take `KeyboardEvent.code` names, and the main mouse button or a tap is `Mouse0`. A canvas that takes touch gestures needs `touch-action: none` in its CSS.",
|
|
1562
|
+
"details": "`obj.on` replaces a canvas listener that raycasts: the closest object under the pointer gets the event, then its parents. `input.pointer.wheel` gives the scroll in pixels, counting a line as 16 pixels and a page as 100, as three.js's controls count `deltaMode`.",
|
|
1597
1563
|
"docs": "api/input",
|
|
1598
1564
|
"detect": "addEventListener\\s*\\(\\s*['\"](pointer\\w*|mouse\\w*|click|dblclick|touch\\w*|keydown|keyup|wheel|contextmenu)['\"]"
|
|
1599
1565
|
},
|
|
1600
1566
|
{
|
|
1601
1567
|
"id": "orbit-controls",
|
|
1602
1568
|
"category": "Interaction and controls",
|
|
1603
|
-
"three": "OrbitControls / MapControls
|
|
1569
|
+
"three": "OrbitControls / MapControls",
|
|
1604
1570
|
"status": "changed",
|
|
1605
|
-
"since": "0.1",
|
|
1606
1571
|
"target": "createOrbitControls(ctx, camera, { target, enableDamping, dampingFactor, minDistance, maxDistance, maxPolarAngle }) or createMapControls(ctx, camera) from @null3d/controls; controls.update(dt) in onUpdate",
|
|
1607
|
-
"notes": "Option names and defaults match OrbitControls and MapControls
|
|
1572
|
+
"notes": "Option names and defaults match `OrbitControls` and `MapControls`, and the same input gives the camera the same pose. `mouseButtons` and `touches` take strings such as `'rotate'` and `'dolly-pan'`. There is no DOM element, so `connect`, `disconnect` and `dispose` have no equivalent.",
|
|
1573
|
+
"details": "`listenToKeyEvents()` takes no element: it turns on the keys, which the sketch's `input` already reads. There are no change, start or end events: `update(dt)` returns true when the camera moved.\n\n`zoomToCursor`, `keys`, `keyPanSpeed`, `keyRotateSpeed`, `cursor`, `minTargetRadius`, `maxTargetRadius`, `saveState` and `reset` keep three.js's names and behavior. A held key repeats after half a second, then 30 times a second, where three.js follows the system's key repeat. An orthographic camera zooms by its view height, and `minZoom` and `maxZoom` count zoom as three.js does from the height when the controls start. `getDistance`, `getPolarAngle` and `getAzimuthalAngle` keep three.js's meaning. `rotateLeft`, `rotateUp`, `pan`, `dollyIn` and `dollyOut` take effect at the next update, not at once.\n\n`dampingFactor` is the share at 60 frames per second. The engine scales it to each frame's step, so the motion takes the same time at any frame rate. The controls orbit around +Y, where three.js orbits around the camera's up. three.js takes a frame's events one at a time, so a two-finger pan can differ by a few percent of the move.",
|
|
1608
1574
|
"docs": "api/controls",
|
|
1609
|
-
"detect": "\\b(Orbit|Map
|
|
1575
|
+
"detect": "\\b(Orbit|Map)Controls\\b"
|
|
1576
|
+
},
|
|
1577
|
+
{
|
|
1578
|
+
"id": "trackball-controls",
|
|
1579
|
+
"category": "Interaction and controls",
|
|
1580
|
+
"three": "TrackballControls / ArcballControls",
|
|
1581
|
+
"status": "unsupported",
|
|
1582
|
+
"target": "None; createOrbitControls, or your own rotation from ctx.input",
|
|
1583
|
+
"notes": "null3D has orbit and map controls. It has no trackball or arcball rotation.",
|
|
1584
|
+
"docs": "porting/threejs-unsupported",
|
|
1585
|
+
"detect": "\\b(Trackball|Arcball)Controls\\b"
|
|
1610
1586
|
},
|
|
1611
1587
|
{
|
|
1612
1588
|
"id": "fly-controls",
|
|
1613
1589
|
"category": "Interaction and controls",
|
|
1614
1590
|
"three": "FlyControls / FirstPersonControls / PointerLockControls",
|
|
1615
1591
|
"status": "changed",
|
|
1616
|
-
"since": "0.2",
|
|
1617
1592
|
"target": "createFlyControls(ctx, camera, { movementSpeed, rollSpeed, dragToLook, autoForward }) or createFirstPersonControls(ctx, camera, { movementSpeed, lookSpeed, pointerSpeed, minPolarAngle, maxPolarAngle }) from @null3d/controls; controls.update(dt) in onUpdate",
|
|
1618
|
-
"notes": "Option names and defaults match FlyControls
|
|
1593
|
+
"notes": "Option names and defaults match `FlyControls`, `FirstPersonControls` and `PointerLockControls`. First-person controls take the place of the last two: while the canvas holds the pointer lock, the mouse turns the view as `PointerLockControls` turn it. `lock()`, `unlock()` and `isLocked` have no equivalent.",
|
|
1594
|
+
"details": "The page asks for the lock in a click handler with `engine.requestPointerLock()`, and the sketch reads `input.pointer.locked`. For code that moves the camera itself, set `movementSpeed: 0` and call `controls.moveForward` and `controls.moveRight`. There is no DOM element, dispose or change event: `update(dt)` returns true when the camera moved.\n\nIn fly controls, the keys add to the pointer's turn, where three.js's pointer replaces the arrow keys' turn. First-person controls turn the camera with no roll, where `PointerLockControls` keep a roll the camera had. With the pointer locked, a frame's mouse moves add up before the polar limits apply.\n\nthree.js applies the limits after each move, so a frame can end at a different angle. With two fingers down, the first finger turns the view, where three.js follows the finger that touched down last. `dampingFactor` is the share at 60 frames per second, scaled to each frame's step.",
|
|
1619
1595
|
"docs": "api/controls",
|
|
1620
1596
|
"detect": "\\b(Fly|FirstPerson|PointerLock)Controls\\b"
|
|
1621
1597
|
},
|
|
@@ -1624,9 +1600,9 @@
|
|
|
1624
1600
|
"category": "Interaction and controls",
|
|
1625
1601
|
"three": "TransformControls / DragControls",
|
|
1626
1602
|
"status": "changed",
|
|
1627
|
-
"since": "0.3",
|
|
1628
1603
|
"target": "createTransformControls(ctx, camera, { mode, space, size, showX, showY, showZ, translationSnap, rotationSnap, scaleSnap }) from @null3d/controls, then attach(object) and controls.update(dt) in onUpdate; createDragControls(ctx, camera, objects, { recursive, transformGroup, rotateSpeed, mouseButtons, touches })",
|
|
1629
|
-
"notes": "Option names and defaults match TransformControls and DragControls
|
|
1604
|
+
"notes": "Option names and defaults match `TransformControls` and `DragControls`. There is no DOM element, `getHelper` or event: the controls make their handles in the scene and report `dragging`, `axis`, `hovered` and `state`. `update(dt)` returns true when it moved something.",
|
|
1605
|
+
"details": "A gizmo turns an object by the exact angle that the pointer sweeps around the axis, where three.js scales a linear approximation of it. `minX` to `maxZ` clamp a move, and `showXY`, `showYZ` and `showXZ` hide the plane handles, as in three.js. `showX`, `showY` and `showZ` hide the plane handles too. A press on a handle reaches the handle alone, so a click handler on the object behind it does not hear it.\n\n`dragging` and `axis` replace `TransformControls`' dragging-changed, objectChange, mouseDown and mouseUp events. `dragging`, `hovered` and `state` replace `DragControls`' dragstart, drag, dragend, hoveron and hoveroff events.",
|
|
1630
1606
|
"docs": "api/controls",
|
|
1631
1607
|
"detect": "\\b(Transform|Drag)Controls\\b"
|
|
1632
1608
|
},
|
|
@@ -1635,20 +1611,31 @@
|
|
|
1635
1611
|
"category": "Helpers and debugging",
|
|
1636
1612
|
"three": "AxesHelper / GridHelper / BoxHelper / Box3Helper / ArrowHelper / CameraHelper / light helpers / SkeletonHelper / PlaneHelper",
|
|
1637
1613
|
"status": "changed",
|
|
1638
|
-
"since": "0.1",
|
|
1639
1614
|
"target": "debug.axes, debug.grid, debug.box, debug.sphere, debug.arrow, debug.frustum, debug.light, debug.skeleton",
|
|
1640
|
-
"notes": "Call them in onUpdate
|
|
1615
|
+
"notes": "Call them in `onUpdate`: each call draws for one frame, and debug drawing exists in development builds only. `debug.grid` takes `GridHelper`'s size and divisions, and its `color` and `centerColor` default to `GridHelper`'s `color2` and `color1`. `PlaneHelper` and `PolarGridHelper` have no equivalent.",
|
|
1616
|
+
"details": "`debug.frustum` draws orange by default, as `CameraHelper` draws a frustum. `debug.box` takes a box's lowest and highest corners. `debug.light` draws directional lights only. `debug.skeleton` draws an animated object's skin joints, blue at the joint and green at its parent, as `SkeletonHelper` does.",
|
|
1641
1617
|
"docs": "api/debug",
|
|
1642
1618
|
"detect": "\\b(Axes|Grid|PolarGrid|Box|Box3|Arrow|Camera|DirectionalLight|PointLight|SpotLight|HemisphereLight|Skeleton|Plane)Helper\\b"
|
|
1643
1619
|
},
|
|
1620
|
+
{
|
|
1621
|
+
"id": "inspector",
|
|
1622
|
+
"category": "Helpers and debugging",
|
|
1623
|
+
"three": "three.js's Inspector add-on or developer tools extension, or code that walks scene.children to find an object while debugging",
|
|
1624
|
+
"status": "changed",
|
|
1625
|
+
"target": "?inspect on the page in a development build; engine.inspect(call, args) from page code; bunx @null3d/cli mcp for a coding agent",
|
|
1626
|
+
"notes": "The `?inspect` panel lists the scene as a tree and outlines the object that you select. It shows and changes the object's transform, and a mesh's base color, roughness, metalness and opacity. A change lasts until the page reloads, so copy the final values into the sketch.",
|
|
1627
|
+
"details": "`engine.inspect` runs the same calls from code, and the page answers capture itself with `{ png, bytes }`. The MCP server gives a coding agent the same calls, frame captures and the frame figures. All three work in a development build only, because a production build leaves the channel out. A held page or a replay opens no panel.",
|
|
1628
|
+
"docs": "guides/debugging",
|
|
1629
|
+
"detect": "__THREE_DEVTOOLS__|from\\s+['\"][^'\"]*/inspector/Inspector(\\.js)?['\"]"
|
|
1630
|
+
},
|
|
1644
1631
|
{
|
|
1645
1632
|
"id": "math-objects",
|
|
1646
1633
|
"category": "Math",
|
|
1647
1634
|
"three": "new Vector3 / Quaternion / Matrix4 / Euler / Color / Box3 / Sphere / Ray / Plane",
|
|
1648
1635
|
"status": "changed",
|
|
1649
|
-
"since": "0.1",
|
|
1650
1636
|
"target": "Plain arrays and the vec3, quat, mat4 and color helpers from @null3d/engine, such as vec3.add(out, a, b) and quat.slerp(out, a, b, t)",
|
|
1651
|
-
"notes": "Create scratch arrays once with vec3.create()
|
|
1637
|
+
"notes": "Create scratch arrays once with `vec3.create()`, `quat.create()` or `mat4.create()`, outside `onUpdate`. Most names match three.js, and each helper does three.js's arithmetic, so the results match. Coordinates are right-handed with +Y up, as in three.js.",
|
|
1638
|
+
"details": "A `mat4` holds its 16 numbers column by column, as `Matrix4.elements` does, with the translation in elements 12, 13 and 14. `multiplyMatrices(a, b)` is `mat4.multiply(out, a, b)`, and `multiplyQuaternions(a, b)` is `quat.multiply(out, a, b)`. Both apply b first, then a. `setFromRotationMatrix(m)` is `quat.fromMat4(out, m)`, which needs a matrix without scale. Use `mat4.decompose` for one with scale.\n\n`applyQuaternion` is `vec3.transformQuat`, `applyMatrix4` is `vec3.transformMat4`, `multiplyScalar` is `vec3.scale`, and `addScaledVector` is `vec3.scaleAndAdd`. `setFromUnitVectors` is `quat.rotationTo`, and `setFromEuler` is `quat.fromEuler`, in radians. There are no helpers for `Box3`, `Sphere`, `Ray` or `Plane`.\n\nthree.js math classes may stay in setup code during a port, but not in per-frame code. Game rules that a server replays import the exact helpers from `@null3d/engine/math/vec3`, `quat`, `mat4` and `math`. They build `setAxisAngle`, `fromEuler`, `rotateX`, `rotateY`, `rotateZ`, `slerp`, `vec3.angle` and `math.damp` with `createMath` on an exact math library.",
|
|
1652
1639
|
"docs": "api/math",
|
|
1653
1640
|
"detect": "new\\s+(THREE\\.)?(Vector[234]|Quaternion|Matrix[34]|Euler|Color|Box[23]|Sphere|Ray|Plane|Frustum|Spherical|Cylindrical)\\s*\\("
|
|
1654
1641
|
},
|
|
@@ -1657,7 +1644,6 @@
|
|
|
1657
1644
|
"category": "Math",
|
|
1658
1645
|
"three": "Clock / getDelta / getElapsedTime",
|
|
1659
1646
|
"status": "changed",
|
|
1660
|
-
"since": "0.1",
|
|
1661
1647
|
"target": "onUpdate(dt) or ctx.time.dt, and ctx.time.now",
|
|
1662
1648
|
"notes": "getDelta() becomes the dt that onUpdate gets, also in ctx.time.dt, and getElapsedTime() becomes ctx.time.now. Sketch time stops while the engine is paused or the page is hidden. A fixed-step simulation, such as world.step(1 / 60), moves to onFixedUpdate.",
|
|
1663
1649
|
"docs": "api/time",
|
|
@@ -1668,9 +1654,9 @@
|
|
|
1668
1654
|
"category": "Math",
|
|
1669
1655
|
"three": "MathUtils (degToRad, clamp, lerp, damp, randFloat, seededRandom)",
|
|
1670
1656
|
"status": "direct",
|
|
1671
|
-
"since": "0.1",
|
|
1672
1657
|
"target": "math.degToRad, radToDeg, clamp, lerp, inverseLerp, mapLinear, damp, smoothstep, euclideanModulo, randFloat, randInt and randFloatSpread; math.seed and math.random",
|
|
1673
|
-
"notes": "Same names and arithmetic
|
|
1658
|
+
"notes": "Same names and arithmetic, and the random helpers draw from `math.random`, which hold mode seeds. `MathUtils.seededRandom(s)` becomes `math.seed(s)` once, then `math.random()`. `smootherstep`, `pingpong` and `generateUUID` have no equivalent.",
|
|
1659
|
+
"details": "Game rules that a server replays import `clamp`, `lerp` and the other exact helpers from `@null3d/engine/math/math`. They build `damp` with `createMath` on an exact math library, and draw random numbers from a generator of their own.",
|
|
1674
1660
|
"docs": "api/math",
|
|
1675
1661
|
"detect": "\\bMathUtils\\.\\w+"
|
|
1676
1662
|
},
|
|
@@ -1679,9 +1665,9 @@
|
|
|
1679
1665
|
"category": "Math",
|
|
1680
1666
|
"three": "Color.set / setHex / setHSL / setRGB / lerp",
|
|
1681
1667
|
"status": "changed",
|
|
1682
|
-
"since": "0.1",
|
|
1683
1668
|
"target": "'#rrggbb' or '#rgb' strings, 0xrrggbb numbers, or [r, g, b] linear arrays from 0 to 1; color.fromHex, color.fromSrgb and color.fromHsl give linear RGB",
|
|
1684
|
-
"notes": "Hex values are sRGB, as setHex and setStyle read them, and the engine converts them to linear. [r, g, b] arrays are linear, as setRGB reads them, so the color helpers' results go straight into color options and instance colors. color.fromSrgb converts sRGB components, color.fromHsl gives what setHSL gives, and vec3.lerp blends two colors.",
|
|
1669
|
+
"notes": "Hex values are sRGB, as `setHex` and `setStyle` read them, and the engine converts them to linear. `[r, g, b]` arrays are linear, as `setRGB` reads them, so the color helpers' results go straight into color options and instance colors. `color.fromSrgb` converts sRGB components, `color.fromHsl` gives what `setHSL` gives, and `vec3.lerp` blends two colors.",
|
|
1670
|
+
"details": "`color.srgbToLinear` and `color.linearToSrgb` convert one component by the same curve as `SRGBToLinear` and `LinearToSRGB`.",
|
|
1685
1671
|
"docs": "concepts/color-management",
|
|
1686
1672
|
"detect": "\\.set(Hex|HSL|RGB|Style)\\s*\\("
|
|
1687
1673
|
},
|
|
@@ -1690,7 +1676,6 @@
|
|
|
1690
1676
|
"category": "Post-processing",
|
|
1691
1677
|
"three": "EffectComposer / RenderPass / OutputPass / PostProcessing (three/webgpu) / pmndrs postprocessing",
|
|
1692
1678
|
"status": "changed",
|
|
1693
|
-
"since": "0.2",
|
|
1694
1679
|
"target": "post.set({ ... })",
|
|
1695
1680
|
"notes": "The chain is built in and merged into few passes. Delete the composer, RenderPass and OutputPass; keep only each pass's settings.",
|
|
1696
1681
|
"docs": "concepts/post-processing",
|
|
@@ -1701,9 +1686,9 @@
|
|
|
1701
1686
|
"category": "Post-processing",
|
|
1702
1687
|
"three": "UnrealBloomPass / BloomEffect / bloom() node",
|
|
1703
1688
|
"status": "changed",
|
|
1704
|
-
"since": "0.2",
|
|
1705
1689
|
"target": "post.set({ bloom: { intensity, threshold, knee, blend, weights } })",
|
|
1706
|
-
"notes": "null3D draws bloom through a chain of mip levels
|
|
1690
|
+
"notes": "null3D draws bloom through a chain of mip levels, so the settings map rather than copy. `UnrealBloomPass` uses `blend: 'add'`, the same threshold, knee 0.01, and intensity about 8.8 times strength. Take weights from radius with the port skill's table, or its `map-bloom.mjs` script for the app's canvas size.",
|
|
1691
|
+
"details": "The `bloom()` node is the same at a third of the intensity. pmndrs `BloomEffect` uses `blend: 'screen'`, intensity as is, `threshold` from `luminanceThreshold` and `knee` from `luminanceSmoothing`. Its weights come from radius and levels. Drop the resolution argument.\n\nThe match holds at one canvas size, 1080 pixels on the shorter side by default. three.js's glow spans pixels, so on a larger screen null3D's looks wider. A strong bloom also spreads a little wider at the frame's edges than three.js's. three.js's faint haze fades toward the corners; lower strength or radius to soften it. In WebGPU's compatibility mode with MSAA, bloom moves the engine to HDR color with FXAA.",
|
|
1707
1692
|
"docs": "concepts/post-processing",
|
|
1708
1693
|
"detect": "\\bUnrealBloomPass\\b|\\bBloomEffect\\b|\\bbloom\\s*\\("
|
|
1709
1694
|
},
|
|
@@ -1712,9 +1697,9 @@
|
|
|
1712
1697
|
"category": "Post-processing",
|
|
1713
1698
|
"three": "SSAOPass / SAOPass / GTAOPass / N8AO",
|
|
1714
1699
|
"status": "changed",
|
|
1715
|
-
"since": "0.2",
|
|
1716
1700
|
"target": "post.set({ ao: { radius, thickness, distanceExponent, distanceFalloff, scale, samples, intensity } })",
|
|
1717
|
-
"notes": "GTAOPass's search and denoise at half resolution, with its setting names
|
|
1701
|
+
"notes": "`GTAOPass`'s search and denoise draw at half resolution, with its setting names. `blendIntensity` becomes `intensity`, and `distanceFallOff` is spelled `distanceFalloff`. It darkens only the ambient light, where `GTAOPass` darkens the whole image.",
|
|
1702
|
+
"details": "It draws where the quality setting `aoScale` is above 0: on High and Ultra, or after `quality.set({ aoScale: 0.5 })` on phones and tablets. For `SSAOPass`, `SAOPass` and `N8AO`, start from the defaults and tune `radius` and `scale` by eye.\n\nIn the engine's parity tests with `GTAOPass`'s defaults, under 0.1% of the pixels differ from three.js's image on every GPU path. With a wider, darker search, under 1% differ, along the soft edges. A scene that only ambient light lights gives the same image in both.",
|
|
1718
1703
|
"docs": "concepts/post-processing",
|
|
1719
1704
|
"detect": "\\b(SSAO|SAO|GTAO|N8AO)(Pass|PostPass)?\\b"
|
|
1720
1705
|
},
|
|
@@ -1723,7 +1708,6 @@
|
|
|
1723
1708
|
"category": "Post-processing",
|
|
1724
1709
|
"three": "SSGINode / ssgi() (bounce light from the screen) / VXGINode",
|
|
1725
1710
|
"status": "changed",
|
|
1726
|
-
"since": "0.2",
|
|
1727
1711
|
"target": "A light probe grid for bounce light (scene.setLightProbeGrid), with ambient occlusion (post.set({ ao }))",
|
|
1728
1712
|
"notes": "null3D has no bounce light from the screen and no voxel cone tracing. The probe grid gives colored bounce light everywhere, from objects off the screen too, at a fixed cost per pixel. Light from moving objects reaches it only when the sketch bakes it again.",
|
|
1729
1713
|
"docs": "api/scene",
|
|
@@ -1734,9 +1718,9 @@
|
|
|
1734
1718
|
"category": "Post-processing",
|
|
1735
1719
|
"three": "FXAAPass / FXAAShader / SMAAPass / TAARenderPass / SSAARenderPass",
|
|
1736
1720
|
"status": "changed",
|
|
1737
|
-
"since": "0.1",
|
|
1738
1721
|
"target": "createEngine({ antialias: 'fxaa' }); the quality presets take MSAA 4x from Medium, and FXAA on Low",
|
|
1739
|
-
"notes": "FXAA runs inside the final pass, where three.js adds FXAAPass after OutputPass
|
|
1722
|
+
"notes": "FXAA runs inside the final pass, where three.js adds `FXAAPass` after `OutputPass`. null3D has no TAA of a moving view. A still view blends jittered frames into a sharper picture, then rests, so TAA and SSAA passes have no counterpart.",
|
|
1723
|
+
"details": "SMAA 1x smooths the moment transparency layer's edges under the share that its moments cover. The rest of the image keeps MSAA's samples or FXAA. `sampleLevel` has no counterpart. The motion debug view reads the motion vectors that the engine records for each object.",
|
|
1740
1724
|
"docs": "concepts/quality-presets",
|
|
1741
1725
|
"detect": "\\b(FXAA|SMAA|TAARender|SSAARender)Pass\\b|FXAAShader"
|
|
1742
1726
|
},
|
|
@@ -1745,9 +1729,8 @@
|
|
|
1745
1729
|
"category": "Post-processing",
|
|
1746
1730
|
"three": "TRAANode / traa() / TAAUNode / TemporalReprojectNode",
|
|
1747
1731
|
"status": "changed",
|
|
1748
|
-
"since": "0.1",
|
|
1749
1732
|
"target": "MSAA, which the quality presets take from Medium up, with FXAA on Low",
|
|
1750
|
-
"notes": "null3D has no temporal anti-aliasing and no temporal upscaler.
|
|
1733
|
+
"notes": "null3D has no temporal anti-aliasing and no temporal upscaler. Drop the node and keep the scene's MSAA, which `TAAUNode` had to turn off. For speed on phones, the governor lowers the render scale, and the final pass scales the image up.",
|
|
1751
1734
|
"docs": "concepts/quality-presets",
|
|
1752
1735
|
"detect": "\\b(TRAA|TAAU|TemporalReproject)Node\\b|\\btraa\\s*\\("
|
|
1753
1736
|
},
|
|
@@ -1756,9 +1739,9 @@
|
|
|
1756
1739
|
"category": "Post-processing",
|
|
1757
1740
|
"three": "FSR1Node / fsr1() (spatial upscale and sharpening)",
|
|
1758
1741
|
"status": "changed",
|
|
1759
|
-
"since": "0.1",
|
|
1760
1742
|
"target": "The render scale: quality.set({ minRenderScale, maxRenderScale })",
|
|
1761
|
-
"notes": "The engine draws the scene below the canvas size when the render scale is under 1
|
|
1743
|
+
"notes": "The engine draws the scene below the canvas size when the render scale is under 1. Its final pass scales the image up with GSR 1, an edge-aware spatial upscaler, which fills FSR 1's role. It has no FSR 1 pass.",
|
|
1744
|
+
"details": "Sharpening is a setting of its own, `post.set({ sharpen })`, which draws at the whole canvas's render scale.",
|
|
1762
1745
|
"docs": "api/quality",
|
|
1763
1746
|
"detect": "\\bFSR1Node\\b|\\bfsr1\\s*\\("
|
|
1764
1747
|
},
|
|
@@ -1767,9 +1750,9 @@
|
|
|
1767
1750
|
"category": "Post-processing",
|
|
1768
1751
|
"three": "SharpenNode / sharpen() (RCAS)",
|
|
1769
1752
|
"status": "changed",
|
|
1770
|
-
"since": "0.2",
|
|
1771
1753
|
"target": "post.set({ sharpen })",
|
|
1772
|
-
"notes": "Both sharpen display color with FSR 1's RCAS in the final pass, so the port needs no render target and no pass of its own. three.js scales the sharpening by 2^-sharpness
|
|
1754
|
+
"notes": "Both sharpen display color with FSR 1's RCAS in the final pass, so the port needs no render target and no pass of its own. three.js scales the sharpening by `2^-sharpness`, where 0 sharpens the most and 2 does nothing. Set `sharpen` to that factor, so three.js's default of 0.2 is `sharpen: 0.87`.",
|
|
1755
|
+
"details": "null3D damps the sharpening where the ring around a pixel is noise, which three.js does only with `denoise: true`. It draws at the whole canvas's render scale; below one, the upscale sharpens the image itself.",
|
|
1773
1756
|
"docs": "api/post",
|
|
1774
1757
|
"detect": "\\bSharpenNode\\b|\\bsharpen\\s*\\("
|
|
1775
1758
|
},
|
|
@@ -1778,9 +1761,9 @@
|
|
|
1778
1761
|
"category": "Post-processing",
|
|
1779
1762
|
"three": "OutlinePass / OutlineEffect",
|
|
1780
1763
|
"status": "changed",
|
|
1781
|
-
"since": "0.2",
|
|
1782
1764
|
"target": "post.set({ outline: { color, hiddenColor, width } }) and mesh.setOutlined(true), or createOutlinePass(ctx, { color, hiddenColor, strength, thickness, glow, pulsePeriod }) from @null3d/three-compat",
|
|
1783
|
-
"notes": "selectedObjects becomes setOutlined(true) on each mesh, or on a model's copy from scene.instantiate
|
|
1765
|
+
"notes": "`selectedObjects` becomes `setOutlined(true)` on each mesh, or on a model's copy from `scene.instantiate`. null3D draws a crisp line of one width in CSS pixels, with no blur. `visibleEdgeColor` and `hiddenEdgeColor` become `color` and `hiddenColor`; the pattern texture has no setting.",
|
|
1766
|
+
"details": "`OutlinePass` draws its edge at half size, so `edgeThickness` t becomes `width` of about 2t. `OutlinePass` draws a dark brown line around hidden parts by default. null3D draws none until `hiddenColor` is set, so set `hiddenColor: [0.1, 0.04, 0.02]`, its linear default, to keep it.\n\npmndrs `OutlineEffect`: `xRay: false` becomes `hiddenColor: false`. Its edge is one texel of its mask at `resolutionScale`, so `width` is about `1 / resolutionScale`.\n\nFor `OutlinePass` itself, install `@null3d/three-compat` and call `createOutlinePass(ctx, { color, hiddenColor, strength, thickness, glow, pulsePeriod })`. `edgeStrength`, `edgeThickness` and `edgeGlow` keep their values as `strength`, `thickness` and `glow`, and `pulsePeriod` keeps its name. `visibleEdgeColor` and `hiddenEdgeColor` become `color` and `hiddenColor`. It draws the soft edge, the glow and the pulse, and it turns the crisp line off. The mask reads at half size, and `downSampleRatio` is fixed at 2. The core's crisp line stays the cheaper choice where a soft edge is not needed.\n\nOne outline style covers every outlined object in either form. For a soft glow built by hand, a full-screen pass reads the mask with `input: 'outlineMask'`, at scale 0.5. An effect then adds its texture to the scene color; `width: 0` drops the crisp line (guides/custom-passes, a soft outline glow).",
|
|
1784
1767
|
"docs": "porting/threejs-postprocessing",
|
|
1785
1768
|
"detect": "\\bOutline(Pass|Effect)\\b"
|
|
1786
1769
|
},
|
|
@@ -1789,9 +1772,9 @@
|
|
|
1789
1772
|
"category": "Post-processing",
|
|
1790
1773
|
"three": "BokehPass / DepthOfFieldEffect / dof() node",
|
|
1791
1774
|
"status": "changed",
|
|
1792
|
-
"since": "0.2",
|
|
1793
1775
|
"target": "post.set({ dof: { focusDistance, focusPoint, aperture, focalLength, maxBlur, blades } }), with camera.setFocalLength(mm)",
|
|
1794
|
-
"notes": "The same intent
|
|
1776
|
+
"notes": "The same intent uses a camera's lens: the blur grows with the distance from the focus, and the near and far fields blur apart. So a sharp object spreads no halo into a blurred background. `BokehPass`'s focus becomes `focusDistance`.",
|
|
1777
|
+
"details": "Its aperture scales the blur with the distance from the focus. null3D's aperture is an f-number, so pick one by eye, such as 2.8, with the camera's focal length (`camera.setFocalLength`). `maxblur` is a share of the canvas's width, and `maxBlur` of its height, so multiply by the aspect ratio.\n\npmndrs `DepthOfFieldEffect`: `worldFocusDistance` becomes `focusDistance`, a target to focus on becomes `focusPoint`, and `bokehScale` becomes `maxBlur` with the aperture. Tune it by eye. It draws where the quality setting `dofSamples` is above 0: Medium and up, or `quality.set({ dofSamples: 16 })` on Low.",
|
|
1795
1778
|
"docs": "concepts/post-processing",
|
|
1796
1779
|
"detect": "\\bBokehPass\\b|\\bDepthOfField(Effect)?\\b|\\bdof\\s*\\("
|
|
1797
1780
|
},
|
|
@@ -1800,9 +1783,9 @@
|
|
|
1800
1783
|
"category": "Post-processing",
|
|
1801
1784
|
"three": "None built in; pmndrs ToneMappingEffect with ToneMappingMode.REINHARD2_ADAPTIVE (adaptationRate, middleGrey), AdaptiveLuminancePass, AdaptiveToneMappingPass",
|
|
1802
1785
|
"status": "changed",
|
|
1803
|
-
"since": "0.2",
|
|
1804
1786
|
"target": "post.set({ autoExposure: { metering, percentiles, centerWeight, speedUp, speedDown, minEv, maxEv, compensation } })",
|
|
1805
|
-
"notes": "three.js has no automatic exposure; renderer.toneMappingExposure stays post.set({ exposure })
|
|
1787
|
+
"notes": "three.js has no automatic exposure; `renderer.toneMappingExposure` stays `post.set({ exposure })`, and the eye adapts from it. pmndrs's adaptive tone mapping becomes `autoExposure` with `metering: 'mean'`. Its `adaptationRate` becomes about `speedUp` and `speedDown`, and its `middleGrey` the compensation, `log2(middleGrey / 0.18)` stops.",
|
|
1788
|
+
"details": "Its Reinhard curve becomes a custom tone curve. The meter runs on the GPU in the same frame: a histogram on WebGPU, or 16 x 16 cells on WebGL2 and the Low preset. The quality setting is `exposureMeter`.\n\nIt weights the center and adapts at its own speeds for brighter and darker scenes. It stays within `minEv` and `maxEv`, in stops from the camera's exposure. Hold mode settles at once, so image tests stay the same. It needs HDR color, as bloom does.",
|
|
1806
1789
|
"docs": "api/post",
|
|
1807
1790
|
"detect": "\\bREINHARD2_ADAPTIVE\\b|\\bAdaptive(Luminance|ToneMapping)Pass\\b|\\badaptationRate\\b"
|
|
1808
1791
|
},
|
|
@@ -1811,31 +1794,40 @@
|
|
|
1811
1794
|
"category": "Post-processing",
|
|
1812
1795
|
"three": "ShaderPass (custom full-screen GLSL)",
|
|
1813
1796
|
"status": "manual",
|
|
1814
|
-
"since": "0.2",
|
|
1815
1797
|
"target": "post.addEffect({ wgsl, uniforms, textures, order }), or render.addPass({ kind: 'fullscreen', wgsl, writes, size or scale }) for a pass that writes a render target of its own",
|
|
1816
|
-
"notes": "Rewrite the fragment shader in WGSL as fn effect(input: EffectInput) -> vec4f
|
|
1798
|
+
"notes": "Rewrite the fragment shader in WGSL as `fn effect(input: EffectInput) -> vec4f`. `texture2D(tDiffuse, vUv)` becomes `effectColor(input.uv)`, and `pass.uniforms.x.value = v` becomes `post.setEffectUniform(effect, 'x', v)`. The engine joins effects that read only their own pixel into one pass.",
|
|
1799
|
+
"details": "Effects run on linear HDR color before the tone curve. A `ShaderPass` after `OutputPass` sees display color, so retune its numbers. The uv's y axis is flipped: replace `vUv.y` with `1.0 - input.uv.y` where direction matters. Other textures of the shader become `var name: texture_2d<f32>` with the `textures` option. Sample a render pass's texture at `effectPassUv(input.uv)`. A reflection pass's texture on the HDR WebGPU path starts at the top row instead: sample it at `input.uv`.\n\nA `ShaderPass` that writes a render target of its own, which a later pass reads, becomes a full-screen pass. Its input image goes as `input: 'sceneColor'`, or a texture. `effectViewPosition(uv)` gives the surface's view-space position, whose z is negative in front of the camera, as in three.js.",
|
|
1817
1800
|
"docs": "porting/threejs-postprocessing",
|
|
1818
1801
|
"detect": "\\bShaderPass\\b"
|
|
1819
1802
|
},
|
|
1820
1803
|
{
|
|
1821
1804
|
"id": "fx-passes",
|
|
1822
1805
|
"category": "Post-processing",
|
|
1823
|
-
"three": "FilmPass / GlitchPass / HalftonePass /
|
|
1806
|
+
"three": "FilmPass / GlitchPass / HalftonePass / DotScreenPass / RenderPixelatedPass",
|
|
1824
1807
|
"status": "manual",
|
|
1825
|
-
"since": "0.2",
|
|
1826
1808
|
"target": "A custom effect for each, with post.addEffect",
|
|
1827
|
-
"notes": "Port each shader as a ShaderPass is ported. Grain and noise sized for display color look weaker on HDR color, so tune them by eye. GlitchPass's random texture becomes a texture of the effect, from textures.fromData, or noise from null3d::noise.
|
|
1809
|
+
"notes": "Port each shader as a ShaderPass is ported. Grain and noise sized for display color look weaker on HDR color, so tune them by eye. GlitchPass's random texture becomes a texture of the effect, from textures.fromData, or noise from null3d::noise.",
|
|
1810
|
+
"docs": "porting/threejs-postprocessing",
|
|
1811
|
+
"detect": "\\b(Film|Glitch|Halftone|DotScreen|RenderPixelated|Bleach|Sobel)(Pass|Shader)\\b"
|
|
1812
|
+
},
|
|
1813
|
+
{
|
|
1814
|
+
"id": "afterimage-pass",
|
|
1815
|
+
"category": "Post-processing",
|
|
1816
|
+
"three": "AfterimagePass / AfterimageShader",
|
|
1817
|
+
"status": "unsupported",
|
|
1818
|
+
"target": "None",
|
|
1819
|
+
"notes": "AfterimagePass blends in the frame before, which an effect cannot read, so it has no port.",
|
|
1828
1820
|
"docs": "porting/threejs-postprocessing",
|
|
1829
|
-
"detect": "\\
|
|
1821
|
+
"detect": "\\bAfterimage(Pass|Shader)\\b"
|
|
1830
1822
|
},
|
|
1831
1823
|
{
|
|
1832
1824
|
"id": "lut",
|
|
1833
1825
|
"category": "Post-processing",
|
|
1834
1826
|
"three": "LUTPass / LUTCubeLoader / LUT3dlLoader",
|
|
1835
1827
|
"status": "direct",
|
|
1836
|
-
"since": "0.2",
|
|
1837
1828
|
"target": "post.set({ lut: await assets.loadLut('grade.cube'), lutIntensity }), or a table from assets.lutFromData({ size, data })",
|
|
1838
|
-
"notes": "LUTPass's intensity becomes lutIntensity
|
|
1829
|
+
"notes": "`LUTPass`'s intensity becomes `lutIntensity`. The table grades display color after the tone mapping, as `LUTPass` after `OutputPass` does. A `Data3DTexture` that code fills for `LUTPass` becomes `await assets.lutFromData({ size, data })`.",
|
|
1830
|
+
"details": "The order is the same, red fastest, with three or four numbers per texel, whose fourth is skipped. Give floats from 0 to 1, so divide 8-bit values by 255. `LUTImageLoader`'s PNG strips are not read: export the grade as a .cube file. Both read the table with a linear filter between its texel centers.\n\nThe engine maps the colors of a .cube file's domain onto the table, which `LUTPass` leaves out. A .3dl input grid whose points differ from even steps by one loads, where `LUT3dlLoader` refuses it. In the engine's parity test, a .cube table matches three.js's composer in all but under 0.1% of the pixels on every GPU path.",
|
|
1839
1831
|
"docs": "porting/threejs-postprocessing",
|
|
1840
1832
|
"detect": "\\bLUTPass\\b|\\bLUT(Cube|3dl|Image)Loader\\b"
|
|
1841
1833
|
},
|
|
@@ -1844,9 +1836,9 @@
|
|
|
1844
1836
|
"category": "Post-processing",
|
|
1845
1837
|
"three": "VignetteShader / VignetteEffect",
|
|
1846
1838
|
"status": "changed",
|
|
1847
|
-
"since": "0.2",
|
|
1848
1839
|
"target": "post.set({ vignette: { intensity, size, falloff, roundness } })",
|
|
1849
|
-
"notes": "null3D's vignette multiplies HDR color before the tone mapping, so bright corners darken instead of turning gray. VignetteShader's offset becomes size and darkness becomes intensity
|
|
1840
|
+
"notes": "null3D's vignette multiplies HDR color before the tone mapping, so bright corners darken instead of turning gray. `VignetteShader`'s offset becomes `size` and darkness becomes `intensity`. Under ACES, the default falloff of 2 and roundness of 0 give a close match.",
|
|
1841
|
+
"details": "Under AgX, intensity stays at 1 or less with a falloff of 3. With darkness below 1, three.js also lifts dark corners toward a gray, and null3D does not. The postprocessing library's `VignetteEffect` maps the same way with its ESKIL technique. Its default technique darkens with another curve, so tune intensity and size by eye.",
|
|
1850
1842
|
"docs": "porting/threejs-postprocessing",
|
|
1851
1843
|
"detect": "\\bVignette(Shader|Effect)\\b"
|
|
1852
1844
|
},
|
|
@@ -1855,9 +1847,9 @@
|
|
|
1855
1847
|
"category": "Post-processing",
|
|
1856
1848
|
"three": "SSRPass / ReflectorForSSRPass / ssr() node",
|
|
1857
1849
|
"status": "changed",
|
|
1858
|
-
"since": "0.2",
|
|
1859
1850
|
"target": "post.set({ ssr: { maxDistance, thickness, intensity } }) with quality.set({ ssrScale })",
|
|
1860
|
-
"notes": "
|
|
1851
|
+
"notes": "It reflects what the screen shows in smooth opaque surfaces, in place of the environment's reflection, through the material's Fresnel term. `SSRPass` adds its reflections over the finished image instead. `maxDistance` and `thickness` keep their names, `opacity` becomes `intensity`, and `selects` and `blur` have no settings.",
|
|
1852
|
+
"details": "The material's roughness picks the surfaces and blurs their reflections, up to `maxRoughness`. A `groundReflector` (`ReflectorForSSRPass`) becomes a reflection pass, which wins on its plane. The `ssr()` node's `resolutionScale` becomes the `ssrScale` quality setting, which is 0 on the Low preset of phones. Its quality becomes `ssrSteps`, the most steps of each ray. Where a ray hits nothing on the screen, the environment's reflection shows.",
|
|
1861
1853
|
"docs": "api/post",
|
|
1862
1854
|
"detect": "\\bSSRPass\\b|ReflectorForSSRPass"
|
|
1863
1855
|
},
|
|
@@ -1866,9 +1858,9 @@
|
|
|
1866
1858
|
"category": "Post-processing",
|
|
1867
1859
|
"three": "Reflector / Refractor / Water / Water2 (addons)",
|
|
1868
1860
|
"status": "changed",
|
|
1869
|
-
"since": "0.2",
|
|
1870
1861
|
"target": "const pass = render.addPass({ kind: 'reflection', writes: 'water', plane: { point, normal } }); materials.shader({ wgsl, textures: { mirror: textures.fromPass(pass) } }), whose surface function sets s.reflection from reflection_uv",
|
|
1871
|
-
"notes": "A reflection pass draws the camera's view mirrored across the plane,
|
|
1862
|
+
"notes": "A reflection pass draws the camera's view mirrored across the plane, and an oblique near plane clips everything below it. The mesh no longer carries the reflection. A custom material reads the pass texture by screen position with `null3d::reflection::reflection_uv`, then sets the surface's reflection.",
|
|
1863
|
+
"details": "The texture's rows start at the top on the HDR WebGPU path, and `reflection_uv` turns the lookup there. `Reflector`'s `textureWidth` and `textureHeight` become `scale`, a share of the render size. Its color becomes the material's color with metalness 1 and roughness 0.\n\n`Water`'s `distortionScale` becomes the factor on the normal's tilt in `reflection_uv`'s offset. `waterColor` becomes the material's color, and `sunColor` the scene's sun. `Water`'s normal map becomes ripples in the surface function. The reflection draws the scene's background, the sun's light and shadows, and the point and spot lights that it sees.\n\nFor a river or a lake, `createWater` from `@null3d/water` does this work. It adds the soft shore, the foam, the caustics and the view from under the water. A reflection pass stays the way to mirror a floor. For an open sea, `createOcean` from `@null3d/water` transforms wave spectra into the surface's heights and slopes on the GPU. `Refractor` and `Water2`'s refraction become transmission: give the water's custom material `transmission` and `thickness`. Its surface function sets `s.transmission` and its rippled normal.",
|
|
1872
1864
|
"docs": "api/render",
|
|
1873
1865
|
"detect": "new\\s+(Reflector|Refractor|Water2?)\\s*\\("
|
|
1874
1866
|
},
|
|
@@ -1877,9 +1869,9 @@
|
|
|
1877
1869
|
"category": "Post-processing",
|
|
1878
1870
|
"three": "Sky / SkyMesh (addons)",
|
|
1879
1871
|
"status": "changed",
|
|
1880
|
-
"since": "0.2",
|
|
1881
1872
|
"target": "scene.setBackground({ sky: { sunPosition, turbidity, rayleigh, mieCoefficient, mieDirectionalG, cloudCoverage, ... } })",
|
|
1882
|
-
"notes": "three.js's Sky as the scene's background, with its uniforms' names, defaults and formulas, clouds and sun disc included. Drop the mesh and its scale: the sky draws behind every object. SkyMesh moves its clouds by the renderer's clock; pass the sketch's time as time instead.
|
|
1873
|
+
"notes": "three.js's `Sky` works as the scene's background, with its uniforms' names, defaults and formulas, clouds and sun disc included. Drop the mesh and its scale: the sky draws behind every object. `SkyMesh` moves its clouds by the renderer's clock; pass the sketch's time as `time` instead.",
|
|
1874
|
+
"details": "The sky lights nothing, as in three.js. For its light, `scene.setEnvironment(await assets.skyEnvironment())` follows the sky in place of `pmremGenerator.fromScene`. `timeOfDay(hours)` gives a sky, a sun, fog and an exposure that match each other.\n\nFor a physical sky with ozone, twilight and haze on distant objects, move to `{ atmosphere }`. It looks different from three.js's sky. The default `sunPosition` is the sun of three.js's sky example, 2 degrees over the horizon toward -Z. It is not a `Sky` uniform default.\n\nThe sky is about 5 at the horizon by day, and three.js's sky examples use an exposure of 0.5. So a port lit by the sky's environment at full intensity looks brighter. Lower the environment's intensity or the exposure.",
|
|
1883
1875
|
"docs": "api/scene",
|
|
1884
1876
|
"detect": "new\\s+Sky(Mesh)?\\s*\\("
|
|
1885
1877
|
},
|
|
@@ -1888,9 +1880,9 @@
|
|
|
1888
1880
|
"category": "Post-processing",
|
|
1889
1881
|
"three": "A physical sky and aerial perspective (add-ons such as @takram/three-atmosphere: SkyMaterial, AerialPerspectiveEffect)",
|
|
1890
1882
|
"status": "changed",
|
|
1891
|
-
"since": "0.2",
|
|
1892
1883
|
"target": "scene.setBackground({ atmosphere: { sunPosition, sunIntensity, rayleigh, haze, ozone, aerialPerspective, metersPerUnit, moonPosition, moonIntensity, stars, cloudCoverage, ... } })",
|
|
1893
|
-
"notes": "The engine's own physical sky
|
|
1884
|
+
"notes": "The engine's own physical sky comes from Hillaire's lookup tables, with no files to load. One background call draws the sky and hazes every object by its distance, so drop the sky mesh and its textures. Set `metersPerUnit` to the scene's scale, and `aerialPerspective` above 1 to make a small scene look larger.",
|
|
1885
|
+
"details": "The sun's light is in the units of a directional light. Aim the scene's light at the sun yourself, or take it from `timeOfDay(hours, { model: 'physical' })`. The sky lights nothing by itself: `scene.setEnvironment(await assets.skyEnvironment())` follows it. The Low preset draws the analytic sky in its place. No separate aerial perspective effect is needed.",
|
|
1894
1886
|
"docs": "api/scene",
|
|
1895
1887
|
"detect": "new\\s+(SkyMaterial|AerialPerspectiveEffect|StarsMaterial)\\s*\\("
|
|
1896
1888
|
},
|
|
@@ -1899,7 +1891,6 @@
|
|
|
1899
1891
|
"category": "Post-processing",
|
|
1900
1892
|
"three": "Lensflare / LensflareElement (addons)",
|
|
1901
1893
|
"status": "manual",
|
|
1902
|
-
"since": "0.2",
|
|
1903
1894
|
"target": "Screen-space sprites placed with camera.worldToScreen",
|
|
1904
1895
|
"notes": "",
|
|
1905
1896
|
"docs": "api/sprites",
|
|
@@ -1910,7 +1901,6 @@
|
|
|
1910
1901
|
"category": "Post-processing",
|
|
1911
1902
|
"three": "GammaCorrectionShader / sRGB conversion passes in the composer",
|
|
1912
1903
|
"status": "changed",
|
|
1913
|
-
"since": "0.1",
|
|
1914
1904
|
"target": "Delete: output is converted to sRGB exactly once",
|
|
1915
1905
|
"notes": "Keeping such a pass applies gamma twice and washes the image out.",
|
|
1916
1906
|
"docs": "concepts/color-management",
|
|
@@ -1921,9 +1911,9 @@
|
|
|
1921
1911
|
"category": "Sprites, points, lines and labels",
|
|
1922
1912
|
"three": "Sprite / SpriteMaterial",
|
|
1923
1913
|
"status": "changed",
|
|
1924
|
-
"since": "0.2",
|
|
1925
1914
|
"target": "await scene.createSprites({ count, map, atlas, sizeAttenuation, center })",
|
|
1926
|
-
"notes": "Camera-facing quads
|
|
1915
|
+
"notes": "Camera-facing quads draw in one batch, with typed arrays of positions, sizes, rotations, colors and atlas frames per sprite. The call is async, because the first one downloads the sprite code. Sprites blend by default, as three.js's do.",
|
|
1916
|
+
"details": "Without size attenuation, sizes are in CSS pixels, not a fraction of the view's height. A three.js scale s shows `s × h / (2 × tan(fov / 2))` CSS pixels on a canvas h CSS pixels high. `center` holds one value for the whole batch, not one per sprite. An atlas read through `texture.offset` and `texture.repeat` becomes `atlas` and `frames`.\n\n`alphaTest` becomes `alphaMode 'mask'` with `alphaCutoff`. Raycasts hit each sprite's quad, as `Raycaster` does, with the active camera in place of `raycaster.camera`. `sprites.on('click', fn)` takes pointer events, and the event's `instance` is the sprite.",
|
|
1927
1917
|
"docs": "api/sprites",
|
|
1928
1918
|
"detect": "\\bSprite(Material)?\\b"
|
|
1929
1919
|
},
|
|
@@ -1932,20 +1922,20 @@
|
|
|
1932
1922
|
"category": "Sprites, points, lines and labels",
|
|
1933
1923
|
"three": "Points / PointsMaterial",
|
|
1934
1924
|
"status": "changed",
|
|
1935
|
-
"since": "0.2",
|
|
1936
1925
|
"target": "await scene.createPoints({ positions, colors, size, sizeAttenuation, map })",
|
|
1937
|
-
"notes": "Points of one size
|
|
1926
|
+
"notes": "Points of one size draw in one batch as camera-facing squares, at any size on every backend. The call is async, because the first one downloads the sprite code. Points are opaque by default, as three.js's are; `transparent` becomes `alphaMode 'blend'`, and `alphaMap` has no counterpart.",
|
|
1927
|
+
"details": "`alphaTest` becomes `alphaMode 'mask'` with `alphaCutoff`. With size attenuation, `size` is in world units: three.js's size times `tan(fov / 2)`. Without it, size is in CSS pixels, as in three.js. A point does not vanish when its center leaves the screen, as a WebGL point does. Blended points sort back to front.\n\nRaycasts hit each point's square by default. The `pointThreshold` option gives `Raycaster.params.Points.threshold`'s test instead: a hit within that distance of the point, whatever its size. `points.on('click', fn)` takes pointer events, and the event's `instance` is the point. The geometry's position and color attributes become `positions` and `colors`.\n\nWith an orthographic camera, three.js ignores size attenuation, so port with `sizeAttenuation: false` and three.js's size. three.js's WebGPU renderer draws points one pixel wide, and WebGL lets a GPU cap their size as low as 1 pixel.",
|
|
1938
1928
|
"docs": "api/points",
|
|
1939
1929
|
"detect": "new\\s+(THREE\\.)?Points\\s*\\(|\\bPointsMaterial\\b"
|
|
1940
1930
|
},
|
|
1941
1931
|
{
|
|
1942
1932
|
"id": "lines",
|
|
1943
1933
|
"category": "Sprites, points, lines and labels",
|
|
1944
|
-
"three": "Line / LineSegments / LineLoop / LineBasicMaterial / LineDashedMaterial / Line2 / LineMaterial",
|
|
1934
|
+
"three": "Line / LineSegments / LineLoop / LineBasicMaterial / LineDashedMaterial / Line2 / LineSegments2 / LineMaterial",
|
|
1945
1935
|
"status": "changed",
|
|
1946
|
-
"since": "0.2",
|
|
1947
1936
|
"target": "await scene.createLines({ positions, colors, mode, width, worldUnits, dashed })",
|
|
1948
|
-
"notes": "Segments between points
|
|
1937
|
+
"notes": "Segments between points draw in one batch as quads with round ends, as `Line2` draws them, at any width on every backend. `mode` replaces the line classes, and `width` replaces `linewidth`. The call is async, and `LineMaterial.resolution` needs no setting.",
|
|
1938
|
+
"details": "`'segments'` also replaces `LineSegments2` with `LineSegmentsGeometry`. A one-pixel `Line` ports as `width` 1. Point colors are linear RGB, stored at 8 bits per channel. `positions` replaces `LineGeometry.setPositions` or the position attribute, and `colors` replaces `setColors` or the color attribute.\n\n`dashed` and the dash values replace `LineDashedMaterial` and `computeLineDistances`. `dashed` is fixed when the batch is created, and `lines.material.set` changes the four dash values, whose defaults match `LineMaterial`'s. `lit: true` shades lines with the scene's lights.\n\nRaycasts hit a segment within half its width, as `Line2` does, in pixels through the active camera or in world units. The `lineThreshold` option gives `Raycaster.params.Line.threshold`'s test instead, as for `Line`. `maxDistance` limits line hits too, though three.js's `Line2` ignores `raycaster.far`. `lines.on('click', fn)` takes pointer events, and the event's `instance` is the segment.",
|
|
1949
1939
|
"docs": "api/lines",
|
|
1950
1940
|
"detect": "new\\s+(THREE\\.)?(Line|LineSegments|LineLoop|Line2|LineSegments2)\\s*\\(|\\bLine(Basic|Dashed)?Material\\b|\\bLineGeometry\\b"
|
|
1951
1941
|
},
|
|
@@ -1954,9 +1944,9 @@
|
|
|
1954
1944
|
"category": "Sprites, points, lines and labels",
|
|
1955
1945
|
"three": "Points or InstancedMesh particles moved on the CPU / three.quarks ParticleSystem / three-nebula",
|
|
1956
1946
|
"status": "changed",
|
|
1957
|
-
"since": "0.2",
|
|
1958
1947
|
"target": "await createParticles(ctx, { rate, bursts, lifetime, shape, speed, gravity, drag, wind, turbulence, size, colors, alphaOverLife, blending, map, flipbook }) from @null3d/particles; system.update() in onLateUpdate",
|
|
1959
|
-
"notes": "three.js has no particle system. A port replaces the loop that moves Points or InstancedMesh rows with an emitter whose particles the GPU moves in closed form
|
|
1948
|
+
"notes": "three.js has no particle system. A port replaces the loop that moves `Points` or `InstancedMesh` rows with an emitter whose particles the GPU moves in closed form. Gravity, drag toward the wind, turbulence and a bouncing ground come from options.",
|
|
1949
|
+
"details": "Write the effect's look as curves over life in place of per-frame color and size code. `AdditiveBlending` becomes `blending 'additive'`; particles never write depth. A sprite atlas becomes `map` with `flipbook`. three.quarks's sub-emitters become `subEmitters` on `'death'` or `'ground'`. A system does not sort its own particles, cast shadows or take light.",
|
|
1960
1950
|
"docs": "api/particles",
|
|
1961
1951
|
"detect": "\\b(ParticleSystem|BatchedRenderer|ParticleEmitter)\\b|three\\.quarks|three-nebula"
|
|
1962
1952
|
},
|
|
@@ -1965,9 +1955,9 @@
|
|
|
1965
1955
|
"category": "Geometry",
|
|
1966
1956
|
"three": "A PlaneGeometry displaced on the CPU, with heights from ImprovedNoise or a height map",
|
|
1967
1957
|
"status": "changed",
|
|
1968
|
-
"since": "0.2",
|
|
1969
1958
|
"target": "createTerrain(ctx, { size, height, layers, splat, maxLevel, camera }) from @null3d/terrain; terrain.update(eye) in onUpdate; terrain.heightAt(x, z)",
|
|
1970
|
-
"notes": "A port replaces one displaced grid with a height field drawn as a camera-centered quadtree of blocks. The ground near the camera keeps fine detail, the far hills draw coarse blocks
|
|
1959
|
+
"notes": "A port replaces one displaced grid with a height field drawn as a camera-centered quadtree of blocks. The ground near the camera keeps fine detail, and the far hills draw coarse blocks. A skirt around each block hides the seam between neighbors more than one level apart.",
|
|
1960
|
+
"details": "Up to four tiled layers blend by a splat map. The add-on fills the map by default from the height and the slope, in place of a hand-painted or vertex-colored ground. Each layer's own height pushes it through its neighbors at a boundary. Every pixel lights from normals baked over the whole ground, so the far hills keep their relief.\n\nThe terrain carries no collision. A port that walked on the ground reads `heightAt` and `normalAt` to place objects instead of a physics collider. A port that morphed between levels drops its own morph. Each block morphs toward its parent block's surface before it hands over, so the ground does not pop. `morph: false` switches each block at once.",
|
|
1971
1961
|
"docs": "api/terrain",
|
|
1972
1962
|
"detect": "\\bImprovedNoise\\b|\\bgenerateHeight\\b|\\bgetHeightAt\\b"
|
|
1973
1963
|
},
|
|
@@ -1976,9 +1966,9 @@
|
|
|
1976
1966
|
"category": "Geometry",
|
|
1977
1967
|
"three": "A tree model per species loaded from a glTF file, or a procedural plant from an add-on such as Sapling or ez-tree, swaying in a custom wind shader",
|
|
1978
1968
|
"status": "changed",
|
|
1979
|
-
"since": "0.3",
|
|
1980
1969
|
"target": "const tree = await assets.loadGltf(url); scene.createInstances(tree.find(name).mesh, count, { material }) for the copies of each species; a materials.shader material whose vertexOffset samples the field of createWind(ctx, { camera }) from @null3d/wind, with swayDistance; far copies as cards from @null3d/impostors, with handOverToCards(meshes, cards.batch, switchDistance)",
|
|
1981
|
-
"notes": "null3D ships no plant generator
|
|
1970
|
+
"notes": "null3D ships no plant generator, so a port keeps its tree models. Export a procedural tree from Blender's Sapling, ez-tree or a similar tool as a glTF file, or build the tree in code. Draw each species' copies as one instance batch, so the engine gives them levels of detail and culling.",
|
|
1971
|
+
"details": "For wind, replace the three.js shader's sway with one custom material whose vertex offset reads the wind add-on's field, as `api/wind` shows. The sway fades to nothing at the material's `swayDistance`, so far trees stand still and keep their cached shadows. Past the last level, cards from the impostors add-on stand in for the trees, and `handOverToCards` sets the two distance bands.",
|
|
1982
1972
|
"docs": "api/wind",
|
|
1983
1973
|
"detect": "\\b(Tree|Foliage|Vegetation)(Generator|Factory)\\b|\\bSapling\\b|\\bez-tree\\b"
|
|
1984
1974
|
},
|
|
@@ -1987,9 +1977,9 @@
|
|
|
1987
1977
|
"category": "Sprites, points, lines and labels",
|
|
1988
1978
|
"three": "CSS2DRenderer / CSS3DRenderer (HTML labels)",
|
|
1989
1979
|
"status": "changed",
|
|
1990
|
-
"since": "0.2",
|
|
1991
1980
|
"target": "Sketch: ui.trackLabel(obj, 'hp-12', { offset: [0, 2, 0] }). Page: engine.labels.bind('hp-12', element). A plane of the scene: ui.trackLabel(obj, 'card', { transform: 'world' }), or 'billboard' with a rotation",
|
|
1992
|
-
"notes": "The sketch places each label with the camera of each frame, and the page moves the element over it in the frame on screen
|
|
1981
|
+
"notes": "The sketch places each label with the camera of each frame, and the page moves the element over it in the frame on screen. The element's center sits where `CSS2DRenderer` puts a `CSS2DObject`'s, and the offset turns and scales with the object. The engine has no camera view offset.",
|
|
1982
|
+
"details": "Put the elements in a container that covers the canvas. Hidden labels get `visibility: hidden`, not `display: none`. There is no z-index by distance, and no center. Give an element `pointer-events: auto` for the clicks that `CSS3DRenderer` gives it.\n\nFor `CSS3DRenderer`, a label with `transform 'world'` takes a `CSS3DObject`'s matrix. `'billboard'` takes a `CSS3DSprite`'s, with `rotation2D` as `rotation`. The page moves the element into a container inside its parent, which holds the camera's perspective. It then turns the element with its world matrix, as `CSS3DRenderer` draws it. An element is sized in CSS pixels, which are the scene's units. Both perspective and orthographic cameras carry the planes, so a scene that uses either lens ports as it is.\n\nThe engine hides a plane whose anchor is behind the camera or outside the near and far planes. `CSS3DRenderer` does not do that. The offset follows the object as a `CSS2DObject`'s position does under its parent. The engine leaves the pointer to your CSS. It writes a transform only when it changes, and a page holds its planes with `maxLabels3d`.\n\nAll seven of three.js's CSS3D examples have a port: css3d_periodictable, css3d_molecules, css3d_sprites, css3d_sandbox, css3d_orthographic, css3d_mixed and css3d_youtube. Three also draw WebGL content: mixed, sandbox and orthographic. Where the mixed example's invisible plane writes depth alone to show its embedded page clean, a material with `colorWrite: false` does the same.\n\nA cell table ports directly: one object and one `ui.trackLabel(object, id, { transform: 'world' })` for each cell. The cell's HTML goes in the element, and the example's camera. The port skill's architecture guide shows it.",
|
|
1993
1983
|
"docs": "api/ui",
|
|
1994
1984
|
"detect": "\\bCSS[23]D(Renderer|Object|Sprite)\\b"
|
|
1995
1985
|
},
|
|
@@ -1998,9 +1988,9 @@
|
|
|
1998
1988
|
"category": "Geometry",
|
|
1999
1989
|
"three": "A field of grass blades as an InstancedMesh or a custom shader that bends them in a time-based wind",
|
|
2000
1990
|
"status": "changed",
|
|
2001
|
-
"since": "0.3",
|
|
2002
1991
|
"target": "await createGrass(ctx, { height, area, count, seed, mask, wind, camera, swayDistance }) from @null3d/grass, with grass.setWindLayer(field) in each frame to bend the blades in the wind add-on's field, grass.fit(preset) for a preset's share and grass.setSwayDistance(swayDistanceFor(preset)) when the preset changes",
|
|
2003
|
-
"notes": "three.js has no grass. A port replaces the hand-made blades and their wind shader with one call
|
|
1992
|
+
"notes": "three.js has no grass. A port replaces the hand-made blades and their wind shader with one call. The add-on places the tufts on the ground's height by integer hash, so one seed places the same grass on every device.",
|
|
1993
|
+
"details": "The add-on bends the blades in the wind add-on's field, so the grass answers the same gusts as the rest of the scene. On WebGPU a compute pass builds the blade list each frame, culls it to the view and thins the far tufts. WebGL2 draws the same rows as an instance batch. The grass casts and receives the sun's shadows. A blade shape, a width along the blade and the fold of its keel, takes the place of a hand-made blade geometry.",
|
|
2004
1994
|
"docs": "api/grass",
|
|
2005
1995
|
"detect": "\\bGrass(Geometry|Material|Mesh|Shader|Field|Blades?)\\b"
|
|
2006
1996
|
},
|
|
@@ -2008,10 +1998,9 @@
|
|
|
2008
1998
|
"id": "xr",
|
|
2009
1999
|
"category": "Other",
|
|
2010
2000
|
"three": "WebXR (renderer.xr, VRButton, ARButton)",
|
|
2011
|
-
"status": "
|
|
2012
|
-
"since": null,
|
|
2001
|
+
"status": "unsupported",
|
|
2013
2002
|
"target": "None",
|
|
2014
|
-
"notes": "
|
|
2003
|
+
"notes": "null3D has no WebXR support. Keep an XR view in three.js.",
|
|
2015
2004
|
"docs": "porting/threejs-unsupported",
|
|
2016
2005
|
"detect": "\\.xr\\.|\\b(VR|AR|XR)Button\\b|XRControllerModelFactory"
|
|
2017
2006
|
},
|
|
@@ -2020,9 +2009,9 @@
|
|
|
2020
2009
|
"category": "Other",
|
|
2021
2010
|
"three": "GaussianSplat / GaussianSplatPLYLoader / SPZLoader / SPLATLoader / KSPLATLoader (addons)",
|
|
2022
2011
|
"status": "changed",
|
|
2023
|
-
"since": "0.3",
|
|
2024
2012
|
"target": "const splats = await createSplats(ctx, { url }) from @null3d/splats; assets.loadGltf for a KHR_gaussian_splatting model",
|
|
2025
|
-
"notes": "Importing
|
|
2013
|
+
"notes": "Importing `@null3d/splats` registers the `KHR_gaussian_splatting` reader, so a glTF model of splats loads with `assets.loadGltf`. An SPZ file loads through `createSplats`, which cuts the cloud into detail levels. It chooses the splats within a budget that follows the quality preset and the GPU path, then lets the engine sort them by depth.",
|
|
2014
|
+
"details": "A large cloud loads as a splat stream: `createSplats` reads an index of chunk files and downloads only the chunks that the view needs. The cloud then draws before its whole file arrives. three.js has no equivalent. Update them once in each frame with `splats.update(eye)`, from the camera's `getPosition`. The first spherical-harmonic band gives each splat's color; higher bands are ignored. three.js's `GaussianSplat` and its loaders are add-ons, so each name maps to this one add-on.",
|
|
2026
2015
|
"docs": "api/splats",
|
|
2027
2016
|
"detect": "\\bGaussianSplat\\w*\\b|\\b(SPZ|SPLAT|KSPLAT)Loader\\b"
|
|
2028
2017
|
},
|
|
@@ -2030,11 +2019,11 @@
|
|
|
2030
2019
|
"id": "audio",
|
|
2031
2020
|
"category": "Other",
|
|
2032
2021
|
"three": "Audio / PositionalAudio / AudioListener / AudioLoader",
|
|
2033
|
-
"status": "
|
|
2034
|
-
"
|
|
2035
|
-
"
|
|
2036
|
-
"
|
|
2037
|
-
"docs": "
|
|
2022
|
+
"status": "changed",
|
|
2023
|
+
"target": "@null3d/sound: createSound in the sketch, connectSound on the page",
|
|
2024
|
+
"notes": "`AudioListener` is `createSound`'s listener option, usually the camera. A looping `PositionalAudio` is a `sound.loop` at a place, with `refDistance` as `near`; one that plays once per event is a `sound.shot`. `AudioLoader` and `AudioAnalyser` have no counterpart: name the file by its address, and analyze the page's own Web Audio.",
|
|
2025
|
+
"details": "three.js's `maxDistance` only stops the fall with distance, while `far` fades the sound out. Give `far` where the sound should end. A non-positional `Audio` is a loop with `positional: false`. The page loads the named file once the user starts the sound.",
|
|
2026
|
+
"docs": "api/sound",
|
|
2038
2027
|
"detect": "\\b(PositionalAudio|AudioListener|AudioLoader|AudioAnalyser)\\b"
|
|
2039
2028
|
},
|
|
2040
2029
|
{
|
|
@@ -2042,9 +2031,8 @@
|
|
|
2042
2031
|
"category": "Other",
|
|
2043
2032
|
"three": "lil-gui / dat.gui panels",
|
|
2044
2033
|
"status": "changed",
|
|
2045
|
-
"since": "0.1",
|
|
2046
2034
|
"target": "Keep the panel on the page; send changes with engine.postToSketch and receive them with page.onMessage",
|
|
2047
|
-
"notes": "",
|
|
2035
|
+
"notes": "Keep the panel on the page. Send changes with `engine.postToSketch` and receive them with `page.onMessage`. For values that you only tune while you develop, the `?inspect` panel of a development build changes transforms and material values with no code (guides/debugging).",
|
|
2048
2036
|
"docs": "api/page",
|
|
2049
2037
|
"detect": "\\blil-gui\\b|\\bdat\\.gui\\b|new\\s+GUI\\s*\\("
|
|
2050
2038
|
},
|
|
@@ -2053,9 +2041,8 @@
|
|
|
2053
2041
|
"category": "Other",
|
|
2054
2042
|
"three": "cannon-es / Rapier / Ammo / Oimo",
|
|
2055
2043
|
"status": "changed",
|
|
2056
|
-
"since": "0.1",
|
|
2057
2044
|
"target": "Run the physics library in the sketch worker; copy body transforms into dynamic arrays after each step",
|
|
2058
|
-
"notes": "
|
|
2045
|
+
"notes": "null3D has no physics API. WebAssembly physics builds run in workers.",
|
|
2059
2046
|
"docs": "guides/physics",
|
|
2060
2047
|
"detect": "from\\s+['\"](cannon-es|cannon|@dimforge/rapier3d(-compat)?|ammo\\.js|oimo|@react-three/rapier|@react-three/cannon)['\"]"
|
|
2061
2048
|
},
|
|
@@ -2064,7 +2051,6 @@
|
|
|
2064
2051
|
"category": "Other",
|
|
2065
2052
|
"three": "three-mesh-bvh (computeBoundsTree, acceleratedRaycast)",
|
|
2066
2053
|
"status": "direct",
|
|
2067
|
-
"since": "0.2",
|
|
2068
2054
|
"target": "Built in",
|
|
2069
2055
|
"notes": "Delete the setup. Every query walks the engine's own trees over each mesh's triangles and over the scene's objects.",
|
|
2070
2056
|
"docs": "api/raycast",
|
|
@@ -2075,9 +2061,9 @@
|
|
|
2075
2061
|
"category": "Other",
|
|
2076
2062
|
"three": "React Three Fiber / drei (Canvas, useFrame, useGLTF, OrbitControls, Environment, Html)",
|
|
2077
2063
|
"status": "manual",
|
|
2078
|
-
"since": "0.1",
|
|
2079
2064
|
"target": "React stays for the page UI; the scene moves into sketch.ts",
|
|
2080
|
-
"notes": "React keeps the page UI and talks to the sketch through messages. Rewrite each scene component and drei helper by hand.",
|
|
2065
|
+
"notes": "React keeps the page UI and talks to the sketch through messages. Rewrite each scene component and drei helper by hand. drei's `<Html>` becomes `ui.trackLabel` in the sketch, and `ContactShadows` and `onPointerMissed` have no counterpart.",
|
|
2066
|
+
"details": "The directional light's contact shadows are another technique in place of `ContactShadows`, a blurred shadow on a ground plane. Mesh events such as `onClick` and `onPointerEnter` become `obj.on('click')` and `obj.on('pointerenter')`.\n\nReact Three Fiber casts only against objects with handlers, and passes an event to every hit until `stopPropagation`. null3D passes it to the closest drawn object and its parents, so an object without handlers in front takes it. React Three Fiber's `onClick` also fires after a drag. null3D gives no click after a drag past 2 CSS pixels, or 10 for a finger. For a pointer miss, set a flag in click handlers, and treat `input.wasReleased('Mouse0')` without it as a miss.",
|
|
2081
2067
|
"docs": "api/page",
|
|
2082
2068
|
"detect": "from\\s+['\"]@react-three/(fiber|drei)['\"]|\\buseFrame\\s*\\("
|
|
2083
2069
|
},
|
|
@@ -2086,7 +2072,6 @@
|
|
|
2086
2072
|
"category": "Other",
|
|
2087
2073
|
"three": "GLSL source strings (gl_FragColor, gl_Position, #include <chunk>)",
|
|
2088
2074
|
"status": "manual",
|
|
2089
|
-
"since": "0.1",
|
|
2090
2075
|
"target": "WGSL, which the null3D Vite plugin compiles",
|
|
2091
2076
|
"notes": "See the custom shaders guide and the WGSL rules for portable shaders.",
|
|
2092
2077
|
"docs": "guides/custom-shaders",
|
|
@@ -2097,20 +2082,30 @@
|
|
|
2097
2082
|
"category": "Other",
|
|
2098
2083
|
"three": "document or window access inside scene code",
|
|
2099
2084
|
"status": "changed",
|
|
2100
|
-
"since": "0.1",
|
|
2101
2085
|
"target": "DOM code stays in page.ts; data travels in messages; sizes come from ctx.engine.viewport",
|
|
2102
2086
|
"notes": "The sketch worker has no DOM. createEngine({ sketchThread: 'main' }) runs the sketch on the page's thread, where it can reach the DOM.",
|
|
2103
2087
|
"docs": "api/sketch",
|
|
2104
2088
|
"detect": "\\bdocument\\.(getElementById|querySelector|querySelectorAll|body|createElement)\\b|\\bwindow\\.(innerWidth|innerHeight|devicePixelRatio|addEventListener)\\b"
|
|
2105
2089
|
},
|
|
2090
|
+
{
|
|
2091
|
+
"id": "vite-build",
|
|
2092
|
+
"category": "Other",
|
|
2093
|
+
"three": "vite.config.js (the app built with Vite)",
|
|
2094
|
+
"status": "changed",
|
|
2095
|
+
"target": "`plugins: [null3d()]` in vite.config.ts, with `null3d` imported from `@null3d/vite-plugin`",
|
|
2096
|
+
"notes": "Every Vite build of a null3D project needs the plugin, for the dev server and for production, which a three.js project does not. It sends the headers that let worker threads share memory, compiles the WGSL, and builds the engine's workers. null3D supports Vite alone, so a project on another bundler moves to Vite.",
|
|
2097
|
+
"details": "A one-file trial can load the engine from a CDN instead.",
|
|
2098
|
+
"docs": "getting-started/install",
|
|
2099
|
+
"detect": "from\\s+['\"]vite['\"]"
|
|
2100
|
+
},
|
|
2106
2101
|
{
|
|
2107
2102
|
"id": "worker",
|
|
2108
2103
|
"category": "Other",
|
|
2109
2104
|
"three": "new Worker(...) / worker.postMessage / SharedArrayBuffer",
|
|
2110
2105
|
"status": "changed",
|
|
2111
|
-
"since": "0.3",
|
|
2112
2106
|
"target": "runTask: the task's module and its WebAssembly run in the engine's job workers",
|
|
2113
|
-
"notes": "An add-on starts no worker of its own. Give runTask the address of a module that exports run
|
|
2107
|
+
"notes": "An add-on starts no worker of its own. Give `runTask` the address of a module that exports `run`, and await its answer. A `SharedArrayBuffer` in the task's input is shared with the worker rather than copied.",
|
|
2108
|
+
"details": "The engine never waits for a task in a frame, and an answer arrives between frames.",
|
|
2114
2109
|
"docs": "api/tasks",
|
|
2115
2110
|
"detect": "new\\s+Worker\\s*\\(|\\bSharedArrayBuffer\\b"
|
|
2116
2111
|
}
|