Skip to content

armgit / 67.js

Public Imported from GitHub
0

3D engine that AI agents drive

Merge remote-tracking branch 'origin/main' into HEAD

Nguyen Xuan An8d20852930b6
diff --cc CHANGELOG.md
index 4d738c63,8d2373d0..7534a5ad
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@@ -2,11 -2,12 +2,14 @@@
## Unreleased
+- Add spot lights (`environment.spotLights`, 8), rectangular area lights (`environment.areaLights`, 4) and shadows for point and spot lights (`castShadow: true`). Intensity of a spot light is candela, as for a point light, with Blender's cone mask. Area lights use a representative point, within 1.2 percent of Cycles on the axis. Shadows share one 2048 x 3072 depth atlas of 24 tiles (24 MiB, allocated on first use): a point light takes 6 and a spot light 1, and a request for more is an error. The shader code and the atlas exist only in a scene that uses them. Recipes get all of it through `set-environment`, the MCP schema and `scene_capabilities` (`maxSpotLights`, `maxAreaLights`, `localShadows`). Cascaded directional shadows and light linking are not part of this
+
+ - Add ten cutting and repair edits: `fill_holes`, `dissolve_faces`, `dissolve_edges`, `dissolve_verts`, `dissolve_limited`, `bisect_plane` (with `fill`, `clearInner`, `clearOuter`), `bridge_edge_loops` (with `segments`), `subdivide_edges`, `grid_fill` and `knife_project`. Each tags what it makes, and the edge rule `{ "open": true }` picks boundary edges. The lint message for an open boundary now suggests `fill_holes`. 18 new cases match Blender in counts, face sizes, area, volume and positions; the knife is compared only with a straight plane cut and differs where a face runs along the projection direction
+ - Export textures, skeletons and clips to GLB: `exportGlb(parts, { nodes, clips, maxTextureSize })` now writes `map`, `normalMap`, `metallicRoughnessMap`, `occlusionMap` and `emissiveMap` as embedded PNG (limit 2048 px by default, with an error that names the option), skins with joint nodes and inverse bind matrices, and animation clips (translation, rotation and scale tracks; SMOOTH becomes cubic with zero tangents). Pattern materials export their baked textures with box projected UVs, so the picture matches without `uv_unwrap`. It previously threw on skins and on every texture channel. The `entry:core` size budget goes from 67,100 to 70,500 bytes gzip (+3,400)
+ - Make the first frame and the SwiftShader frame cost less, with the same pixels. The main fragment shader now compiles only the features that a scene uses (maps, splat layers, moss, alpha and the special material tags), and a part that needs another feature later recompiles it. All programs, with the environment prefilter, now start together and use `KHR_parallel_shader_compile`. On an RTX 3060 the first frame went from 3.7 to 4.4 seconds down to 0.5 to 1.0 seconds, and a SwiftShader frame costs 0.4 to 0.5 times what it did. `bench/runtime/PROFILE.md` has the profile
+ - Add `subdivide` as a mesh edit and stack node: Catmull-Clark subdivision to 4 levels with semi-sharp creases picked by an edge rule, sharp boundaries, kept corners, n-gon support, and tags, UVs and edge attributes carried through each level. The size is checked before it allocates. Counts, area and positions match Blender at levels 1 to 3; the `pebble` task joins the agent modeling suite
- Remove `67js/addons/film` from the npm package. It held the 187-second trailer demo with its baked physics recording, 75 KB gzip of the archive. Nothing else in the package used it. To keep using it, copy `src/film.js`, `src/film-rig.js`, `src/film-character.js`, `src/film-physics-definition.js` and `src/film-physics-clip.json` from the repository, or read the trailer on the site at `/film.html`. The archive goes from 901,314 to 829,085 bytes
- Remove three.js from modeling and the agent scene: `lathe`, `extrude` and `tube` no longer import it, and `scene:agent-scene` drops from 185,681 to 117,290 bytes gzip. `lathe` and `tube` output is identical to before, vertex for vertex. `extrude` walls, bevels, UVs, normals and bounds are identical, and volume matches within 1e-4. Extrusion caps use a new ear-clipping triangulation, so a cap can split along other diagonals, and a cap with collinear points can add or drop a seam vertex. A clockwise hole under a clockwise contour is now flipped to face outward, where it used to keep inward walls
- - Make the first frame and the SwiftShader frame cost less, with the same pixels. The main fragment shader now compiles only the features that a scene uses (maps, splat layers, moss, alpha and the special material tags), and a part that needs another feature later recompiles it. All programs, with the environment prefilter, now start together and use `KHR_parallel_shader_compile`. On an RTX 3060 the first frame went from 3.7 to 4.4 seconds down to 0.5 to 1.0 seconds, and a SwiftShader frame costs 0.4 to 0.5 times what it did. `bench/runtime/PROFILE.md` has the profile
- Load glTF without Three.js: the addon has its own GLB and glTF parser, node sampler and animation clips, so a box with the addon drops from 159,422 to 67,467 bytes gzip. Draco, meshopt and KTX2 still come from the decoders you pass in `options.decoders`. Only the default scene is decoded, and a node outside it is decoded only when a skin or an animation names it
- Remove three.js from modeling and the agent scene: `lathe`, `extrude` and `tube` no longer import it, and `scene:agent-scene` drops from 185,681 to 117,290 bytes gzip. `lathe` and `tube` output is identical to before, vertex for vertex. `extrude` walls, bevels, UVs, normals and bounds are identical, and volume matches within 1e-4. Extrusion caps use a new ear-clipping triangulation, so a cap can split along other diagonals, and a cap with collinear points can add or drop a seam vertex. A clockwise hole under a clockwise contour is now flipped to face outward, where it used to keep inward walls
- Remove three.js and three-mesh-bvh from mesh queries, shrinkwrap and surface patches: a typed-array BVH and its own triangle tests replace them, so no source file in `src/` except the benchmark page imports three.js and the npm archive drops from 856,115 to 798,532 bytes. `entry:mesh-query` drops from 85,555 to 15,535 bytes gzip, `entry:shrinkwrap` from 86,779 to 17,860 and `entry:surface` from 72,974 to 9,838. Nearest, project, raycast and pair results match three-mesh-bvh on fixtures and random queries. Nearest queries on 100k triangles are about 20 percent slower and a pair query with one mesh shifted against itself is slower (21 ms against 2 ms), while a closed-solid pair is 2.4 times faster. The surface patch clipper follows DecalGeometry and keeps its triangle order
diff --cc bench/size/baseline.json
index 3d451328,ca31621c..05fb5094
--- a/bench/size/baseline.json
+++ b/bench/size/baseline.json
@@@ -14,9 -14,9 +14,9 @@@
},
"bundles": {
"entry:core": {
- "min": 232549,
- "gzip": 65747,
- "brotli": 56178
- "min": 248050,
- "gzip": 71388,
- "brotli": 60992
++ "min": 261051,
++ "gzip": 74713,
++ "brotli": 63726
},
"entry:model": {
"min": 40093,
@@@ -39,9 -39,9 +39,9 @@@
"brotli": 7331
},
"entry:gltf": {
- "min": 139564,
- "gzip": 43172,
- "brotli": 37021
- "min": 140408,
- "gzip": 43596,
- "brotli": 37426
++ "min": 145701,
++ "gzip": 44953,
++ "brotli": 38503
},
"entry:modeling": {
"min": 15517,
@@@ -129,14 -129,14 +129,14 @@@
"brotli": 762
},
"entry:agent-scene": {
- "min": 292317,
- "gzip": 93166,
- "brotli": 80011
- "min": 328160,
- "gzip": 104607,
- "brotli": 89453
++ "min": 338801,
++ "gzip": 107187,
++ "brotli": 91567
},
"entry:agent-asset": {
- "min": 318835,
- "gzip": 100520,
- "brotli": 85995
- "min": 354678,
- "gzip": 111950,
- "brotli": 95555
++ "min": 365325,
++ "gzip": 114605,
++ "brotli": 98079
},
"entry:hdri": {
"min": 8075,
@@@ -144,19 -144,19 +144,19 @@@
"brotli": 2801
},
"scene:lit-box": {
- "min": 178412,
- "gzip": 48762,
- "brotli": 41832
- "min": 181287,
- "gzip": 49762,
- "brotli": 42779
++ "min": 194282,
++ "gzip": 53065,
++ "brotli": 45377
},
"scene:gltf-box": {
- "min": 235553,
- "gzip": 67467,
- "brotli": 58083
- "min": 238435,
- "gzip": 68451,
- "brotli": 59082
++ "min": 251444,
++ "gzip": 71774,
++ "brotli": 61619
},
"scene:agent-scene": {
- "min": 384588,
- "gzip": 117290,
- "brotli": 100238
- "min": 422469,
- "gzip": 129348,
- "brotli": 110393
++ "min": 437383,
++ "gzip": 133081,
++ "brotli": 113464
}
}
}
diff --cc bench/size/budgets.json
index 74051c91,4a003581..1524ddf8
--- a/bench/size/budgets.json
+++ b/bench/size/budgets.json
@@@ -5,18 -5,18 +5,18 @@@
"agent-scene": 100000
},
"budgets": {
- "entry:core": 70130,
- "entry:core": 72900,
++ "entry:core": 76300,
"entry:model": 14400,
"entry:nature": 13200,
"entry:motion": 13600,
"entry:canvas2d": 9400,
- "entry:gltf": 45050,
- "entry:gltf": 44500,
++ "entry:gltf": 45900,
"entry:modeling": 6600,
"entry:sculpt": 2500,
- "entry:surface": 74500,
- "entry:mesh-query": 87300,
- "entry:mesh": 33500,
- "entry:shrinkwrap": 88600,
+ "entry:surface": 10100,
+ "entry:mesh-query": 15900,
+ "entry:mesh": 44700,
+ "entry:shrinkwrap": 18300,
"entry:surface-attachment": 11800,
"entry:physics": 16500,
"entry:spume": 9000,
@@@ -28,11 -28,11 +28,11 @@@
"entry:grass": 4400,
"entry:clutter": 5300,
"entry:texture-set": 900,
- "entry:agent-scene": 96320,
- "entry:agent-asset": 103700,
- "entry:agent-scene": 106700,
- "entry:agent-asset": 114200,
++ "entry:agent-scene": 109400,
++ "entry:agent-asset": 116900,
"entry:hdri": 3300,
- "scene:lit-box": 53165,
- "scene:gltf-box": 71874,
- "scene:agent-scene": 122195
- "scene:lit-box": 50800,
- "scene:gltf-box": 69900,
- "scene:agent-scene": 132000
++ "scene:lit-box": 54200,
++ "scene:gltf-box": 73300,
++ "scene:agent-scene": 135800
}
}