@null3d/engine 0.0.0 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +109 -0
- package/THIRD-PARTY-NOTICES.txt +0 -1
- package/dist/wasm/single/null3d.js +19 -6
- package/dist/wasm/single/null3d_bg.wasm +0 -0
- package/dist/wasm/threaded/null3d.js +19 -6
- package/dist/wasm/threaded/null3d_bg.wasm +0 -0
- package/docs/api/animation.md +23 -67
- package/docs/api/assets.md +42 -26
- package/docs/api/cameras.md +8 -6
- package/docs/api/controls.md +46 -44
- package/docs/api/debug.md +13 -8
- package/docs/api/engine.md +17 -11
- package/docs/api/feature-draws.md +3 -3
- package/docs/api/feature-effects.md +3 -3
- package/docs/api/feature-instances.md +2 -2
- package/docs/api/features.md +14 -15
- package/docs/api/geometry.md +56 -75
- package/docs/api/grass.md +1 -1
- package/docs/api/impostors.md +120 -9
- package/docs/api/input.md +4 -11
- package/docs/api/lights.md +14 -38
- package/docs/api/lines.md +8 -25
- package/docs/api/materials.md +69 -70
- package/docs/api/math.md +6 -7
- package/docs/api/objects.md +13 -13
- package/docs/api/particles.md +2 -14
- package/docs/api/points.md +3 -25
- package/docs/api/post.md +22 -23
- package/docs/api/quality.md +11 -6
- package/docs/api/raycast.md +13 -32
- package/docs/api/reference/animation.md +9 -9
- package/docs/api/reference/assets.md +18 -18
- package/docs/api/reference/cameras.md +5 -2
- package/docs/api/reference/controls.md +75 -23
- package/docs/api/reference/debug.md +23 -8
- package/docs/api/reference/engine.md +22 -10
- package/docs/api/reference/geometry.md +161 -82
- package/docs/api/reference/grass.md +1 -1
- package/docs/api/reference/impostors.md +92 -1
- package/docs/api/reference/input.md +3 -3
- package/docs/api/reference/lights.md +9 -9
- package/docs/api/reference/lines.md +7 -7
- package/docs/api/reference/materials.md +48 -48
- package/docs/api/reference/math.md +22 -22
- package/docs/api/reference/objects.md +9 -9
- package/docs/api/reference/points.md +4 -4
- package/docs/api/reference/post.md +18 -18
- package/docs/api/reference/quality.md +7 -3
- package/docs/api/reference/raycast.md +6 -6
- package/docs/api/reference/render.md +2 -2
- package/docs/api/reference/scene.md +29 -26
- package/docs/api/reference/sketch.md +4 -0
- package/docs/api/reference/sound.md +203 -0
- package/docs/api/reference/sprites.md +5 -5
- package/docs/api/reference/terrain.md +2 -1
- package/docs/api/reference/textures.md +4 -4
- package/docs/api/reference/ui.md +3 -3
- package/docs/api/reference/vertex-draws.md +3 -3
- package/docs/api/reference/water.md +77 -6
- package/docs/api/reference/wind.md +2 -2
- package/docs/api/render.md +12 -10
- package/docs/api/scene.md +40 -29
- package/docs/api/sketch.md +64 -3
- package/docs/api/sound.md +169 -0
- package/docs/api/splats.md +7 -0
- package/docs/api/sprites.md +4 -20
- package/docs/api/tasks.md +2 -2
- package/docs/api/terrain.md +2 -14
- package/docs/api/textures.md +9 -9
- package/docs/api/ui.md +3 -15
- package/docs/api/water.md +198 -15
- package/docs/api/wind.md +5 -5
- package/docs/cli/null3d.md +93 -18
- package/docs/concepts/architecture.md +10 -10
- package/docs/concepts/assets.md +2 -19
- package/docs/concepts/backends.md +7 -5
- package/docs/concepts/color-management.md +15 -26
- package/docs/concepts/culling.md +1 -1
- package/docs/concepts/instances.md +5 -5
- package/docs/concepts/large-worlds.md +1 -1
- package/docs/concepts/lighting.md +50 -55
- package/docs/concepts/lod.md +2 -15
- package/docs/concepts/materials.md +16 -16
- package/docs/concepts/post-processing.md +7 -29
- package/docs/concepts/quality-preset-tables.md +53 -50
- package/docs/concepts/quality-presets.md +56 -27
- package/docs/concepts/render-graph.md +19 -14
- package/docs/concepts/render-layers.md +3 -17
- package/docs/concepts/shadows.md +10 -28
- package/docs/concepts/static-dynamic.md +2 -2
- package/docs/cookbook/index.md +1 -1
- package/docs/data/threejs-mapping.json +136 -102
- package/docs/errors/E1214.md +3 -3
- package/docs/errors/E1307.md +23 -0
- package/docs/errors/E1420.md +3 -3
- package/docs/errors/index.md +3 -2
- package/docs/getting-started/cdn.md +17 -1
- package/docs/getting-started/first-scene.md +1 -1
- package/docs/getting-started/hosting.md +50 -9
- package/docs/getting-started/install.md +8 -7
- package/docs/getting-started/network-use.md +10 -2
- package/docs/getting-started/project-structure.md +15 -6
- package/docs/getting-started/third-party-notices.md +8 -6
- package/docs/guides/accessibility.md +1 -1
- package/docs/guides/add-ons.md +3 -2
- package/docs/guides/agents.md +16 -5
- package/docs/guides/assets-pipeline.md +13 -12
- package/docs/guides/audio.md +109 -124
- package/docs/guides/car-paint.md +1 -1
- package/docs/guides/content-pages.md +10 -6
- package/docs/guides/custom-passes.md +9 -8
- package/docs/guides/custom-shaders.md +6 -3
- package/docs/guides/debugging.md +78 -4
- package/docs/guides/deploying.md +105 -5
- package/docs/guides/deterministic-simulation.md +1 -1
- package/docs/guides/first-use-shaders.md +4 -4
- package/docs/guides/loading-screens.md +78 -33
- package/docs/guides/multiple-views.md +41 -2
- package/docs/guides/performance.md +6 -3
- package/docs/guides/phones.md +12 -1
- package/docs/guides/physics.md +1 -1
- package/docs/guides/screens.md +7 -5
- package/docs/guides/start-time.md +328 -0
- package/docs/guides/testing.md +23 -5
- package/docs/guides/ui-overlays.md +3 -3
- package/docs/index.md +12 -8
- package/docs/pages.md +26 -23
- package/docs/porting/react-three-fiber.md +228 -5
- package/docs/porting/threejs-loop-and-threads.md +220 -6
- package/docs/porting/threejs-mapping.md +86 -84
- package/docs/porting/threejs-materials.md +212 -5
- package/docs/porting/threejs-overview.md +218 -5
- package/docs/porting/threejs-postprocessing.md +2 -2
- package/docs/porting/threejs-shaders.md +298 -5
- package/docs/porting/threejs-unsupported.md +82 -6
- package/docs/porting/verification.md +181 -5
- package/docs/shaders/builtins.md +1 -1
- package/docs/shaders/library.md +63 -39
- package/docs/shaders/surface-functions.md +11 -10
- package/docs/shaders/wgsl-rules.md +1 -1
- package/lib/debug/channel.d.ts +103 -0
- package/lib/debug/channel.js +269 -0
- package/lib/debug/debug.d.ts +9 -7
- package/lib/debug/draw.d.ts +9 -0
- package/lib/debug/draw.js +49 -2
- package/lib/debug/inspector.d.ts +60 -0
- package/lib/debug/inspector.js +475 -0
- package/lib/debug/stats-panel.d.ts +1 -1
- package/lib/debug/stats.d.ts +2 -3
- package/lib/errors/codes.js +8 -2
- package/lib/errors/engine-error.js +25 -10
- package/lib/errors/fixes.d.ts +1 -0
- package/lib/errors/fixes.js +3 -2
- 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/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 +4 -1
- 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 +15 -1
- package/lib/index.d.ts +6 -4
- 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 +7 -7
- 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 +103 -26
- package/lib/page/engine.js +420 -97
- 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 +17 -10
- 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/switches.d.ts +32 -2
- package/lib/page/switches.js +9 -1
- 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/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 +1 -1
- package/lib/scene/fog.d.ts +11 -4
- package/lib/scene/fog.js +8 -2
- package/lib/scene/frame-cameras.d.ts +19 -0
- package/lib/scene/frame-cameras.js +58 -0
- package/lib/scene/gltf.d.ts +32 -2
- 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 +120 -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/picks.d.ts +2 -2
- package/lib/scene/pointer-events.d.ts +4 -7
- package/lib/scene/post.d.ts +38 -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 +225 -254
- package/lib/scene/resources.js +179 -81
- package/lib/scene/scene.d.ts +149 -118
- package/lib/scene/scene.js +196 -98
- 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 +3 -4
- package/lib/scene/time-of-day.js +2 -3
- 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/metrics.d.ts +38 -0
- package/lib/shared/metrics.js +62 -1
- package/lib/shared/run-task.js +7 -1
- 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 +35 -0
- 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 +76 -9
- package/lib/sketch/runner.js +385 -52
- package/lib/sketch/ui.d.ts +5 -8
- package/lib/workers/probe-worker.d.ts +5 -0
- package/lib/workers/probe-worker.js +13 -4
- package/lib/workers/protocol.d.ts +61 -13
- package/lib/workers/protocol.js +4 -0
- package/lib/workers/render-worker.js +25 -4
- package/lib/workers/sketch-worker.js +104 -15
- package/package.json +2 -2
|
@@ -5,8 +5,7 @@
|
|
|
5
5
|
"direct": "Same concept; the call or option changes name only.",
|
|
6
6
|
"changed": "Supported, with a different API or pattern. Follow the note.",
|
|
7
7
|
"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."
|
|
8
|
+
"unsupported": "null3D has no equivalent. Use the workaround in the note."
|
|
10
9
|
},
|
|
11
10
|
"sinceLegend": {
|
|
12
11
|
"0.1": "the core renderer, with cameras, materials, lights and shadows",
|
|
@@ -77,20 +76,20 @@
|
|
|
77
76
|
"status": "changed",
|
|
78
77
|
"since": "0.1",
|
|
79
78
|
"target": "post.set({ toneMapping: 'agx' | 'agx-punchy' | 'neutral' | 'aces' | 'none' | curveWgsl, exposure })",
|
|
80
|
-
"notes": "The engine default is \"agx-punchy\", AgX with Filament's punchy look; three.js defaults to no tone mapping, so ports of scenes without it set toneMapping: \"none\". A port keeps the curve it set: AgXToneMapping becomes \"agx\"
|
|
79
|
+
"notes": "The engine default is \"agx-punchy\", AgX with Filament's punchy look; three.js defaults to no tone mapping, so ports of scenes without it set toneMapping: \"none\". A port keeps the curve it set: AgXToneMapping becomes \"agx\", ACESFilmicToneMapping \"aces\" and NeutralToneMapping \"neutral\". The curves use three.js's formulas. \"none\" applies the exposure, as LinearToneMapping does; NoToneMapping ignores toneMappingExposure, so keep exposure at 1 when porting it. Copy toneMappingExposure to exposure unchanged: null3D multiplies it into each light rather than into the finished picture, which 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, as in three.js at the same exposure. ReinhardToneMapping and CineonToneMapping become the reinhard and cineon curves of @null3d/three-compat: post.set({ toneMapping: reinhard }), with three.js's formulas. CustomToneMapping becomes a custom tone curve: post.set({ toneMapping: wgsl }), where the WGSL declares fn toneCurve(color: vec3f) -> vec3f. Leave out the curve's multiply by toneMappingExposure, because the color arrives exposed. A custom curve needs HDR color, as bloom does, so compatibility mode draws in HDR color with FXAA while one is set; a device without an HDR target keeps the built-in curve.",
|
|
81
80
|
"docs": "api/post",
|
|
82
81
|
"detect": "\\b\\w+ToneMapping\\b|\\.toneMapping(Exposure)?\\s*="
|
|
83
82
|
},
|
|
84
83
|
{
|
|
85
84
|
"id": "color-output",
|
|
86
85
|
"category": "Renderer and loop",
|
|
87
|
-
"three": "renderer.outputColorSpace / outputEncoding / ColorManagement",
|
|
86
|
+
"three": "renderer.outputColorSpace / outputEncoding / ColorManagement / material.dithering",
|
|
88
87
|
"status": "direct",
|
|
89
88
|
"since": "0.1",
|
|
90
89
|
"target": "Nothing to do",
|
|
91
|
-
"notes": "Output is sRGB with a linear working space, as in three.js r152+ defaults: the final pass encodes sRGB and dithers. Hex colors are sRGB and [r, g, b] arrays are linear, as three.js reads them. Delete these lines.",
|
|
90
|
+
"notes": "Output is sRGB with a linear working space, as in three.js r152+ defaults: the final pass encodes sRGB and dithers. Hex colors are sRGB and [r, g, b] arrays are linear, as three.js reads them. Delete these lines. 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
91
|
"docs": "concepts/color-management",
|
|
93
|
-
"detect": "\\.output(ColorSpace|Encoding)\\b|\\bColorManagement\\b"
|
|
92
|
+
"detect": "\\.output(ColorSpace|Encoding)\\b|\\bColorManagement\\b|\\bdithering\\s*[:=]"
|
|
94
93
|
},
|
|
95
94
|
{
|
|
96
95
|
"id": "stats",
|
|
@@ -99,7 +98,7 @@
|
|
|
99
98
|
"status": "changed",
|
|
100
99
|
"since": "0.1",
|
|
101
100
|
"target": "debug.stats(true), or createEngine({ stats: true }) on the page; debug.frameStats() for numbers",
|
|
102
|
-
"notes": "The overlay shows the frame rates, CPU time per thread and phase, draw calls and uploads, the GPU tier, the preset and the render scale.
|
|
101
|
+
"notes": "The overlay shows the frame rates, CPU time per thread and phase, draw calls and uploads, the GPU tier, the preset and the render scale. It sits at the canvas's top right, and its header shows the frame rate. A click opens a card with each thread's and the GPU's time against the target frame rate, triangles and objects drawn, and the memory of the engine, the GPU's textures and buffers, the heap and the page. Triangles 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. The page shows it with createEngine({ stats: true }), engine.stats(true) or ?stats. @null3d/engine/stats shows a three.js page's own figures in the same panel, with StatsPanel, or as text, with statsText. engine.measure(seconds) on the page gives percentiles of CPU and GPU time, and memory. In the sketch, debug.frameStats() also gives the textures' GPU bytes, their budget and their dropped mip levels.",
|
|
103
102
|
"docs": "api/debug",
|
|
104
103
|
"detect": "\\.info\\.(render|programs)|from\\s+['\"][^'\"]*stats(\\.module)?(\\.js)?['\"]|\\bnew\\s+Stats\\s*\\("
|
|
105
104
|
},
|
|
@@ -110,7 +109,7 @@
|
|
|
110
109
|
"status": "changed",
|
|
111
110
|
"since": "0.2",
|
|
112
111
|
"target": "quality.textureMemory; textures.memoryBytes; the quality setting textureMemoryMiB; debug.frameStats().gpuTextureBytes and gpuBufferBytes",
|
|
113
|
-
"notes": "three.js counts the textures that the renderer holds, not their bytes, and sets no 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 once room returns. debug.frameStats()
|
|
112
|
+
"notes": "three.js counts the textures that the renderer holds, not their bytes, and sets no 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 once room returns. debug.frameStats() also gives the bytes of every GPU texture and buffer that the engine holds, render targets and shadow maps included.",
|
|
114
113
|
"docs": "concepts/quality-presets",
|
|
115
114
|
"detect": "\\.info\\.memory\\b"
|
|
116
115
|
},
|
|
@@ -131,7 +130,7 @@
|
|
|
131
130
|
"three": "renderer.setClearColor / scene.background = color or texture",
|
|
132
131
|
"status": "direct",
|
|
133
132
|
"since": "0.1",
|
|
134
|
-
"target": "scene.setBackground('#rrggbb' | texture | environment
|
|
133
|
+
"target": "scene.setBackground('#rrggbb' | texture | environment | cube map | { sky }, options)",
|
|
135
134
|
"notes": "A texture fills the view behind every object and stretches to its shape, as a texture background does in three.js. An environment or a cube map surrounds the scene, as a PMREM texture or a CubeTexture in scene.background does. 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. For an exact page color, set toneMapping: \"none\", or use createEngine({ transparent: true }) over a CSS background. setClearColor(color, 0) on an alpha canvas becomes transparent: true with no background.",
|
|
136
135
|
"docs": "api/scene",
|
|
137
136
|
"detect": "\\.setClearColor\\s*\\(|\\.background\\s*="
|
|
@@ -197,8 +196,8 @@
|
|
|
197
196
|
"three": "logarithmicDepthBuffer / reverseDepthBuffer",
|
|
198
197
|
"status": "direct",
|
|
199
198
|
"since": "0.1",
|
|
200
|
-
"target": "Nothing to do; createEngine({ largeWorld: true }) and batch origins for planet-scale scenes
|
|
201
|
-
"notes": "The engine draws reversed depth in a 32-bit float buffer. On WebGL2 without EXT_clip_control, reversed depth keeps GL's range, which is less precise. engine.capabilities.depth says which depth the device draws. The engine also renders relative to the camera through per-cell offsets. With largeWorld: true, positions that you set keep their full precision at any distance, and createInstances takes an origin that its rows are relative to.",
|
|
199
|
+
"target": "Nothing to do; createEngine({ largeWorld: true }) and batch origins for planet-scale scenes",
|
|
200
|
+
"notes": "The engine draws reversed depth in a 32-bit float buffer. On WebGL2 without EXT_clip_control, reversed depth keeps GL's range, which is less precise. engine.capabilities.depth says which depth the device draws. The engine also renders relative to the camera through per-cell offsets. With largeWorld: true, positions that you set keep their full precision at any distance, and createInstances takes an origin that its rows are relative to. The page switch ?depth=standard draws depth as three.js's WebGLRenderer does by default, which helps compare pictures with a three.js original. It works on WebGL2 only and draws no shadows.",
|
|
202
201
|
"docs": "concepts/large-worlds",
|
|
203
202
|
"detect": "logarithmicDepthBuffer|reverseDepthBuffer"
|
|
204
203
|
},
|
|
@@ -220,7 +219,7 @@
|
|
|
220
219
|
"status": "changed",
|
|
221
220
|
"since": "0.2",
|
|
222
221
|
"target": "scene.setEnvironment(await assets.loadEnvironment('/env/sunset.ktx2'))",
|
|
223
|
-
"notes": "`loadEnvironment` takes an HDR file as it is, or its map from `bunx @null3d/cli assets env`, which needs no filtering at load. `pmremGenerator.fromScene(new RoomEnvironment(), 0.04)` becomes `await assets.builtinEnvironment('room')`: the same room with the same blur, made on the GPU as three.js makes it, with no file to download. `pmremGenerator.fromScene(sceneWithSky)` becomes `await assets.skyEnvironment()`, once: its map follows `scene.setBackground({ sky })`, so drop the calls that make the map again after each change. Its map leaves out the sun's disc, whose light the directional light gives. scene.environmentIntensity becomes the `intensity` option.",
|
|
222
|
+
"notes": "`loadEnvironment` takes an HDR file as it is, or its map from `bunx @null3d/cli assets env`, which needs no filtering at load. `pmremGenerator.fromScene(new RoomEnvironment(), 0.04)` becomes `await assets.builtinEnvironment('room')`: the same room with the same blur, made on the GPU as three.js makes it, with no file to download. `pmremGenerator.fromScene(sceneWithSky)` becomes `await assets.skyEnvironment()`, once: its map follows `scene.setBackground({ sky })`, so drop the calls that make the map again after each change. Its map leaves out the sun's disc, whose light the directional light gives. scene.environmentIntensity becomes the `intensity` option. The 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
223
|
"docs": "concepts/lighting",
|
|
225
224
|
"detect": "\\.environment\\s*=|\\bRoomEnvironment\\b"
|
|
226
225
|
},
|
|
@@ -275,7 +274,7 @@
|
|
|
275
274
|
"status": "changed",
|
|
276
275
|
"since": "0.1",
|
|
277
276
|
"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(), and getParent() returns an object's parent, or null for a root object. Creating, destroying and re-parenting rebuild the draw tables in that frame, so during play hide with setVisible and pool with setActiveCount instead (guides/performance).",
|
|
277
|
+
"notes": "Objects are in the scene as soon as they are created. setParent keeps the local transform, like add(), and getParent() returns an object's parent, or null for a root object. Creating, destroying and re-parenting rebuild the draw tables in that frame, so during play hide with setVisible and pool with setActiveCount instead (guides/performance). 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
278
|
"docs": "api/objects",
|
|
280
279
|
"detect": "\\bscene\\.(add|remove)\\s*\\(|\\.attach\\s*\\("
|
|
281
280
|
},
|
|
@@ -362,8 +361,8 @@
|
|
|
362
361
|
"three": "object.traverse / getObjectByName / children",
|
|
363
362
|
"status": "changed",
|
|
364
363
|
"since": "0.1",
|
|
365
|
-
"target": "scene.find(name) for getObjectByName; your own arrays of objects instead of traverse and children",
|
|
366
|
-
"notes": "scene.find returns the first object created with the name, from an index. No call
|
|
364
|
+
"target": "scene.find(name) for getObjectByName; scene.listObjects() at setup, or your own arrays of objects, instead of traverse and children",
|
|
365
|
+
"notes": "scene.find returns the first object created with the name, from an index. scene.listObjects() returns every object of the scene as a new array, and getParent() returns an object's parent. scene.listObjects walks the whole scene and allocates, so call it at setup, never in every frame. No call returns an object's children, so keep the objects you need in arrays at setup time.",
|
|
367
366
|
"docs": "api/objects",
|
|
368
367
|
"detect": "\\.traverse(Visible|Ancestors)?\\s*\\(|getObjectBy(Name|Id|Property)\\s*\\("
|
|
369
368
|
},
|
|
@@ -385,7 +384,7 @@
|
|
|
385
384
|
"status": "direct",
|
|
386
385
|
"since": "0.1",
|
|
387
386
|
"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 light, spot lights and point lights cast them on both GPU paths; point lights where the preset's pointLightShadows is on. Unlit materials show no shadows. An instance batch takes castShadows and receiveShadows in createInstances, or batch.setCastShadows(true) / setReceiveShadows(true), for every row
|
|
387
|
+
"notes": "Both are false by default, as in three.js. The directional light, spot lights and point lights cast them on both GPU paths; point lights where the preset's pointLightShadows is on. Unlit materials show no shadows. An instance batch takes castShadows and receiveShadows in createInstances, or batch.setCastShadows(true) / setReceiveShadows(true), for every row.",
|
|
389
388
|
"docs": "api/objects",
|
|
390
389
|
"detect": "\\.(castShadow|receiveShadow)\\s*="
|
|
391
390
|
},
|
|
@@ -396,7 +395,7 @@
|
|
|
396
395
|
"status": "changed",
|
|
397
396
|
"since": "0.1",
|
|
398
397
|
"target": "obj.setLayers(mask), obj.getLayers(), camera.setLayers(mask), batch.setLayers(mask); the layers option of createMesh, createInstances and createPerspectiveCamera",
|
|
399
|
-
"notes": "Masks have the same 32 bits and the same default, layer 0 alone, and a camera draws an object when their masks share a bit. layers.set(n) becomes setLayers(1 << n), and layers.mask becomes getLayers(). For enable and disable, read the mask with getLayers() and pass the new mask. An InstancedMesh's layers become its batch's, for every row. Raycasts and declared passes take layer masks
|
|
398
|
+
"notes": "Masks have the same 32 bits and the same default, layer 0 alone, and a camera draws an object when their masks share a bit. layers.set(n) becomes setLayers(1 << n), layers.enableAll() becomes setLayers(0xffffffff), and layers.mask becomes getLayers(). For enable and disable, read the mask with getLayers() and pass the new mask. An InstancedMesh's layers become its batch's, for every row. Raycasts and declared passes take layer masks. Shadow casters differ: three.js tests them against the camera's layers, and null3D against the light's. Give each light that casts shadows the layers of every object that must cast, or those objects cast nothing.",
|
|
400
399
|
"docs": "concepts/render-layers",
|
|
401
400
|
"detect": "\\.layers\\.(set|enable|disable|toggle|enableAll|disableAll|mask)\\b"
|
|
402
401
|
},
|
|
@@ -407,7 +406,7 @@
|
|
|
407
406
|
"status": "direct",
|
|
408
407
|
"since": "0.1",
|
|
409
408
|
"target": "mesh.setRenderOrder(n)",
|
|
410
|
-
"notes": "Orders blended objects, lower first, before their depth, as in three.js. The engine orders opaque and masked objects itself for speed. The rows of an instance batch sort by depth one by one, where three.js sorts an InstancedMesh as one object.",
|
|
409
|
+
"notes": "Orders blended objects, lower 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. The rows of an instance batch sort by depth one by one, where three.js sorts an InstancedMesh as one object.",
|
|
411
410
|
"docs": "api/objects",
|
|
412
411
|
"detect": "\\.renderOrder\\s*="
|
|
413
412
|
},
|
|
@@ -439,8 +438,8 @@
|
|
|
439
438
|
"three": "object.onBeforeRender / onAfterRender",
|
|
440
439
|
"status": "manual",
|
|
441
440
|
"since": "0.1",
|
|
442
|
-
"target": "onUpdate / onLateUpdate, or a declared pass
|
|
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.
|
|
441
|
+
"target": "onUpdate / onLateUpdate, or a declared pass",
|
|
442
|
+
"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
443
|
"docs": "api/sketch",
|
|
445
444
|
"detect": "\\.on(Before|After)Render\\s*="
|
|
446
445
|
},
|
|
@@ -461,8 +460,8 @@
|
|
|
461
460
|
"three": "geometry.dispose() / material.dispose() / texture.dispose()",
|
|
462
461
|
"status": "changed",
|
|
463
462
|
"since": "0.1",
|
|
464
|
-
"target": "texture.destroy(); material.destroy()
|
|
465
|
-
"notes": "texture.destroy() frees a texture's GPU memory, and materials that map it draw with their colors alone. material.destroy()
|
|
463
|
+
"target": "texture.destroy(); material.destroy(); mesh.destroy(); prefab.destroy() for a loaded glTF model",
|
|
464
|
+
"notes": "texture.destroy() frees a texture's GPU memory, and materials that map it draw with their colors alone. material.destroy() frees the material's place, and a custom material's pipelines with its last material, once no object uses it; objects that still use it draw nothing. mesh.destroy() frees a mesh's GPU memory and data at the next frame, and throws E1111 while an object or instance batch uses it, so destroy those first, in the same frame or before. prefab.destroy() frees every mesh, material and texture of a loaded model, and its skeleton and clips, once its copies are destroyed. three.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
465
|
"docs": "api/textures",
|
|
467
466
|
"detect": "\\.dispose\\s*\\("
|
|
468
467
|
},
|
|
@@ -506,7 +505,7 @@
|
|
|
506
505
|
"status": "direct",
|
|
507
506
|
"since": "0.1",
|
|
508
507
|
"target": "scene.createPerspectiveCamera({ fov, near, far, position, target })",
|
|
509
|
-
"notes": "fov is vertical and in degrees, as in three.js. The aspect ratio is automatic. The fov, near and far properties are read-only: change them with camera.setFov(degrees) and camera.setNearFar(near, far).",
|
|
508
|
+
"notes": "fov is vertical and in degrees, as in three.js. The aspect ratio is automatic. The fov, near and far properties are read-only: change them with camera.setFov(degrees) and camera.setNearFar(near, far). The defaults are three.js's: fov 50, near 0.1 and far 2000.",
|
|
510
509
|
"docs": "api/cameras",
|
|
511
510
|
"detect": "\\bPerspectiveCamera\\b"
|
|
512
511
|
},
|
|
@@ -528,7 +527,7 @@
|
|
|
528
527
|
"status": "direct",
|
|
529
528
|
"since": "0.1",
|
|
530
529
|
"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 that recomputes left and right on resize 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.",
|
|
530
|
+
"notes": "With height alone, the width follows the canvas's aspect ratio, so code that recomputes left and right on resize 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. The default height of 2 gives the same view as three.js's default edges, -1 to 1.",
|
|
532
531
|
"docs": "api/cameras",
|
|
533
532
|
"detect": "\\bOrthographicCamera\\b"
|
|
534
533
|
},
|
|
@@ -561,7 +560,7 @@
|
|
|
561
560
|
"status": "unsupported",
|
|
562
561
|
"since": null,
|
|
563
562
|
"target": "None; split screens use scene.createView with one camera for each view",
|
|
564
|
-
"notes": "
|
|
563
|
+
"notes": "null3D has no stereo rendering. For split screens, give each view a camera and a rectangle of the canvas.",
|
|
565
564
|
"docs": "porting/threejs-unsupported",
|
|
566
565
|
"detect": "\\b(Array|Stereo)Camera\\b"
|
|
567
566
|
},
|
|
@@ -572,7 +571,7 @@
|
|
|
572
571
|
"status": "changed",
|
|
573
572
|
"since": "0.1",
|
|
574
573
|
"target": "scene.createDirectionalLight({ direction, color, intensity, castShadows, shadow })",
|
|
575
|
-
"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 one created casts the shadows, and up to three more add fill and rim light, without shadows. Delete shadow.camera bounds: the engine's shadow cascades fit the view by themselves, and the shadow distance follows the farthest visible receiver by default, so a port with its own shadow.camera.far passes that number as shadow: { distance }. It also draws contact shadows on High and Ultra
|
|
574
|
+
"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 one created casts the shadows, and up to three more add fill and rim light, without shadows. Delete shadow.camera bounds: the engine's shadow cascades fit the view by themselves, and the shadow distance follows the farthest visible receiver by default, so a port with its own shadow.camera.far passes that number as shadow: { distance }. It 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. 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
575
|
"docs": "api/lights",
|
|
577
576
|
"detect": "\\bDirectionalLight\\b"
|
|
578
577
|
},
|
|
@@ -583,7 +582,7 @@
|
|
|
583
582
|
"status": "direct",
|
|
584
583
|
"since": "0.1",
|
|
585
584
|
"target": "scene.createPointLight({ position, color, intensity, range, decay, castShadows, shadow, intensityUnit })",
|
|
586
|
-
"notes": "distance becomes range, which every point light needs: 0, a light with no end, is not allowed, because the engine finds the lights near each surface by their ranges. intensity stays in candela. light.power = lumens becomes intensity: lumens with intensityUnit: 'lumen', which divides by 4π as power does; setIntensity then takes lumens.",
|
|
585
|
+
"notes": "distance becomes range, which every point light needs: 0, a light with no end, is not allowed, because the engine finds the lights near each surface by their ranges. intensity stays in candela. light.power = lumens becomes intensity: lumens with intensityUnit: 'lumen', which divides by 4π as power does; setIntensity then takes lumens. castShadow becomes castShadows, and shadow takes bias and normalBias in meters. The quality preset sets the tile size in place of shadow.mapSize, and shadow.camera has no equivalent.",
|
|
587
586
|
"docs": "api/lights",
|
|
588
587
|
"detect": "\\bPointLight\\b"
|
|
589
588
|
},
|
|
@@ -605,7 +604,7 @@
|
|
|
605
604
|
"status": "changed",
|
|
606
605
|
"since": "0.2",
|
|
607
606
|
"target": "scene.createHemisphereLight({ skyColor, groundColor, intensity })",
|
|
608
|
-
"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.",
|
|
607
|
+
"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. intensity stays in lux, three.js's unit.",
|
|
609
608
|
"docs": "api/lights",
|
|
610
609
|
"detect": "\\bHemisphereLight\\b"
|
|
611
610
|
},
|
|
@@ -616,7 +615,7 @@
|
|
|
616
615
|
"status": "direct",
|
|
617
616
|
"since": "0.1",
|
|
618
617
|
"target": "scene.createAmbientLight({ color, intensity })",
|
|
619
|
-
"notes": "Several ambient lights add up.",
|
|
618
|
+
"notes": "Several ambient lights add up. intensity stays in lux, three.js's unit.",
|
|
620
619
|
"docs": "api/lights",
|
|
621
620
|
"detect": "\\bAmbientLight\\b"
|
|
622
621
|
},
|
|
@@ -627,7 +626,7 @@
|
|
|
627
626
|
"status": "changed",
|
|
628
627
|
"since": "0.2",
|
|
629
628
|
"target": "scene.createRectAreaLight({ color, intensity, width, height, range })",
|
|
630
|
-
"notes": "Needs a range, where three.js's light has no end. No RectAreaLightUniformsLib.init() call. The light leaves along -Z, as in three.js. Casts no shadows, as in three.js.",
|
|
629
|
+
"notes": "Needs a range, where three.js's light has no end. No RectAreaLightUniformsLib.init() call. The light leaves along -Z, as in three.js. Casts no shadows, as in three.js. The engine shades it with linearly transformed cosines, as three.js does, so a rectangle light gives three.js's look. intensity stays in nits, three.js's unit.",
|
|
631
630
|
"docs": "api/lights",
|
|
632
631
|
"detect": "\\bRectAreaLight\\b"
|
|
633
632
|
},
|
|
@@ -682,7 +681,7 @@
|
|
|
682
681
|
"status": "direct",
|
|
683
682
|
"since": "0.1",
|
|
684
683
|
"target": "Built in: shadow: { cascades } on the directional light",
|
|
685
|
-
"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, as the farCascadeInterval quality setting says. The fade option is on by default: neighboring cascades blend over a band, which the shadowCascadeBlend quality setting sizes, and fade: false maps to shadowCascadeBlend: 0. The 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.",
|
|
684
|
+
"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, as the farCascadeInterval quality setting says. The fade option is on by default: neighboring cascades blend over a band, which the shadowCascadeBlend quality setting sizes, and fade: false maps to shadowCascadeBlend: 0. The 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
685
|
"docs": "concepts/shadows",
|
|
687
686
|
"detect": "\\bCSM\\b|csm/CSM"
|
|
688
687
|
},
|
|
@@ -703,8 +702,8 @@
|
|
|
703
702
|
"three": "SSSNode / sss() (screen-space shadows)",
|
|
704
703
|
"status": "changed",
|
|
705
704
|
"since": "0.2",
|
|
706
|
-
"target": "Contact shadows of the directional light: scene.createDirectionalLight({ contactDistance })",
|
|
707
|
-
"notes": "Both search the camera's depth toward the main light for short shadows where objects touch. contactDistance sets their reach in meters, 0.3 by default. They draw where the quality setting contactShadowSteps is above 0
|
|
705
|
+
"target": "Contact shadows of the directional light: scene.createDirectionalLight({ castShadows: true, shadow: { contactDistance } })",
|
|
706
|
+
"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. They draw where the quality setting contactShadowSteps is above 0: on High and Ultra, and on Medium on WebGL2.",
|
|
708
707
|
"docs": "api/lights",
|
|
709
708
|
"detect": "\\bSSSNode\\b"
|
|
710
709
|
},
|
|
@@ -715,7 +714,7 @@
|
|
|
715
714
|
"status": "changed",
|
|
716
715
|
"since": "0.1",
|
|
717
716
|
"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. The directional light's map stores 16-bit depth, so in each cascade bias covers at least 1.5 of its depth steps, about 2 cm in a far cascade 200 m out. 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. intensity is 0 to 1 and carries over as it stands: the shader mixes each shadow lookup toward full light by the rest, at no cost to the frame.",
|
|
717
|
+
"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. The directional light's map stores 16-bit depth, so in each cascade bias covers at least 1.5 of its depth steps, about 2 cm in a far cascade 200 m out. 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. intensity is 0 to 1 and carries over as it stands: the shader mixes each shadow lookup toward full light by the rest, at no cost to the frame. Casters draw only the faces that point away from the light, as three.js's default shadowSide does, and double-sided materials draw both. shadowSide has no option.",
|
|
719
718
|
"docs": "concepts/shadows",
|
|
720
719
|
"detect": "\\.shadow\\.(mapSize|bias|normalBias|intensity|camera|radius|blurSamples)\\b"
|
|
721
720
|
},
|
|
@@ -759,7 +758,7 @@
|
|
|
759
758
|
"status": "direct",
|
|
760
759
|
"since": "0.2",
|
|
761
760
|
"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 @null3d/geometry. Each function takes the constructor's arguments as named options with three.js's defaults, and returns arrays with three.js's vertices, normals and texture coordinates for geometry.fromArrays. Shape, Path, the curves and ShapeUtils come with the same names and methods, but points are [x, y] or [x, y, z] arrays, not Vector2 or Vector3. ExtrudeGeometry's caps and sides form one mesh, which takes one material.",
|
|
761
|
+
"notes": "Install @null3d/geometry. Each function takes the constructor's arguments as named options with three.js's defaults, and returns arrays with three.js's vertices, normals and texture coordinates for geometry.fromArrays. Shape, Path, the curves and ShapeUtils come with the same names and methods, but points are [x, y] or [x, y, z] arrays, not Vector2 or Vector3. 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, where three.js returns null. 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
762
|
"docs": "api/geometry",
|
|
764
763
|
"detect": "\\b(TorusKnot|Icosahedron|Octahedron|Tetrahedron|Dodecahedron|Polyhedron|Lathe|Extrude|Shape|Tube)Geometry\\b|\\bnew\\s+(THREE\\.)?Shape\\s*\\("
|
|
765
764
|
},
|
|
@@ -770,20 +769,20 @@
|
|
|
770
769
|
"status": "changed",
|
|
771
770
|
"since": "0.1",
|
|
772
771
|
"target": "geometry.fromArrays({ positions, normals, uvs, uvs1, colors, tangents, joints, weights, indices })",
|
|
773
|
-
"notes": "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.
|
|
772
|
+
"notes": "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. skinIndex and skinWeight become joints and weights, 8-bit and 16-bit integer arrays stay integers on the GPU, and { array, normalized: true } keeps a BufferAttribute's normalized flag.",
|
|
774
773
|
"docs": "api/geometry",
|
|
775
774
|
"detect": "\\bBufferGeometry\\b|\\.setAttribute\\s*\\(|\\.setIndex\\s*\\(|\\b(Float32|Uint16|Uint32)?BufferAttribute\\b"
|
|
776
775
|
},
|
|
777
776
|
{
|
|
778
777
|
"id": "geo-dynamic",
|
|
779
778
|
"category": "Geometry",
|
|
780
|
-
"three": "attribute.needsUpdate / setUsage(DynamicDrawUsage) (vertices changing every frame)",
|
|
779
|
+
"three": "attribute.needsUpdate / setUsage(DynamicDrawUsage) / addUpdateRange (vertices changing every frame)",
|
|
781
780
|
"status": "changed",
|
|
782
781
|
"since": "0.2",
|
|
783
782
|
"target": "mesh.updateVertices(name, values, start, count)",
|
|
784
783
|
"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 give objects bounds with setBounds when vertices move outside it. Meshes with joints or morph targets take no updates. For many moving objects, use instances instead of rewriting vertices.",
|
|
785
784
|
"docs": "api/geometry",
|
|
786
|
-
"detect": "\\.attributes\\.\\w+\\.needsUpdate|\\.setUsage\\s*\\(|DynamicDrawUsage"
|
|
785
|
+
"detect": "\\.attributes\\.\\w+\\.needsUpdate|\\.setUsage\\s*\\(|DynamicDrawUsage|\\.addUpdateRange\\s*\\("
|
|
787
786
|
},
|
|
788
787
|
{
|
|
789
788
|
"id": "geo-compute",
|
|
@@ -814,7 +813,7 @@
|
|
|
814
813
|
"status": "changed",
|
|
815
814
|
"since": "0.3",
|
|
816
815
|
"target": "DOM labels (ui.trackLabel), a texture with pre-rendered text, or a text mesh baked into glTF",
|
|
817
|
-
"notes": "
|
|
816
|
+
"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
817
|
"docs": "porting/threejs-unsupported",
|
|
819
818
|
"detect": "\\bTextGeometry\\b|\\bFontLoader\\b|troika-three-text"
|
|
820
819
|
},
|
|
@@ -825,7 +824,7 @@
|
|
|
825
824
|
"status": "changed",
|
|
826
825
|
"since": "0.2",
|
|
827
826
|
"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. Color targets (morphAttributes.color, glTF's COLOR_0 targets) change vertex colors,
|
|
827
|
+
"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. 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. Tangent targets morph tangents, as glTF gives them, which three.js does not do. mesh.mesh.morphTargetNames lists the names in target order, in place of morphTargetDictionary. 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
828
|
"docs": "api/animation",
|
|
830
829
|
"detect": "morphAttributes|morphTargetInfluences|morphTargetDictionary"
|
|
831
830
|
},
|
|
@@ -836,7 +835,7 @@
|
|
|
836
835
|
"status": "direct",
|
|
837
836
|
"since": "0.1",
|
|
838
837
|
"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 values carry over. roughnessMap and metalnessMap become one metalnessRoughnessMap, and a texture's repeat, offset and rotation become the material's uvTransform, or its own mapUvTransforms entry where one map differs from the rest. Roughness has three.js r187's floor of 0.045. Highlights on small curved shapes widen by Filament's specular anti-aliasing, where 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.",
|
|
838
|
+
"notes": "Both follow glTF's metallic-roughness model with the same formulas, so color, metalness, roughness and emissive values carry over. roughnessMap and metalnessMap become one metalnessRoughnessMap, and a texture's repeat, offset and rotation become the material's uvTransform, or its own mapUvTransforms entry where one map differs from the rest. Roughness has three.js r187's floor of 0.045. Highlights on small curved shapes widen by Filament's specular anti-aliasing, where 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
839
|
"docs": "api/materials",
|
|
841
840
|
"detect": "\\bMeshStandardMaterial\\b"
|
|
842
841
|
},
|
|
@@ -858,7 +857,7 @@
|
|
|
858
857
|
"status": "direct",
|
|
859
858
|
"since": "0.2",
|
|
860
859
|
"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), as three.js converts it.",
|
|
860
|
+
"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. A glTF ior of 0 becomes 1000, as GLTFLoader reads it.",
|
|
862
861
|
"docs": "api/materials",
|
|
863
862
|
"detect": "\\bspecular(Intensity|Color)(Map)?\\b|\\.ior\\b|\\bior\\s*:"
|
|
864
863
|
},
|
|
@@ -891,7 +890,7 @@
|
|
|
891
890
|
"status": "changed",
|
|
892
891
|
"since": "0.2",
|
|
893
892
|
"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, as glTF packs them: pack two textures into one. 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. The car paint add-on builds metal flakes and panel seams over this clear coat, and three.js has no flake lobe: its metal flakes are a normal map.",
|
|
893
|
+
"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, as glTF packs them: pack two textures into one. 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. The car paint example add-on (guides/car-paint) builds metal flakes and panel seams over this clear coat, and three.js has no flake lobe: its metal flakes are a normal map.",
|
|
895
894
|
"docs": "api/materials",
|
|
896
895
|
"detect": "\\bclearcoat(Roughness|NormalScale|Map|RoughnessMap|NormalMap)?\\b"
|
|
897
896
|
},
|
|
@@ -946,7 +945,7 @@
|
|
|
946
945
|
"status": "direct",
|
|
947
946
|
"since": "0.1",
|
|
948
947
|
"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.",
|
|
948
|
+
"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
949
|
"docs": "api/materials",
|
|
951
950
|
"detect": "\\bMeshBasicMaterial\\b"
|
|
952
951
|
},
|
|
@@ -968,7 +967,7 @@
|
|
|
968
967
|
"status": "manual",
|
|
969
968
|
"since": "0.1",
|
|
970
969
|
"target": "materials.shader({ wgsl, uniforms }) with a toon surface function",
|
|
971
|
-
"notes": "
|
|
970
|
+
"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. The engine calls it 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. Set 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
971
|
"docs": "shaders/surface-functions",
|
|
973
972
|
"detect": "\\bMeshToonMaterial\\b"
|
|
974
973
|
},
|
|
@@ -978,7 +977,7 @@
|
|
|
978
977
|
"three": "MeshNormalMaterial / MeshDepthMaterial / MeshDistanceMaterial / MeshMatcapMaterial",
|
|
979
978
|
"status": "changed",
|
|
980
979
|
"since": "0.1",
|
|
981
|
-
"target": "debug.view('normals' | 'depth') for debugging; matcap is a
|
|
980
|
+
"target": "debug.view('normals' | 'depth') for debugging; matcap is a recipe with an unlit function, fn unlit",
|
|
982
981
|
"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
982
|
"docs": "api/debug",
|
|
984
983
|
"detect": "\\bMesh(Normal|Depth|Distance|Matcap)Material\\b"
|
|
@@ -989,8 +988,8 @@
|
|
|
989
988
|
"three": "ShaderMaterial / RawShaderMaterial (GLSL)",
|
|
990
989
|
"status": "manual",
|
|
991
990
|
"since": "0.1",
|
|
992
|
-
"target": "materials.shader({ wgsl, uniforms, textures }) with a WGSL surface function, or a full WGSL shader",
|
|
993
|
-
"notes": "Rewrite in WGSL, in one literal tagged /* wgsl */. Prefer a surface function, so lighting, shadows, fog and instancing keep working. 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 }), and
|
|
991
|
+
"target": "materials.shader({ wgsl, uniforms, textures }) with a WGSL surface function, an unlit function (fn unlit), or a full WGSL shader",
|
|
992
|
+
"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. 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 }), and the type check rejects a name that struct Uniforms lacks. A sampler2D uniform becomes var name: texture_2d<f32>; in the WGSL and an entry of the textures option, sampled with textureSample(name, nameSampler, uv). Textures are fixed when the material is created. Full shaders take no textures.",
|
|
994
993
|
"docs": "shaders/surface-functions",
|
|
995
994
|
"detect": "\\b(Raw)?ShaderMaterial\\b"
|
|
996
995
|
},
|
|
@@ -1001,7 +1000,7 @@
|
|
|
1001
1000
|
"status": "manual",
|
|
1002
1001
|
"since": "0.1",
|
|
1003
1002
|
"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
|
|
1003
|
+
"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
1004
|
"docs": "shaders/surface-functions",
|
|
1006
1005
|
"detect": "\\.onBeforeCompile\\s*="
|
|
1007
1006
|
},
|
|
@@ -1013,7 +1012,8 @@
|
|
|
1013
1012
|
"since": "0.3",
|
|
1014
1013
|
"target": "materials.shader({ sceneInputs: ['sceneDepth'], wgsl }) with sceneDepth(uv) or sceneDistance(uv)",
|
|
1015
1014
|
"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. A surface in the opaque pass, or in a scene or reflection pass, reads 0, the far plane.",
|
|
1016
|
-
"docs": "api/materials"
|
|
1015
|
+
"docs": "api/materials",
|
|
1016
|
+
"detect": "\\b(DepthTexture|perspectiveDepthToViewZ|viewportDepthTexture|viewportLinearDepth)\\b|\\.depthTexture\\b"
|
|
1017
1017
|
},
|
|
1018
1018
|
{
|
|
1019
1019
|
"id": "mat-shader-builtins",
|
|
@@ -1043,8 +1043,8 @@
|
|
|
1043
1043
|
"three": "transparent / opacity / alphaTest / depthWrite / depthTest / blending / vertexColors / flatShading / colorWrite",
|
|
1044
1044
|
"status": "changed",
|
|
1045
1045
|
"since": "0.1",
|
|
1046
|
-
"target": "alphaMode: 'blend' | 'mask' (with alphaCutoff), depthWrite, depthTest, colorWrite, blending: 'normal' | 'additive' | 'multiply' | 'weighted'
|
|
1047
|
-
"notes": "transparent: true becomes alphaMode: 'blend'; alphaTest becomes alphaMode: 'mask' with alphaCutoff; its cut edges are smoothed by default, and alphaToCoverage: false keeps three.js's hard edges. depthTest: false writes no depth either, as in three.js's WebGL renderer. colorWrite: false writes depth and no color. 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, where three.js blends an opaque material with additive or multiply blending too. The 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.",
|
|
1046
|
+
"target": "alphaMode: 'blend' | 'mask' (with alphaCutoff), depthWrite, depthTest, colorWrite, blending: 'normal' | 'additive' | 'multiply' | 'weighted', vertexColors, flatShading",
|
|
1047
|
+
"notes": "transparent: true becomes alphaMode: 'blend'; alphaTest becomes alphaMode: 'mask' with alphaCutoff; its cut edges are smoothed by default, and alphaToCoverage: false keeps three.js's hard edges. depthTest: false writes no depth either, as in three.js's WebGL renderer. colorWrite: false writes depth and no color. 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, where three.js blends an opaque material with additive or multiply blending too. The 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
1048
|
"docs": "api/materials",
|
|
1049
1049
|
"detect": "\\b(transparent|alphaTest|depthWrite|depthTest|colorWrite|blending|vertexColors|flatShading)\\s*[:=]"
|
|
1050
1050
|
},
|
|
@@ -1066,7 +1066,7 @@
|
|
|
1066
1066
|
"status": "changed",
|
|
1067
1067
|
"since": "0.1",
|
|
1068
1068
|
"target": "doubleSided: true",
|
|
1069
|
-
"notes": "Fixed when the material is created. 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
|
|
1069
|
+
"notes": "Fixed when the material is created. 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.",
|
|
1070
1070
|
"docs": "api/materials",
|
|
1071
1071
|
"detect": "\\bside\\s*[:=]"
|
|
1072
1072
|
},
|
|
@@ -1088,7 +1088,7 @@
|
|
|
1088
1088
|
"status": "changed",
|
|
1089
1089
|
"since": "0.2",
|
|
1090
1090
|
"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. 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, and then its shadow caster keeps the mask's holes. Fixed when the material is created.",
|
|
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. 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, and then its shadow caster keeps the mask's holes. Fixed when the material is created. Its shadow cuts at alphaCutoff, where three.js's shadow cuts at 0.5.",
|
|
1092
1092
|
"docs": "api/materials",
|
|
1093
1093
|
"detect": "\\balphaToCoverage\\s*[:=]"
|
|
1094
1094
|
},
|
|
@@ -1176,7 +1176,7 @@
|
|
|
1176
1176
|
"status": "changed",
|
|
1177
1177
|
"since": "0.2",
|
|
1178
1178
|
"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, so no setBounds call is needed. One visible difference: 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 there 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.",
|
|
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, so no setBounds call is needed. One visible difference: 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 there 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
1180
|
"docs": "api/materials",
|
|
1181
1181
|
"detect": "\\bdisplacement(Map|Scale|Bias)\\b"
|
|
1182
1182
|
},
|
|
@@ -1186,7 +1186,7 @@
|
|
|
1186
1186
|
"three": "material.alphaMap",
|
|
1187
1187
|
"status": "manual",
|
|
1188
1188
|
"since": "0.1",
|
|
1189
|
-
"target": "Alpha packed into the base color map's alpha channel offline, or a surface function that sets s.alpha from the texture
|
|
1189
|
+
"target": "Alpha packed into the base color map's alpha channel offline, or a surface function that sets s.alpha from the texture",
|
|
1190
1190
|
"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
1191
|
"docs": "api/materials",
|
|
1192
1192
|
"detect": "\\balphaMap\\b"
|
|
@@ -1198,7 +1198,7 @@
|
|
|
1198
1198
|
"status": "manual",
|
|
1199
1199
|
"since": "0.1",
|
|
1200
1200
|
"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.
|
|
1201
|
+
"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. 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
1202
|
"docs": "shaders/surface-functions",
|
|
1203
1203
|
"detect": "clippingPlanes|localClippingEnabled|clipIntersection"
|
|
1204
1204
|
},
|
|
@@ -1209,10 +1209,21 @@
|
|
|
1209
1209
|
"status": "direct",
|
|
1210
1210
|
"since": "0.1",
|
|
1211
1211
|
"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).",
|
|
1212
|
+
"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
1213
|
"docs": "api/materials",
|
|
1214
1214
|
"detect": "polygonOffset(Factor|Units)?\\b"
|
|
1215
1215
|
},
|
|
1216
|
+
{
|
|
1217
|
+
"id": "light-map",
|
|
1218
|
+
"category": "Materials",
|
|
1219
|
+
"three": "material.lightMap / lightMapIntensity, with the light map texture's offset and repeat",
|
|
1220
|
+
"status": "changed",
|
|
1221
|
+
"since": "0.1",
|
|
1222
|
+
"target": "materials.standard({ lightMap, lightMapIntensity, lightMapOffset, lightMapRepeat })",
|
|
1223
|
+
"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. 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.",
|
|
1224
|
+
"docs": "api/materials",
|
|
1225
|
+
"detect": "\\blightMap(Intensity)?\\b"
|
|
1226
|
+
},
|
|
1216
1227
|
{
|
|
1217
1228
|
"id": "tone-mapped-flag",
|
|
1218
1229
|
"category": "Materials",
|
|
@@ -1242,7 +1253,7 @@
|
|
|
1242
1253
|
"status": "direct",
|
|
1243
1254
|
"since": "0.1",
|
|
1244
1255
|
"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
|
|
1256
|
+
"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. NoColorSpace and LinearSRGBColorSpace become colorSpace: 'linear'.",
|
|
1246
1257
|
"docs": "concepts/color-management",
|
|
1247
1258
|
"detect": "\\.colorSpace\\s*=|\\b(Linear)?SRGBColorSpace\\b|sRGBEncoding"
|
|
1248
1259
|
},
|
|
@@ -1253,7 +1264,7 @@
|
|
|
1253
1264
|
"status": "direct",
|
|
1254
1265
|
"since": "0.1",
|
|
1255
1266
|
"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
|
|
1267
|
+
"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
1268
|
"docs": "api/textures",
|
|
1258
1269
|
"detect": "\\.flipY\\s*="
|
|
1259
1270
|
},
|
|
@@ -1264,7 +1275,7 @@
|
|
|
1264
1275
|
"status": "changed",
|
|
1265
1276
|
"since": "0.1",
|
|
1266
1277
|
"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, a transform of its own, as three.js keeps one transform for each texture. A glTF file's transforms stay per map.",
|
|
1278
|
+
"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, as three.js keeps one transform for each texture. A glTF file's transforms stay per map. The default wrap is 'clamp', as three.js's default is ClampToEdgeWrapping.",
|
|
1268
1279
|
"docs": "api/textures",
|
|
1269
1280
|
"detect": "\\.(wrapS|wrapT)\\s*=|\\.repeat\\.set\\s*\\(|\\.offset\\.set\\s*\\(|\\b(Repeat|ClampToEdge|MirroredRepeat)Wrapping\\b"
|
|
1270
1281
|
},
|
|
@@ -1286,7 +1297,7 @@
|
|
|
1286
1297
|
"status": "changed",
|
|
1287
1298
|
"since": "0.1",
|
|
1288
1299
|
"target": "textures.fromData({ width, height, depth, format, data })",
|
|
1289
|
-
"notes": "Formats rgba8unorm and rgba16float (a Uint16Array of half floats or a Float32Array). depth above 1 makes a texture array
|
|
1300
|
+
"notes": "Formats rgba8unorm and rgba16float (a Uint16Array of half floats or a Float32Array). depth above 1 makes a texture array. The standard materials read its first layer. A custom material declares it as var name: texture_2d_array<f32> and samples a layer with textureSample(name, nameSampler, uv, layer). Filters are linear by default, where three.js's DataTexture is nearest: pass filter: 'nearest'. A 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
1301
|
"docs": "api/textures",
|
|
1291
1302
|
"detect": "\\bData(Array|3D)?Texture\\b"
|
|
1292
1303
|
},
|
|
@@ -1363,7 +1374,7 @@
|
|
|
1363
1374
|
"status": "direct",
|
|
1364
1375
|
"since": "0.1",
|
|
1365
1376
|
"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
|
|
1377
|
+
"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
1378
|
"docs": "api/textures",
|
|
1368
1379
|
"detect": "\\.channel\\s*="
|
|
1369
1380
|
},
|
|
@@ -1385,7 +1396,7 @@
|
|
|
1385
1396
|
"status": "changed",
|
|
1386
1397
|
"since": "0.2",
|
|
1387
1398
|
"target": "const prefab = await assets.loadGltf(url); scene.instantiate(prefab)",
|
|
1388
|
-
"notes": "A worker parses the file. Named nodes via prefab.find(name), and a copy's objects via instance.find(name); prefab.bounds frames the model. A node's textures, which three.js reads from mesh.material.map and its other maps, come from prefab.find(name).maps
|
|
1399
|
+
"notes": "A worker parses the file. Named nodes via prefab.find(name), and a copy's objects via instance.find(name); prefab.bounds frames the model. A node's textures, which three.js reads from mesh.material.map and its other maps, come from prefab.find(name).maps. KTX2 textures, WebP and AVIF textures (EXT_texture_webp, EXT_texture_avif) and meshopt compression need no decoder setup. 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. Materials 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. KHR_animation_pointer needs no plugin: the loader reads it, and 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
1400
|
"docs": "api/assets",
|
|
1390
1401
|
"detect": "\\bGLTFLoader\\b"
|
|
1391
1402
|
},
|
|
@@ -1429,7 +1440,7 @@
|
|
|
1429
1440
|
"status": "changed",
|
|
1430
1441
|
"since": "0.2",
|
|
1431
1442
|
"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
|
-
"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.",
|
|
1443
|
+
"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. The engine draws no glTF points, so a converted PLY point cloud loads with nothing to draw, where three.js draws it.",
|
|
1433
1444
|
"docs": "guides/assets-pipeline",
|
|
1434
1445
|
"detect": "\\b(FBX|OBJ|MTL|Collada|STL|PLY|3DM|USDZ|TDS|VRML|VTK|Rhino3dm)Loader\\b"
|
|
1435
1446
|
},
|
|
@@ -1451,7 +1462,7 @@
|
|
|
1451
1462
|
"status": "changed",
|
|
1452
1463
|
"since": "0.1",
|
|
1453
1464
|
"target": "assets.loadBinary(url), assets.loadJson(url), assets.loadImageBitmap(url)",
|
|
1454
|
-
"notes": "",
|
|
1465
|
+
"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
1466
|
"docs": "api/assets",
|
|
1456
1467
|
"detect": "\\b(File|Image|ImageBitmap)Loader\\b"
|
|
1457
1468
|
},
|
|
@@ -1473,7 +1484,7 @@
|
|
|
1473
1484
|
"status": "changed",
|
|
1474
1485
|
"since": "0.1",
|
|
1475
1486
|
"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 as setColorAt's color does
|
|
1487
|
+
"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 as setColorAt's color does. scene.createInstances(prefab, count) instances a glTF model. One set of rows serves all its meshes, in place of an InstancedMesh per mesh kept in step by hand. castShadow and receiveShadow become the castShadows and receiveShadows options, or batch.setCastShadows / setReceiveShadows. An InstancedMesh's boundingSphere becomes batch.setBoundingRadius(radius) for that batch: each row's sphere then holds the sphere of that radius around the row's origin.",
|
|
1477
1488
|
"docs": "concepts/instances",
|
|
1478
1489
|
"detect": "\\bInstancedMesh\\b|\\.set(Matrix|Color)At\\s*\\(|\\binstance(Matrix|Color)\\b"
|
|
1479
1490
|
},
|
|
@@ -1513,13 +1524,13 @@
|
|
|
1513
1524
|
{
|
|
1514
1525
|
"id": "lod",
|
|
1515
1526
|
"category": "Instancing and batching",
|
|
1516
|
-
"three": "LOD (addLevel)",
|
|
1527
|
+
"three": "LOD (addLevel) / SimplifyModifier",
|
|
1517
1528
|
"status": "changed",
|
|
1518
1529
|
"since": "0.2",
|
|
1519
1530
|
"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
1531
|
"notes": "Levels belong to the mesh, and every object and instance row picks its own level each frame. 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, and they switch at once while the threshold stays small; `levels: false` in its arrays opts out. Each 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. It measures to the nearest point of an object's bounds, where three.js measures to its position, so a large object switches later. 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. Each 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, such as without a normal map. `object.setLevelBias(bias)` moves one object's threshold, as Godot's `lod_bias` does: 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. getCurrentLevel and autoUpdate have no match. Far 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. A 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, 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
1532
|
"docs": "concepts/lod",
|
|
1522
|
-
"detect": "new\\s+(THREE\\.)?LOD\\s*\\(|\\.addLevel\\s*\\("
|
|
1533
|
+
"detect": "new\\s+(THREE\\.)?LOD\\s*\\(|\\.addLevel\\s*\\(|\\bSimplifyModifier\\b"
|
|
1523
1534
|
},
|
|
1524
1535
|
{
|
|
1525
1536
|
"id": "mixer",
|
|
@@ -1528,7 +1539,7 @@
|
|
|
1528
1539
|
"status": "changed",
|
|
1529
1540
|
"since": "0.2",
|
|
1530
1541
|
"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 }). 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. loop: false holds the last frame, as clampWhenFinished does. 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 whose weights and time scales the code works out from a speed become playBlend and setBlend, which keep the clips in step. 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 counterpart: call play at that time.",
|
|
1542
|
+
"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 }). 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. setLoop(LoopOnce) becomes loop: false, which holds the last frame, as clampWhenFinished does. 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 whose weights and time scales the code works out from a speed become playBlend and setBlend, which keep the clips in step. 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 counterpart: 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. A 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
1543
|
"docs": "api/animation",
|
|
1533
1544
|
"detect": "\\bAnimationMixer\\b|\\.clipAction\\s*\\(|\\.crossFade(To|From)\\s*\\(|\\.fade(In|Out)\\s*\\(|setEffectiveWeight|\\bmixer\\.update\\s*\\("
|
|
1534
1545
|
},
|
|
@@ -1537,6 +1548,7 @@
|
|
|
1537
1548
|
"category": "Animation",
|
|
1538
1549
|
"three": "AnimationClip / KeyframeTrack built in code",
|
|
1539
1550
|
"status": "changed",
|
|
1551
|
+
"since": "0.2",
|
|
1540
1552
|
"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
1553
|
"notes": "A track names a value of a light, a camera, a material or an object: 'light.intensity', 'light.color', 'camera.fov', a material value that setUniform takes, 'material.uvOffset' or 'material.uvScale' for where its maps sit on the texture coordinates, or 'position', 'rotation', 'scale' and 'visible'. Keys hold a number, two numbers for the offset or the scale of the maps, three for a color, a position or a scale, and four for a rotation. Interpolation: 'linear', 'step' or glTF's cubic spline ('cubic'), and 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, and a material animation changes every object that uses the material. glTF files play their KHR_animation_pointer tracks through the model's animator, with the clip's time, speed, fades and weights: a light's intensity, color and range, a material's values, the offset and scale of a base color or emissive texture's transform, a node's visibility, and a node's transform or morph weights. A material keeps a transform for each of its maps, so a file that moves two of them apart plays both, each 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
1554
|
"docs": "api/animation",
|
|
@@ -1549,7 +1561,7 @@
|
|
|
1549
1561
|
"status": "manual",
|
|
1550
1562
|
"since": "0.2",
|
|
1551
1563
|
"target": "Author the skeleton in a modeling tool and export glTF: const hero = scene.instantiate(await assets.loadGltf(url)); hero.animator().play('walk')",
|
|
1552
|
-
"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).",
|
|
1564
|
+
"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). 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
1565
|
"docs": "api/animation",
|
|
1554
1566
|
"detect": "\\bSkinnedMesh\\b|new\\s+(THREE\\.)?(Skeleton|Bone)\\s*\\("
|
|
1555
1567
|
},
|
|
@@ -1582,7 +1594,7 @@
|
|
|
1582
1594
|
"status": "changed",
|
|
1583
1595
|
"since": "0.2",
|
|
1584
1596
|
"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, into an array. A hit has object, instance (instanceId), point, normal, distance and triangle (faceIndex), and uv (intersection.uv) with hasUv, which says whether the hit triangle has texture coordinates. The layer mask defaults to layer 0 alone, as Raycaster's does, and the whole scene is tested. Hidden objects are never hit. A skinned mesh is tested in its bind pose, not its animated pose. 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. params.Points.threshold and params.Line.threshold become the pointThreshold and lineThreshold options. Sprites, 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.",
|
|
1597
|
+
"notes": "scene.raycast writes the closest hit into a hit object that you create once, and scene.raycastAll writes every hit, nearest first, into an array. A hit has object, instance (instanceId), point, normal, distance and triangle (faceIndex), and uv (intersection.uv) with hasUv, which says whether the hit triangle has texture coordinates. The layer mask defaults to layer 0 alone, as Raycaster's does, and the whole scene is tested. Hidden objects are never hit. A skinned mesh is tested in its bind pose, not its animated pose. 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. 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. Triangles 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. Sprites, 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
1598
|
"docs": "api/raycast",
|
|
1587
1599
|
"detect": "\\bRaycaster\\b|\\.setFromCamera\\s*\\(|\\.intersectObjects?\\s*\\("
|
|
1588
1600
|
},
|
|
@@ -1592,8 +1604,8 @@
|
|
|
1592
1604
|
"three": "DOM pointer, mouse, touch and keyboard listeners",
|
|
1593
1605
|
"status": "changed",
|
|
1594
1606
|
"since": "0.1",
|
|
1595
|
-
"target": "input.pointer, input.isDown('KeyW'), input.wasPressed('Mouse0'), input.touches, input.actions.define(); obj.on('click' | 'pointerdown' | 'pointerup' | 'pointermove' | 'pointerenter' | 'pointerleave', fn)
|
|
1596
|
-
"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. obj.on replaces a canvas listener that raycasts: the closest object under the pointer gets the event, then its parents.",
|
|
1607
|
+
"target": "input.pointer, input.isDown('KeyW'), input.wasPressed('Mouse0'), input.touches, input.actions.define(); obj.on('click' | 'pointerdown' | 'pointerup' | 'pointermove' | 'pointerenter' | 'pointerleave', fn)",
|
|
1608
|
+
"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. 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
1609
|
"docs": "api/input",
|
|
1598
1610
|
"detect": "addEventListener\\s*\\(\\s*['\"](pointer\\w*|mouse\\w*|click|dblclick|touch\\w*|keydown|keyup|wheel|contextmenu)['\"]"
|
|
1599
1611
|
},
|
|
@@ -1604,7 +1616,7 @@
|
|
|
1604
1616
|
"status": "changed",
|
|
1605
1617
|
"since": "0.1",
|
|
1606
1618
|
"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, and mouseButtons and touches take strings such as 'rotate' and 'dolly-pan'. There is no DOM element, dispose
|
|
1619
|
+
"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, and 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. 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. 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. Trackball and Arcball controls have no equivalent. 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
1620
|
"docs": "api/controls",
|
|
1609
1621
|
"detect": "\\b(Orbit|Map|Trackball|Arcball)Controls\\b"
|
|
1610
1622
|
},
|
|
@@ -1615,7 +1627,7 @@
|
|
|
1615
1627
|
"status": "changed",
|
|
1616
1628
|
"since": "0.2",
|
|
1617
1629
|
"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, FirstPersonControls and PointerLockControls. First-person controls take the place of both FirstPersonControls and PointerLockControls: while the canvas holds the pointer lock, the mouse turns the view as PointerLockControls turn it. The page asks for the lock in a click handler with engine.requestPointerLock(), and the sketch reads input.pointer.locked; lock(), unlock(), isLocked and the lock and unlock events have no equivalent. 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.",
|
|
1630
|
+
"notes": "Option names and defaults match FlyControls, FirstPersonControls and PointerLockControls, and the same input gives the camera the same pose. First-person controls take the place of both FirstPersonControls and PointerLockControls: while the canvas holds the pointer lock, the mouse turns the view as PointerLockControls turn it. The page asks for the lock in a click handler with engine.requestPointerLock(), and the sketch reads input.pointer.locked; lock(), unlock(), isLocked and the lock and unlock events have no equivalent. 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. In 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. three.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
1631
|
"docs": "api/controls",
|
|
1620
1632
|
"detect": "\\b(Fly|FirstPerson|PointerLock)Controls\\b"
|
|
1621
1633
|
},
|
|
@@ -1626,7 +1638,7 @@
|
|
|
1626
1638
|
"status": "changed",
|
|
1627
1639
|
"since": "0.3",
|
|
1628
1640
|
"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. There is no DOM element, getHelper or event: the controls make their handles in the scene, report dragging, axis, hovered and state, and update(dt) returns true when it moved something. 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 and showXY, showYZ and showXZ
|
|
1641
|
+
"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, report dragging, axis, hovered and state, and update(dt) returns true when it moved something. 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. dragging and axis replace the dragging-changed, objectChange, mouseDown and mouseUp events of TransformControls. dragging, hovered and state replace the dragstart, drag, dragend, hoveron and hoveroff events of DragControls.",
|
|
1630
1642
|
"docs": "api/controls",
|
|
1631
1643
|
"detect": "\\b(Transform|Drag)Controls\\b"
|
|
1632
1644
|
},
|
|
@@ -1637,10 +1649,21 @@
|
|
|
1637
1649
|
"status": "changed",
|
|
1638
1650
|
"since": "0.1",
|
|
1639
1651
|
"target": "debug.axes, debug.grid, debug.box, debug.sphere, debug.arrow, debug.frustum, debug.light, debug.skeleton",
|
|
1640
|
-
"notes": "Call them in onUpdate: each call draws for one frame. Debug drawing exists in development builds only. debug.grid takes GridHelper's size and divisions. 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. PlaneHelper and PolarGridHelper have no equivalent.",
|
|
1652
|
+
"notes": "Call them in onUpdate: each call draws for one frame. 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. 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. PlaneHelper and PolarGridHelper have no equivalent.",
|
|
1641
1653
|
"docs": "api/debug",
|
|
1642
1654
|
"detect": "\\b(Axes|Grid|PolarGrid|Box|Box3|Arrow|Camera|DirectionalLight|PointLight|SpotLight|HemisphereLight|Skeleton|Plane)Helper\\b"
|
|
1643
1655
|
},
|
|
1656
|
+
{
|
|
1657
|
+
"id": "inspector",
|
|
1658
|
+
"category": "Helpers and debugging",
|
|
1659
|
+
"three": "three.js's Inspector add-on or developer tools extension, or code that walks scene.children to find an object while debugging",
|
|
1660
|
+
"status": "changed",
|
|
1661
|
+
"since": "0.3",
|
|
1662
|
+
"target": "?inspect on the page in a development build; engine.inspect(call, args) from page code; bunx @null3d/cli mcp for a coding agent",
|
|
1663
|
+
"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. 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.",
|
|
1664
|
+
"docs": "guides/debugging",
|
|
1665
|
+
"detect": "__THREE_DEVTOOLS__|from\\s+['\"][^'\"]*/inspector/Inspector(\\.js)?['\"]"
|
|
1666
|
+
},
|
|
1644
1667
|
{
|
|
1645
1668
|
"id": "math-objects",
|
|
1646
1669
|
"category": "Math",
|
|
@@ -1648,7 +1671,7 @@
|
|
|
1648
1671
|
"status": "changed",
|
|
1649
1672
|
"since": "0.1",
|
|
1650
1673
|
"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(), quat.create() or mat4.create(), outside onUpdate. Most names match three.js. 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. three.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, and build setAxisAngle, fromEuler, rotateX, rotateY, rotateZ, slerp, vec3.angle and math.damp with createMath on an exact math library
|
|
1674
|
+
"notes": "Create scratch arrays once with vec3.create(), quat.create() or mat4.create(), outside onUpdate. Most names match three.js, and where three.js has the same operation, a helper does three.js's arithmetic, so the results match. Coordinates are right-handed with +Y up, as in three.js. 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. 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. three.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, and build setAxisAngle, fromEuler, rotateX, rotateY, rotateZ, slerp, vec3.angle and math.damp with createMath on an exact math library.",
|
|
1652
1675
|
"docs": "api/math",
|
|
1653
1676
|
"detect": "new\\s+(THREE\\.)?(Vector[234]|Quaternion|Matrix[34]|Euler|Color|Box[23]|Sphere|Ray|Plane|Frustum|Spherical|Cylindrical)\\s*\\("
|
|
1654
1677
|
},
|
|
@@ -1670,7 +1693,7 @@
|
|
|
1670
1693
|
"status": "direct",
|
|
1671
1694
|
"since": "0.1",
|
|
1672
1695
|
"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. The random helpers draw from math.random, which hold mode seeds. MathUtils.seededRandom(s) becomes math.seed(s) once, then math.random(). smootherstep, pingpong, generateUUID and the power of two helpers have no equivalent. Game rules that a server replays import clamp, lerp and the other exact helpers from @null3d/engine/math/math, build damp with createMath on an exact math library, and draw random numbers from a generator of their own
|
|
1696
|
+
"notes": "Same names and arithmetic. The random helpers draw from math.random, which hold mode seeds. MathUtils.seededRandom(s) becomes math.seed(s) once, then math.random(). smootherstep, pingpong, generateUUID and the power of two helpers have no equivalent. Game rules that a server replays import clamp, lerp and the other exact helpers from @null3d/engine/math/math, build damp with createMath on an exact math library, and draw random numbers from a generator of their own.",
|
|
1674
1697
|
"docs": "api/math",
|
|
1675
1698
|
"detect": "\\bMathUtils\\.\\w+"
|
|
1676
1699
|
},
|
|
@@ -1681,7 +1704,7 @@
|
|
|
1681
1704
|
"status": "changed",
|
|
1682
1705
|
"since": "0.1",
|
|
1683
1706
|
"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.",
|
|
1707
|
+
"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. color.srgbToLinear and color.linearToSrgb convert one component by the same curve as SRGBToLinear and LinearToSRGB.",
|
|
1685
1708
|
"docs": "concepts/color-management",
|
|
1686
1709
|
"detect": "\\.set(Hex|HSL|RGB|Style)\\s*\\("
|
|
1687
1710
|
},
|
|
@@ -1714,7 +1737,7 @@
|
|
|
1714
1737
|
"status": "changed",
|
|
1715
1738
|
"since": "0.2",
|
|
1716
1739
|
"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; blendIntensity becomes intensity, and distanceFallOff is spelled distanceFalloff. It darkens only the ambient light, where GTAOPass darkens the whole image. 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.",
|
|
1740
|
+
"notes": "GTAOPass's search and denoise 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. 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. In 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
1741
|
"docs": "concepts/post-processing",
|
|
1719
1742
|
"detect": "\\b(SSAO|SAO|GTAO|N8AO)(Pass|PostPass)?\\b"
|
|
1720
1743
|
},
|
|
@@ -1780,7 +1803,7 @@
|
|
|
1780
1803
|
"status": "changed",
|
|
1781
1804
|
"since": "0.2",
|
|
1782
1805
|
"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. null3D draws a crisp line of one width in CSS pixels, with no blur. visibleEdgeColor and hiddenEdgeColor become color and hiddenColor. 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. pmndrs OutlineEffect: xRay: false becomes hiddenColor: false, and its edge is one texel of its mask at resolutionScale, so width is about 1 / resolutionScale. For OutlinePass itself, install @null3d/three-compat and call createOutlinePass(ctx, { color, hiddenColor, strength, thickness, glow, pulsePeriod })
|
|
1806
|
+
"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. 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. pmndrs OutlineEffect: xRay: false becomes hiddenColor: false, and its edge is one texel of its mask at resolutionScale, so width is about 1 / resolutionScale. For 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 pattern texture has no setting, 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. One 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, and an effect adds its texture to the scene color; width: 0 drops the crisp line (guides/custom-passes, a soft outline glow).",
|
|
1784
1807
|
"docs": "porting/threejs-postprocessing",
|
|
1785
1808
|
"detect": "\\bOutline(Pass|Effect)\\b"
|
|
1786
1809
|
},
|
|
@@ -1813,7 +1836,7 @@
|
|
|
1813
1836
|
"status": "manual",
|
|
1814
1837
|
"since": "0.2",
|
|
1815
1838
|
"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. 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. 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. A ShaderPass that writes a render target of its own, which a later pass reads, becomes a full-screen pass, with its input image as input: 'sceneColor', or a texture.",
|
|
1839
|
+
"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. 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. A ShaderPass that writes a render target of its own, which a later pass reads, becomes a full-screen pass, with its input image 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
1840
|
"docs": "porting/threejs-postprocessing",
|
|
1818
1841
|
"detect": "\\bShaderPass\\b"
|
|
1819
1842
|
},
|
|
@@ -1835,7 +1858,7 @@
|
|
|
1835
1858
|
"status": "direct",
|
|
1836
1859
|
"since": "0.2",
|
|
1837
1860
|
"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. 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 }): the same order, 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.",
|
|
1861
|
+
"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 }): the same order, 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. The 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
1862
|
"docs": "porting/threejs-postprocessing",
|
|
1840
1863
|
"detect": "\\bLUTPass\\b|\\bLUT(Cube|3dl|Image)Loader\\b"
|
|
1841
1864
|
},
|
|
@@ -1879,7 +1902,7 @@
|
|
|
1879
1902
|
"status": "changed",
|
|
1880
1903
|
"since": "0.2",
|
|
1881
1904
|
"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. 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. For a physical sky with ozone, twilight and haze on distant objects, move to `{ atmosphere }`, which looks different from three.js's sky.",
|
|
1905
|
+
"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. 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. For a physical sky with ozone, twilight and haze on distant objects, move to `{ atmosphere }`, which 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, not a Sky uniform default. The 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
1906
|
"docs": "api/scene",
|
|
1884
1907
|
"detect": "new\\s+Sky(Mesh)?\\s*\\("
|
|
1885
1908
|
},
|
|
@@ -1923,7 +1946,7 @@
|
|
|
1923
1946
|
"status": "changed",
|
|
1924
1947
|
"since": "0.2",
|
|
1925
1948
|
"target": "await scene.createSprites({ count, map, atlas, sizeAttenuation, center })",
|
|
1926
|
-
"notes": "Camera-facing quads drawn 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. Without size attenuation, sizes are in CSS pixels, not a fraction of the view's height. 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.",
|
|
1949
|
+
"notes": "Camera-facing quads drawn 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. 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. 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
1950
|
"docs": "api/sprites",
|
|
1928
1951
|
"detect": "\\bSprite(Material)?\\b"
|
|
1929
1952
|
},
|
|
@@ -1934,18 +1957,18 @@
|
|
|
1934
1957
|
"status": "changed",
|
|
1935
1958
|
"since": "0.2",
|
|
1936
1959
|
"target": "await scene.createPoints({ positions, colors, size, sizeAttenuation, map })",
|
|
1937
|
-
"notes": "Points of one size drawn in one batch as squares that face the camera, 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 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. Raycasts 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.",
|
|
1960
|
+
"notes": "Points of one size drawn in one batch as squares that face the camera, 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 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. Raycasts 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. With 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. PointsMaterial's alphaMap has no counterpart.",
|
|
1938
1961
|
"docs": "api/points",
|
|
1939
1962
|
"detect": "new\\s+(THREE\\.)?Points\\s*\\(|\\bPointsMaterial\\b"
|
|
1940
1963
|
},
|
|
1941
1964
|
{
|
|
1942
1965
|
"id": "lines",
|
|
1943
1966
|
"category": "Sprites, points, lines and labels",
|
|
1944
|
-
"three": "Line / LineSegments / LineLoop / LineBasicMaterial / LineDashedMaterial / Line2 / LineMaterial",
|
|
1967
|
+
"three": "Line / LineSegments / LineLoop / LineBasicMaterial / LineDashedMaterial / Line2 / LineSegments2 / LineMaterial",
|
|
1945
1968
|
"status": "changed",
|
|
1946
1969
|
"since": "0.2",
|
|
1947
1970
|
"target": "await scene.createLines({ positions, colors, mode, width, worldUnits, dashed })",
|
|
1948
|
-
"notes": "Segments between points drawn in one batch as quads with round ends, as Line2 draws them, at any width on every backend. mode 'strip', 'loop' or 'segments' replaces Line, LineLoop and LineSegments, and width replaces linewidth, in CSS pixels or with worldUnits. A one-pixel Line ports as width 1. Point colors are linear RGB, stored at 8 bits per channel. dashed and the dash values replace LineDashedMaterial and computeLineDistances. The call is async, because the first one downloads the line code. lit: true shades lines with the scene's lights. Raycasts 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.",
|
|
1971
|
+
"notes": "Segments between points drawn in one batch as quads with round ends, as Line2 draws them, at any width on every backend. mode 'strip', 'loop' or 'segments' replaces Line, LineLoop and LineSegments, and width replaces linewidth, in CSS pixels or with worldUnits. '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. LineMaterial.resolution needs no counterpart: the engine knows the canvas size. 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. The call is async, because the first one downloads the line code. lit: true shades lines with the scene's lights. Raycasts 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
1972
|
"docs": "api/lines",
|
|
1950
1973
|
"detect": "new\\s+(THREE\\.)?(Line|LineSegments|LineLoop|Line2|LineSegments2)\\s*\\(|\\bLine(Basic|Dashed)?Material\\b|\\bLineGeometry\\b"
|
|
1951
1974
|
},
|
|
@@ -1967,7 +1990,7 @@
|
|
|
1967
1990
|
"status": "changed",
|
|
1968
1991
|
"since": "0.2",
|
|
1969
1992
|
"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
|
|
1993
|
+
"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 neighbours more than one level apart. 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 neighbours at a boundary. Every pixel lights from normals baked over the whole ground, so the far hills keep their relief. The terrain carries no collision, so 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
1994
|
"docs": "api/terrain",
|
|
1972
1995
|
"detect": "\\bImprovedNoise\\b|\\bgenerateHeight\\b|\\bgetHeightAt\\b"
|
|
1973
1996
|
},
|
|
@@ -1978,7 +2001,7 @@
|
|
|
1978
2001
|
"status": "changed",
|
|
1979
2002
|
"since": "0.3",
|
|
1980
2003
|
"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. 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 as the forest demo does. Draw each species' copies as one instance batch, so the engine gives them levels of detail and culling. For wind, replace the three.js shader's sway with one custom material whose vertex offset reads the wind add-on's field, as
|
|
2004
|
+
"notes": "null3D ships no plant generator. 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, as the forest demo that api/wind names does. Draw each species' copies as one instance batch, so the engine gives them levels of detail and culling. 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
2005
|
"docs": "api/wind",
|
|
1983
2006
|
"detect": "\\b(Tree|Foliage|Vegetation)(Generator|Factory)\\b|\\bSapling\\b|\\bez-tree\\b"
|
|
1984
2007
|
},
|
|
@@ -2008,10 +2031,10 @@
|
|
|
2008
2031
|
"id": "xr",
|
|
2009
2032
|
"category": "Other",
|
|
2010
2033
|
"three": "WebXR (renderer.xr, VRButton, ARButton)",
|
|
2011
|
-
"status": "
|
|
2034
|
+
"status": "unsupported",
|
|
2012
2035
|
"since": null,
|
|
2013
2036
|
"target": "None",
|
|
2014
|
-
"notes": "
|
|
2037
|
+
"notes": "null3D has no WebXR support. Keep an XR view in three.js.",
|
|
2015
2038
|
"docs": "porting/threejs-unsupported",
|
|
2016
2039
|
"detect": "\\.xr\\.|\\b(VR|AR|XR)Button\\b|XRControllerModelFactory"
|
|
2017
2040
|
},
|
|
@@ -2030,11 +2053,11 @@
|
|
|
2030
2053
|
"id": "audio",
|
|
2031
2054
|
"category": "Other",
|
|
2032
2055
|
"three": "Audio / PositionalAudio / AudioListener / AudioLoader",
|
|
2033
|
-
"status": "
|
|
2034
|
-
"since":
|
|
2035
|
-
"target": "
|
|
2036
|
-
"notes": "
|
|
2037
|
-
"docs": "
|
|
2056
|
+
"status": "changed",
|
|
2057
|
+
"since": "0.3",
|
|
2058
|
+
"target": "@null3d/sound: createSound in the sketch, connectSound on the page",
|
|
2059
|
+
"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. 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. AudioLoader has no counterpart: name the file by its address, and the page loads it once the user starts the sound. An AudioAnalyser has no counterpart; analyze the page's own Web Audio.",
|
|
2060
|
+
"docs": "api/sound",
|
|
2038
2061
|
"detect": "\\b(PositionalAudio|AudioListener|AudioLoader|AudioAnalyser)\\b"
|
|
2039
2062
|
},
|
|
2040
2063
|
{
|
|
@@ -2044,7 +2067,7 @@
|
|
|
2044
2067
|
"status": "changed",
|
|
2045
2068
|
"since": "0.1",
|
|
2046
2069
|
"target": "Keep the panel on the page; send changes with engine.postToSketch and receive them with page.onMessage",
|
|
2047
|
-
"notes": "",
|
|
2070
|
+
"notes": "For values that you only tune while you develop, the ?inspect panel of a development build changes transforms and material values with no code of your own (guides/debugging).",
|
|
2048
2071
|
"docs": "api/page",
|
|
2049
2072
|
"detect": "\\blil-gui\\b|\\bdat\\.gui\\b|new\\s+GUI\\s*\\("
|
|
2050
2073
|
},
|
|
@@ -2055,7 +2078,7 @@
|
|
|
2055
2078
|
"status": "changed",
|
|
2056
2079
|
"since": "0.1",
|
|
2057
2080
|
"target": "Run the physics library in the sketch worker; copy body transforms into dynamic arrays after each step",
|
|
2058
|
-
"notes": "
|
|
2081
|
+
"notes": "null3D has no physics API. WebAssembly physics builds run in workers.",
|
|
2059
2082
|
"docs": "guides/physics",
|
|
2060
2083
|
"detect": "from\\s+['\"](cannon-es|cannon|@dimforge/rapier3d(-compat)?|ammo\\.js|oimo|@react-three/rapier|@react-three/cannon)['\"]"
|
|
2061
2084
|
},
|
|
@@ -2077,7 +2100,7 @@
|
|
|
2077
2100
|
"status": "manual",
|
|
2078
2101
|
"since": "0.1",
|
|
2079
2102
|
"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.",
|
|
2103
|
+
"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 engine.labels.bind on the page. drei's ContactShadows, a blurred shadow on a ground plane, has no counterpart; the directional light's contact shadows are another technique. Mesh events such as onClick and onPointerEnter become obj.on('click') and obj.on('pointerenter'). React 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. onPointerMissed has no equivalent: set a flag in click handlers, and treat input.wasReleased('Mouse0') without it as a miss.",
|
|
2081
2104
|
"docs": "api/page",
|
|
2082
2105
|
"detect": "from\\s+['\"]@react-three/(fiber|drei)['\"]|\\buseFrame\\s*\\("
|
|
2083
2106
|
},
|
|
@@ -2103,6 +2126,17 @@
|
|
|
2103
2126
|
"docs": "api/sketch",
|
|
2104
2127
|
"detect": "\\bdocument\\.(getElementById|querySelector|querySelectorAll|body|createElement)\\b|\\bwindow\\.(innerWidth|innerHeight|devicePixelRatio|addEventListener)\\b"
|
|
2105
2128
|
},
|
|
2129
|
+
{
|
|
2130
|
+
"id": "vite-build",
|
|
2131
|
+
"category": "Other",
|
|
2132
|
+
"three": "vite.config.js (the app built with Vite)",
|
|
2133
|
+
"status": "changed",
|
|
2134
|
+
"since": "0.1",
|
|
2135
|
+
"target": "`plugins: [null3d()]` in vite.config.ts, with `null3d` imported from `@null3d/vite-plugin`",
|
|
2136
|
+
"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. A one-file trial can load the engine from a CDN instead.",
|
|
2137
|
+
"docs": "getting-started/install",
|
|
2138
|
+
"detect": "from\\s+['\"]vite['\"]"
|
|
2139
|
+
},
|
|
2106
2140
|
{
|
|
2107
2141
|
"id": "worker",
|
|
2108
2142
|
"category": "Other",
|