3D engine that AI agents drive
Release 0.4.0 authoring and animation foundation
Nguyen Xuan An286eb4d3e7c5
diff --git a/.gitignore b/.gitignoreindex 35de688d..8377066b 100644--- a/.gitignore+++ b/.gitignore@@ -30,3 +30,7 @@ artifacts/*.log.agents/build-browser/+public/camera-path.md+public/lighting.md+public/volumetric.md+public/film-physics.mddiff --git a/CHANGELOG.md b/CHANGELOG.mdindex 6f8099ff..8f078067 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -1,6 +1,12 @@# Changelog-## Unreleased+## 0.4.0++- Add four-influence GPU skinning, relative position/normal morphs and glTF morph weight animation.+- Add camera paths, local lights and depth-clipped volumetric fog.+- Add optional recorded Rapier physics with contacts, joint limits and bounded motors.+- Add static sculpt brushes and projector-clipped surface patches with geometric clearance.+- Preserve opaque vertex colors, UVs and independent HDR emission in static GLB exports.- Add bounded nearest-surface and directional shrinkwrap with counted queries, atomic output and shared normal reconstruction.- Add owned, bounded BVH mesh queries for static surface contact, ray hits and validated closed-solid containment.diff --git a/README.md b/README.mdindex 2b88de0a..7b90867d 100644--- a/README.md+++ b/README.md@@ -157,24 +157,24 @@ renderer.render({ eye: [4, 3, 7], target: [0, 1.5, 0], assemblyAmount: 0.5 });The core exports animation helpers, camera views and effect presets. `renderer.updateParts(parts)` uploads changes without replacing geometry buffers.The current source adds [camera paths](docs/camera-path.md) with cubic moves, target tracking, roll and focal-length conversion.-It also adds [local lighting](docs/lighting.md) with eight point lights and separate key, fill and ambient controls. These controls remain source-only until the next package release.+It also adds [local lighting](docs/lighting.md) with eight point lights and separate key, fill and ambient controls. These controls are available from version `0.4.0`.The source also adds [depth-clipped volume fog](docs/volumetric.md) with directional scattering, shadow occlusion and deterministic density drift. It requires an opaque HDR renderer with resolved depth enabled.-These camera helpers are not included in the published `0.3.3` package yet.+These camera helpers are available from version `0.4.0`.The current source also adds [GPU skinning](docs/skinning.md) and skeletal GLB import, with four influences per vertex.The optional [physics addon](docs/physics.md) records Rapier contacts, articulated joints, hinge and slider limits, and bounded motors into a timeline for repeatable film seeks.It requires the separate `@dimforge/[email protected]` dependency. The core does not import or bundle that solver.-Physics is source-only and is not included in the published `0.3.3` package.+The physics addon is available from version `0.4.0`.The source trailer includes an [offline physics recording](docs/film-physics.md) of colliding pendulums, played through retained animation tracks without loading a solver in the browser.-The source renderer also supports [relative GPU morph targets](docs/morph-targets.md) for position and normal changes before skinning, including deterministic eyelid animation in the film. This feature is not in the published `0.3.3` package.+The source renderer also supports [relative GPU morph targets](docs/morph-targets.md) for position and normal changes before skinning, including deterministic eyelid animation in the film. This feature is available from version `0.4.0`.The source [glTF morph bridge](docs/gltf-morph.md) preserves relative targets, independent instance weights and linear, step or cubic weight animations.The source [GLB exporter](docs/export-glb.md) preserves opaque vertex colors, UVs and independent HDR emission alongside static morph snapshots.-Source-only [sculpt brushes](docs/sculpt.md) apply bounded inflation, directional displacement and neighborhood smoothing through serializable strokes.+[Sculpt brushes](docs/sculpt.md) apply bounded inflation, directional displacement and neighborhood smoothing through serializable strokes.The [surface patch addon](docs/surface.md) clips a badge onto a curved mesh with geometric clearance and follows its retained rigid transform.-Source-only [mesh queries](docs/mesh-query.md) use owned BVH indices to detect boundary contact, ray hits and containment between validated closed solids.+[Mesh queries](docs/mesh-query.md) use owned BVH indices to detect boundary contact, ray hits and containment between validated closed solids.Surface contact does not measure penetration depth or diagnose z-fighting. Queries accept static geometry and explicit affine transforms.The [primitive contract](docs/primitives.md) defines bounded subdivision counts and exact seam closure for mesh validation.The source [shrinkwrap addon](docs/shrinkwrap.md) wraps static vertices with nearest-surface or directional projection queries, preserving topology and UVs.@@ -185,7 +185,7 @@ The [optional asset addon](docs/gltf.md) loads glTF/GLB meshes, base-color textuIt uses Three.js as a decoder. The core renderer and standalone module remain separate from this dependency.-Skinning, morph targets, transparent materials, compressed assets and ray tracing remain outside this release.+Transparent materials, compressed assets and ray tracing remain unsupported.Blender-level realism remains a visual target. 67.js does not provide Three.js API compatibility.## Creditsdiff --git a/docs/camera-path.md b/docs/camera-path.mdindex f5e588cb..a329bd64 100644--- a/docs/camera-path.md+++ b/docs/camera-path.md@@ -1,6 +1,6 @@# Camera paths-This API exists in the current source checkout. The published `0.3.3` package does not include it yet.+Available from version `0.4.0`.`createCameraPath` samples camera position, target, vertical field of view and roll at an absolute time.The trailer uses this API for every shot. Its atom and gadget shots use curved camera moves.@@ -67,7 +67,7 @@ A parallel up vector fails explicitly. This API does not choose a replacement or## Framing a perspective camera-`fitPerspectiveDistance(bounds, view, aspect, padding = 1.15)` returns an eye-to-target distance that contains all eight corners of a world-space axis-aligned box. It preserves the camera direction, up vector and vertical field of view. The target remains the caller's choice; use the bounds center when framing a subject.+`fitPerspectiveDistance(bounds, view, aspect, padding = 1.15)` returns an eye-to-target distance that contains all eight corners of a world-space axis-aligned box. It preserves the camera direction, up vector and vertical field of view. The caller chooses the target. The bounds center provides a target for framing a subject.```jsimport { fitPerspectiveDistance } from '67js';@@ -82,7 +82,7 @@ view.eye = view.target.map((component, axis) => component + direction[axis] / lerenderer.render(view);```-Padding applies to horizontal and vertical projected extents. The helper uses `fov = 45`, `near = 0.1` and `far = 100` when omitted, matching ordinary renderer projection defaults. World scenes using a different far plane must supply it explicitly. Invalid bounds, degenerate orientation, impossible clipping and fitted eyes that collapse after Float32 rounding throw. Large world coordinates need a local origin; the helper cannot restore precision lost by GPU matrices.+Padding applies to horizontal and vertical projected extents. The helper uses `fov = 45`, `near = 0.1` and `far = 100` when omitted, matching ordinary renderer projection defaults. World scenes using a different far plane must supply it explicitly. Invalid bounds, degenerate orientation, impossible clipping and fitted eyes that collapse after Float32 rounding throw. Large world coordinates need a local origin. The helper cannot restore precision lost by GPU matrices.The film addon accepts `sampleFilm(time, { aspect })`, defaulting to the authored 16:9 ratio. Narrow portrait shots keep their lens and blend toward centered subject framing as the aspect approaches square. Other narrow shots widen vertical field of view to retain authored horizontal coverage. Wide layouts retain the original camera. This is shot-specific framing, not automatic detection of subjects, animated bounds or occlusion.diff --git a/docs/export-glb.md b/docs/export-glb.mdindex be2a42ea..e952100f 100644--- a/docs/export-glb.md+++ b/docs/export-glb.md@@ -4,7 +4,7 @@`downloadGlb(parts)` saves that same snapshot through the browser.The exporter stores each part matrix as a root node transform.It preserves shared geometry accessors and shared meshes when materials match.-The extended channels and HDR emission exist in the source checkout, but not in the published `0.3.3` package.+Available from version `0.4.0`.```jsconst geometry = box();diff --git a/docs/film-physics.md b/docs/film-physics.mdindex 2fe6d9a0..ee1cdfec 100644--- a/docs/film-physics.md+++ b/docs/film-physics.md@@ -1,7 +1,7 @@# Physics in the trailerThe opening apparatus shot now includes a five-ball cradle driven by recorded rigid-body contacts and revolute joints.-This exists in the source checkout and next build. Published package `0.3.3` and the deployed film do not include it yet.+Available from version `0.4.0`.## Authoring and playbackdiff --git a/docs/gltf-morph.md b/docs/gltf-morph.mdindex 7076a46f..3f3b958c 100644--- a/docs/gltf-morph.md+++ b/docs/gltf-morph.md@@ -3,7 +3,7 @@`parseGltf` imports relative `POSITION` and `NORMAL` morph targets into existing renderer parts.The bridge uses the installed Three.js `GLTFLoader` and `AnimationMixer` for decoding and interpolation.Each imported part exposes a retained `part.morph.weights` Float32 array.-This feature is available in the source checkout and next library build, but not in the published `0.3.3` package.+Available from version `0.4.0`.The source renderer applies the imported targets on the GPU before skeletal deformation.```jsdiff --git a/docs/gltf.md b/docs/gltf.mdindex 1b652b78..88ce5ef5 100644--- a/docs/gltf.md+++ b/docs/gltf.md@@ -105,7 +105,7 @@ renderer.render(camera);Translation, rotation, and scale tracks are supported.The importer rejects animation poses that become singular or change triangle winding.-The current source supports four-influence [GPU skinning](skinning.md). The published `0.3.3` package still supports rigid animation only.+The current source supports four-influence [GPU skinning](skinning.md). GPU skinning is available from version `0.4.0`.The current source also supports relative POSITION/NORMAL morph targets and weight animations. See [morph import](gltf-morph.md).Morph primitives require authored base normals. TANGENT targets and per-target flat normal generation remain unsupported.diff --git a/docs/guide.md b/docs/guide.mdindex 0b79916d..67d84b60 100644--- a/docs/guide.md+++ b/docs/guide.md@@ -274,7 +274,7 @@ Core exports are available from `67js`:`67js/addons/canvas2d`: 2D recipes. `67js/addons/gltf`: optional asset decoding. These are separate imports to keep the core smaller.-67.js targets WebGL2. The published `0.3.3` package does not include the newer source APIs below. Check the installed package version and release metadata before using them.+67.js targets WebGL2. Version `0.4.0` includes the APIs below. Check the installed package version and release metadata before using them.## Current source additionsdiff --git a/docs/lighting.md b/docs/lighting.mdindex f5bd51df..3ade73cd 100644--- a/docs/lighting.md+++ b/docs/lighting.md@@ -1,6 +1,6 @@# Local lighting-These controls exist in the source checkout and next library build. Published version `0.3.3` does not include them yet.+Available from version `0.4.0`.`Renderer67` accepts lighting in its existing `environment` option. `frame.environment` overrides selected fields for each frame. Lights use world-space positions and linear RGB colors. Use meters consistently when authoring a physically scaled scene.diff --git a/docs/modeling.md b/docs/modeling.mdindex 64742093..2c1d9a34 100644--- a/docs/modeling.md+++ b/docs/modeling.md@@ -1,6 +1,6 @@# Profile, contour and path modeling-These tools are available in the current source. They are not in the published 0.3.3 package.+Available from version `0.4.0`.The optional modeling entry uses the installed Three.js geometry algorithms and converts their output to 67.js meshes.The core renderer does not import the modeling addon.diff --git a/docs/morph-targets.md b/docs/morph-targets.mdindex fb7bc45b..09930ff2 100644--- a/docs/morph-targets.md+++ b/docs/morph-targets.md@@ -2,7 +2,7 @@The source renderer blends relative position and normal targets on the GPU before skinning.Color, benchmark and shadow passes share the same target texture and committed weights.-This source feature is not yet in the published npm release. The source [glTF bridge](gltf-morph.md) imports relative targets and weight animations.+Available from version `0.4.0`. The source [glTF bridge](gltf-morph.md) imports relative targets and weight animations.The core module exports `createMorphPose` and `MAX_MORPH_TARGETS` without adding a dependency.Each morph target contains mesh-local changes from the base geometry.diff --git a/docs/physics.md b/docs/physics.mdindex 6961d266..5bcab942 100644--- a/docs/physics.md+++ b/docs/physics.md@@ -3,7 +3,7 @@This optional addon uses Rapier 3D to bake collisions and joint motion into a timeline.Scene playback can seek forward or backward without changing the simulation.The main renderer does not need Rapier for playback.-This API is available in the current source checkout and is not included in the published `0.3.3` package.+Available from version `0.4.0`.The library build exports it through `67js/addons/physics` when using the npm alias.Rapier is an optional peer dependency and remains outside the core and library archive.diff --git a/docs/primitives.md b/docs/primitives.mdindex 0b34704b..08de52da 100644--- a/docs/primitives.md+++ b/docs/primitives.md@@ -1,6 +1,6 @@# Primitive shape and resource bounds-These constructor guards and exact closed seams are available in the current source, after published version 0.3.3.+Available from version `0.4.0`.```jsimport { box, sphere, cylinder, torus } from '@codepawlhq/67js';diff --git a/docs/release-verification.md b/docs/release-verification.mdindex 3964cc64..25f3618f 100644--- a/docs/release-verification.md+++ b/docs/release-verification.md@@ -1,5 +1,30 @@# Release verification+## 0.4.0++The source validation used Windows Chrome, ANGLE D3D11 and an RTX 3060.+Publication and deployment require separate registry and live release checks.++| Check | Measured result |+| --- | --- |+| Node tests | 295 tests passed for the complete source before release preparation. |+| Consumer | The packed package imported every addon, including physics, mesh queries and shrinkwrap. |+| Shrinkwrap | All 1,617 source vertices matched the target in nearest and projection modes at landscape and portrait sizes. |+| GPU morph reuse | The computed projection and GPU morph endpoint produced identical pixels. Reverse seeks reproduced the original pixels without graphics errors. |+| Contact query | Both wrapped fixture meshes remained separate from the target in triangle surface queries. This does not certify arbitrary meshes. |+| Query work | Projection used 12,337 triangle callbacks after pruning, compared with 25,416 before pruning on the same fixture. |+| Nearest query | 96 queries on a 4,992-triangle fixture matched exhaustive scan distances and points exactly. |+| Build | The library, website and clean packed consumer passed. |++Nearest query timings were 45.07 ms for index construction and 9.40 ms for 96 queries.+An exhaustive scan took 33.43 ms for the same queries.+These fixture measurements do not prove a general performance advantage over Three.js.+Build the index once and reuse it.++Shrinkwrap accepts static geometry and preserves topology. Clearance applies at vertices and does not guarantee separation over entire triangles.+Physics recordings do not provide humanoid ragdoll binding. Transparent materials, compressed meshes and ray tracing remain unsupported.+The procedural scientist still needs a recognizable face and improved cinematic presentation.+## 0.3.3These checks used Windows Chrome, ANGLE D3D11 and an RTX 3060.diff --git a/docs/scene-graph.md b/docs/scene-graph.mdindex 92ade6f4..3cabe37f 100644--- a/docs/scene-graph.md+++ b/docs/scene-graph.md@@ -1,6 +1,6 @@# Scene graph-This API is available in the current source. It is not in the published 0.3.3 package.+Available from version `0.4.0`.`createSceneGraph(definitions, options)` builds named nodes with retained local and world matrices.Each definition can refer to its parent by name, even when the parent appears later in the array.diff --git a/docs/sculpt.md b/docs/sculpt.mdindex 4857e369..c41e2a51 100644--- a/docs/sculpt.md+++ b/docs/sculpt.md@@ -1,6 +1,6 @@# Sculpt with brush data-Available in the current source, after published version 0.3.3. The optional addon does not add Three.js to the core renderer.+Available from version `0.4.0`. The optional addon does not add Three.js to the core renderer.```jsimport { sphere } from '@codepawlhq/67js';diff --git a/docs/shrinkwrap.md b/docs/shrinkwrap.mdindex aa867f7e..afa42626 100644--- a/docs/shrinkwrap.md+++ b/docs/shrinkwrap.md@@ -176,4 +176,4 @@ const morph = createMorphPose(1);Intermediate shapes need their own collision checks.Safe endpoints do not prove that an interpolated mesh avoids every obstacle.-These APIs are available in the source build. The published `0.3.3` npm package does not include them.+Available from version `0.4.0`.diff --git a/docs/skinning.md b/docs/skinning.mdindex 3a47218e..c790e3f1 100644--- a/docs/skinning.md+++ b/docs/skinning.md@@ -1,6 +1,6 @@# GPU skeletal deformation-This API exists in the current source checkout. The published `0.3.3` package does not include it yet.+Available from version `0.4.0`.`Renderer67` deforms skinned vertices in its color, shadow, and benchmark vertex shaders.The implementation uses four normalized influences per vertex and a mesh-local joint palette.diff --git a/docs/surface.md b/docs/surface.mdindex f8134694..4b8542b0 100644--- a/docs/surface.md+++ b/docs/surface.md@@ -1,6 +1,6 @@# Fit a patch to a curved surface-Available in the current source, after published version 0.3.3. The optional addon reuses Three.js DecalGeometry without adding it to the core renderer.+Available from version `0.4.0`. The optional addon reuses Three.js DecalGeometry without adding it to the core renderer.```jsimport { sphere } from '@codepawlhq/67js';diff --git a/docs/volumetric.md b/docs/volumetric.mdindex 9048b7d3..d66d5f0b 100644--- a/docs/volumetric.md+++ b/docs/volumetric.md@@ -1,6 +1,6 @@# Depth-clipped volume fog-This API exists in the source checkout and next library build. Published version `0.3.3` does not include it yet.+Available from version `0.4.0`.Enable `{ hdr: true, depth: true }` when constructing an opaque, non-benchmark `Renderer67`. Active fog requires WebGL 2 `EXT_color_buffer_float`. Unsupported HDR negotiation rejects active fog. The depth option retains a resolved depth texture across frames and includes it in `memoryPlan`.diff --git a/package-lock.json b/package-lock.jsonindex 1fd6a028..a74b9cf6 100644--- a/package-lock.json+++ b/package-lock.json@@ -1,12 +1,12 @@{"name": "@codepawlhq/67js",- "version": "0.3.3",+ "version": "0.4.0","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "@codepawlhq/67js",- "version": "0.3.3",+ "version": "0.4.0","license": "MIT","devDependencies": {"@codepawlhq/orglet-ui": "0.2.1",diff --git a/package.json b/package.jsonindex 827d6c9f..18474177 100644--- a/package.json+++ b/package.json@@ -1,6 +1,6 @@{"name": "@codepawlhq/67js",- "version": "0.3.3",+ "version": "0.4.0","private": false,"type": "module","description": "A browser graphics engine for interactive worlds, animation and cinematic media, with memory-aware CPU/GPU export",diff --git a/public/llms.txt b/public/llms.txtindex 52256f2e..0f0f64b1 100644--- a/public/llms.txt+++ b/public/llms.txt@@ -73,7 +73,7 @@ Report estimates separately from observed process metrics. Reduce resolution, MS67.js currently uses WebGL2. It is not API-compatible with Three.js and is not a complete Blender editor.There is no WebGPU backend or complete mesh editor.-The published `0.3.3` package supports rigid GLB animation. A checkout can contain newer features without a package version change.+Version `0.4.0` includes the APIs below. Check VERSION and release.json against the installed package before using them.The current source adds GPU skinning, relative POSITION/NORMAL morphs, weight animation and an optional Rapier physics addon.Read `docs/skinning.md`, `docs/morph-targets.md`, `docs/gltf-morph.md` and `docs/physics.md` in the matching checkout before using these features.Source morphs require authored base normals. Tangent targets and per-target flat normal generation remain unsupported.@@ -82,20 +82,20 @@ The source GLB exporter preserves opaque linear vertex colors, UVs and independeRead `docs/export-glb.md` in the matching checkout. Exported GLBs contain a static pose, not serialized animation clips or skeletons.Texture export remains unsupported and fails explicitly. Procedural shaders and scene environments are not serialized into glTF materials.-Source-only `addons/sculpt` accepts serializable inflate, displace and smooth strokes and returns new static geometry.+`addons/sculpt` accepts serializable inflate, displace and smooth strokes and returns new static geometry.Read `docs/sculpt.md`. Construct the result before the renderer: changing uploaded CPU positions does not update GPU geometry buffers.-Source-only `addons/surface` creates projector-clipped curved patches. Read `docs/surface.md` for target-local projector and clearance units.+`addons/surface` creates projector-clipped curved patches. Read `docs/surface.md` for target-local projector and clearance units.Share the target's retained matrix to follow rigid motion. Skin, morph, assembly and procedural targets reject rather than returning stale patches.Surface clearance prevents overlapping layers in this workflow. It does not detect general mesh penetration or provide whole-object shrinkwrap.-Source-only `addons/mesh-query` owns copied static geometry in disposable BVH indices. Read `docs/mesh-query.md` before querying.+`addons/mesh-query` owns copied static geometry in disposable BVH indices. Read `docs/mesh-query.md` before querying.Use `solid: true` indices and `mode: 'closed-solids'` to distinguish boundary contact, containment and separation.Surface contact does not prove volume penetration or identify z-fighting. Never substitute surface-only results for containment.Pass current affine matrices explicitly, rebuild after geometry edits, and preserve budget/precision errors instead of treating them as misses.Read `docs/primitives.md` for subdivision bounds and exact seam closure. Skin, morph and shader-deformed surfaces require geometry matching the visible pose.-Source-only `addons/shrinkwrap` returns {geometry,stats} in target-local coordinates. Read `docs/shrinkwrap.md` before choosing nearest/project modes.+`addons/shrinkwrap` returns {geometry,stats} in target-local coordinates. Read `docs/shrinkwrap.md` before choosing nearest/project modes.Supply sourceToTarget explicitly for different local frames. Share the target matrix with the output part and keep the total callback budget.Nearest projection can collapse vertices on coarse meshes; preserve the error and refine the target or choose a suitable projection direction.Vertex clearance does not certify whole-triangle clearance. Compatible static output can become a GPU morph target without repeating queries per frame.diff --git a/scripts/prepare-release.mjs b/scripts/prepare-release.mjsindex bb129921..d98e9ea2 100644--- a/scripts/prepare-release.mjs+++ b/scripts/prepare-release.mjs@@ -39,6 +39,7 @@ const sourceDocuments = ['scene-graph.md', 'modeling.md', 'animation-curves.md', 'animation-mixer.md','gltf-morph.md', 'morph-targets.md', 'skinning.md', 'physics.md','export-glb.md', 'sculpt.md', 'surface.md', 'mesh-query.md', 'primitives.md', 'shrinkwrap.md',+ 'camera-path.md', 'lighting.md', 'volumetric.md', 'film-physics.md',];for (const name of sourceDocuments) {await copyFile(resolve(root, 'docs', name), resolve(root, 'public', name));