Skip to content

armgit / 67.js

Public Imported from GitHub
0

3D engine that AI agents drive

Release 67js 0.10.0

Nguyen Xuan An653bdefeeff3
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 931f6382..f8b2b379 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,23 @@
# Changelog
+## 0.10.0
+
+- Add `67js/addons/terrain` for seeded, chunked heightfields with distance level of detail and `heightAt` for placement
+- Add `67js/addons/texture-set` with `loadTextureSet` and `loadLeafTextures`, and a four-layer splat material with slope, height and mask rules, height-blended edges, triplanar cliffs and anti-tiling
+- Add `67js/addons/vegetation` for seeded trees, bushes, grass and flowers with real branches, Poisson-disk scattering, wind and three levels of detail
+- Accept scanned bark (`barkTextures`) and scanned leaf cards with normal maps (`leafTextures`) on trees and scattered vegetation
+- Add `67js/addons/spume` to play back liquid baked by the Spume solver, with refracting `liquid` and soft `foam` materials
+- Add `67js/addons/vehicle` for path-driven wheel spin, steering, body roll, pitch and ground following
+- Add `67js/addons/retarget` to move humanoid clips between Mixamo, VRM, Unreal and Rigify rigs and offset crowds
+- Add `67js/addons/hdri` and environment maps for image-based lighting with roughness-blurred reflections
+- Add alpha mask, alpha blend, opacity and double-sided materials, with alpha-to-coverage under MSAA
+- Import Draco, meshopt and KTX2 compressed glTF assets, texture transforms and GPU instancing
+- Let agent recipes author liquid, foam, glass and double-sided materials and liquid optics
+- Let streamed parts such as liquid frames share a renderer with retained textured parts
+- Reduce sky reflection on leaf and grass cards so grazing cards no longer turn grey-blue
+- Serve the CC0 textures and HDRI from the site with open CORS, and credit Poly Haven and ambientCG
+- Rewrite the README and add CONTRIBUTING.md
+
## 0.9.1
- Synchronize the roadmap and standalone command with the visual review release
diff --git a/docs/guide.md b/docs/guide.md
index 316cd739..355a15c3 100644
--- a/docs/guide.md
+++ b/docs/guide.md
@@ -168,7 +168,7 @@ Pass `environment: { map }` to light and reflect from an equirectangular HDR ima
## Humanoid retargeting and crowds
-`67js/addons/retarget` is in the current source and not yet published. It moves a humanoid clip onto another skeleton and offsets many copies in time.
+`67js/addons/retarget` is available from version `0.10.0`. It moves a humanoid clip onto another skeleton and offsets many copies in time.
1. Build rigs with `createRigFromSkin(asset.skins[0])`. Name families (Mixamo, VRM, Unreal, Rigify, Quaternius) map through `mapHumanoidBones`; fix a miss with `targetOverrides`.
2. Call `retargetClip(sourceRig, targetRig, clip, { rootMotion })`.
@@ -179,7 +179,7 @@ The [retarget contract](/retarget.md) covers rest-pose assumptions and measured
## Baked liquid
-`67js/addons/spume` is in the current source and not yet published. It plays back liquid baked offline by the Spume GPU solver.
+`67js/addons/spume` is available from version `0.10.0`. It plays back liquid baked offline by the Spume GPU solver.
1. Bake a cache folder with Spume's `run.py` or its Blender add-on.
2. Load it with `loadSpumeCache(folderUrl)`.
@@ -191,7 +191,7 @@ Textured, skinned and morphed parts may stay in the list unchanged while frames
## Wheeled vehicles
-`67js/addons/vehicle` is in the current source and not yet published. It drives a car or truck along a path with deterministic, physics-free animation.
+`67js/addons/vehicle` is available from version `0.10.0`. It drives a car or truck along a path with deterministic, physics-free animation.
1. Describe the vehicle with `createVehicleRig({ parts })`; wheels are found by name and geometry. Check `rig.wheels` or `findWheelCandidates(names)`.
2. Build a drive with `driveAlongPath(rig, points, { cruiseSpeed, groundHeight })`.
@@ -203,17 +203,17 @@ The [vehicle contract](/vehicle.md) lists conventions, options and limits.
## Trees and grass
-`67js/addons/vegetation` is in the current source and not yet published. It grows seeded trees with real branches and leaf cards, grass and flowers.
+`67js/addons/vegetation` is available from version `0.10.0`. It grows seeded trees with real branches and leaf cards, grass and flowers.
1. Scatter with `scatterVegetation({ area, density, terrainHeight, slopeLimit, exclusion, mix, leaves })`.
2. Pick detail per camera with `selectLevels(forest.instances, eye)`.
3. Pass `view.parts` to `Renderer67` and rebuild when `view.changed` is true.
-Cards (`leaves: 'cards'`, the default) are single-sided, alpha-masked, double-sided `foliage` textures that sway with the wind; `'mesh'` leaves cost about twice the triangles. Pass `barkTextures` for scanned bark. The [Vegetation contract](/vegetation.md) lists species, triangle budgets and limits.
+Cards (`leaves: 'cards'`, the default) are single-sided, alpha-masked, double-sided `foliage` textures that sway with the wind; `'mesh'` leaves cost about twice the triangles. Pass `barkTextures` for scanned bark and `leafTextures: await loadLeafTextures('/textures/leaves')` for scanned leaf cards. The [Vegetation contract](/vegetation.md) lists species, triangle budgets and limits.
## Terrain and ground textures
-`67js/addons/terrain` and `67js/addons/texture-set` are in the current source and not yet published. They build a chunked, seeded heightfield with distance level of detail and a four-layer ground material (slope, height and mask rules, height-based edge blending, triplanar cliffs, anti-tiling) from CC0 scans.
+`67js/addons/terrain` and `67js/addons/texture-set` are available from version `0.10.0`. They build a chunked, seeded heightfield with distance level of detail and a four-layer ground material (slope, height and mask rules, height-based edge blending, triplanar cliffs, anti-tiling) from CC0 scans.
1. `const set = await loadTextureSet('/textures/leafy_grass')` per layer, then `material.layers = [{ ...set, scale: 3 }, ...]` and `material.splat = { rules }`.
2. `const terrain = createTerrain({ size, chunks, resolution, levels, seed })`; give every `terrain.parts` entry the one shared material.
@@ -244,7 +244,7 @@ An attachment positions one rigid frame. It does not conform the accessory footp
The optional GLB addon creates these descriptors. HDR requires `EXT_color_buffer_float`. Inspect `renderer.capabilities.hdr` and `hdrFallbackReason`. The renderer falls back when floating-point targets are unavailable.
-Tags select specialized behavior: `armor` allows studio finish overrides. `floor` is a studio floor. `water` adds animated normals and ripples. `foliage` and `grass` add wind and accept a base-colour `map` with alpha mask and `doubleSided` for leaf cards.
+Tags select specialized behavior: `armor` allows studio finish overrides. `floor` is a studio floor. `water` adds animated normals and ripples. `foliage` and `grass` add wind and accept a base-colour `map` with alpha mask, a `normalMap` and `doubleSided` for leaf cards.
`material.alphaMode` is `'opaque'` (default), `'mask'` (cutout at `alphaCutoff`, default 0.5, shadows follow it) or `'blend'` (drawn last, back to front, no depth write). `material.opacity` (default 1) multiplies the base map alpha. `material.doubleSided` (default false) disables back-face culling and lights both faces. These are batch state and cannot change after upload. See `docs/material-maps.md`.
diff --git a/docs/retarget.md b/docs/retarget.md
index db1c96f4..037eda8d 100644
--- a/docs/retarget.md
+++ b/docs/retarget.md
@@ -1,6 +1,6 @@
# Humanoid retargeting and crowds
-`67js/addons/retarget` is in the current source and not yet published. It moves a humanoid clip from one skeleton onto another and
+`67js/addons/retarget` is available from version `0.10.0`. It moves a humanoid clip from one skeleton onto another and
places many skinned copies with their own timing. It only consumes files: Mixamo clips need the owner's Adobe login to download,
and this package never fetches them.
diff --git a/docs/terrain.md b/docs/terrain.md
index 317ca052..bc6214c8 100644
--- a/docs/terrain.md
+++ b/docs/terrain.md
@@ -1,6 +1,6 @@
# Terrain and splat ground
-`67js/addons/terrain` and `67js/addons/texture-set` are in the current source and not yet published.
+`67js/addons/terrain` and `67js/addons/texture-set` are available from version `0.10.0`.
Together they replace a flat, noise-tinted ground with a chunked heightfield and a four-layer ground material made from real scanned textures.
```js
diff --git a/docs/vegetation.md b/docs/vegetation.md
index 2c21c8a4..eb93aba9 100644
--- a/docs/vegetation.md
+++ b/docs/vegetation.md
@@ -1,7 +1,7 @@
# Vegetation
`67js/addons/vegetation` grows seeded trees, bushes and grass, scatters them on terrain and switches detail by distance.
-It is in the current source and not yet published. Everything returns plain renderer parts: geometry, a matrix and a material.
+It is available from version `0.10.0`. Everything returns plain renderer parts: geometry, a matrix and a material.
```js
import { Renderer67 } from '67js';
@@ -61,14 +61,29 @@ Every descriptor needs repeat wrapping. `roughness` goes to `metallicRoughnessMa
Scanned bark gets world-scale UVs: `v` runs along the branch and `u` around it at `barkTileSize` meters per tile (default 0.8), computed per ring so a trunk and a twig have the same texel density and square texels.
Rings wide enough for 1.5 tiles or more wrap a whole number of tiles, so they have no seam. Thinner rings keep the exact scale and put their seam on the underside, away from the usual view. Without `barkTextures` the procedural bark keeps its whole-number repeats and 0.6 m tile.
+## Scanned leaves
+
+`createTree({ species, leafTextures })` and `scatterVegetation({ leafTextures })` swap the procedural leaf cards for scanned ones. `loadLeafTextures('/textures/leaves')` from `67js/addons/texture-set` returns `{ broadleaf, birch, bush, conifer }`, each `{ color, normal, crown }`, ready to pass straight in:
+
+```js
+import { loadLeafTextures } from '67js/addons/texture-set';
+
+const leafTextures = await loadLeafTextures('/textures/leaves');
+const forest = scatterVegetation({ area, leafTextures, barkTextures, seed: 11 });
+```
+
+`color` is RGBA with the leaf mask in alpha and the twig at the bottom edge; `normal` is an OpenGL tangent-space map that the `foliage` tag applies on top of its canopy normal at `normalScale` 0.7; `crown` is the dense clump used for level 2. Species without an entry (palm, grass) keep procedural cards, and `leaves: 'mesh'` ignores the option. Geometry is identical either way, so switching textures never changes triangle counts.
+
+The cards in `public/textures/leaves` are composited by `scripts/build-leaf-cards.py` from three CC0 ambientCG leaf atlases (beech LeafSet024 for broadleaf and birch, LeafSet022 for bush, cedar sprays LeafSet019 for conifer): it cuts every leaf from its atlas, lays leaves alternately along a curved twig (or sprays into a narrow branch tip), rotates the normal vectors with each leaf, and bleeds colour into the transparent pixels so mipmaps have no dark fringe. Each card is 512 px, about 40 to 90 KB in WebP.
+
## Leaves: cards or mesh
-`leaves: 'cards'` (default) uses a procedural RGBA leaf texture (`material.map`) on crossed, slightly curved cards with the `foliage` tag (`grass` for grass cards), `alphaMode: 'mask'`, `alphaCutoff: 0.5` and `doubleSided: true`.
+`leaves: 'cards'` (default) uses an RGBA leaf texture (procedural, or scanned with `leafTextures`) (`material.map`) on crossed, slightly curved cards with the `foliage` tag (`grass` for grass cards), `alphaMode: 'mask'`, `alphaCutoff: 0.5` and `doubleSided: true`.
Cards rely on the renderer's alpha masking with alpha-to-coverage under MSAA; with `samples: 1` their edges fall back to a hard cutout.
Cards hold one face each and `doubleSided` draws the back. For the `foliage` and `grass` tags the fragment shader does not flip the normal on a back face, so the canopy-leaning shading normal lights both sides alike and the existing back-lighting term adds translucency.
`leaves: 'mesh'` builds real leaf silhouettes (ovate, fir spray, palm leaflet) as folded, drooping meshes with the `foliage` tag. It needs no alpha support and costs about twice the triangles.
-Wind: the vertex shader sways only the `foliage` and `grass` tags, and those tags accept a base-colour `map` with alpha mask and `doubleSided` (other maps stay unsupported). Cards, mesh leaves and grass blades sway; bark (a standard material) stays still.
+Wind: the vertex shader sways only the `foliage` and `grass` tags, and those tags accept a base-colour `map` with alpha mask, a `normalMap` and `doubleSided` (other maps stay unsupported). Cards, mesh leaves and grass blades sway; bark (a standard material) stays still.
The displacement is a pure function of `frame.time`, `frame.wind` (default 0.3), the vertex's local position and its uv: a slow sway that grows with height and with distance from the tree's axis (branch tips swing more than the crown centre, both capped at 2.5 m and 3 m so leaves stay near their twigs) plus a faster flutter that grows toward each leaf's tip (`uv.y` 0).
The shadow vertex shader applies the same function, and the renderer redraws the shadow map whenever `frame.time` or `frame.wind` changes while a `foliage` or `grass` batch casts shadows, so shadows follow the leaves. This costs one extra shadow pass per frame for scenes with swaying foliage.
@@ -106,6 +121,6 @@ Meshes and textures are built in plain JavaScript, so tests run in Node.
## Limits
-- Cards need the renderer's alpha mask to look right. The leaf textures are 128 px procedural sprigs; a card seen from under 1 m shows flat, pale shading on needle cards (seen on conifer needles in the close-up render).
+- Cards need the renderer's alpha mask to look right. Without `leafTextures` the leaf textures are 128 px procedural sprigs that look flat from under a few metres; the scanned cards hold up to about 1 m. Palm fronds have no scanned card yet. The conifer card is a cedar spray, so it reads as a flat branch tip rather than separate needles.
- Level changes pop; there is no cross-fade. Level 2 crowns are blobs or crossed cards, not baked imposters.
- Species are fixed presets; there is no seasonal color, wind-bent skeleton or collision with other trees.
diff --git a/docs/vehicle.md b/docs/vehicle.md
index 85980acc..c730af9e 100644
--- a/docs/vehicle.md
+++ b/docs/vehicle.md
@@ -1,6 +1,6 @@
# Vehicle kit
-`67js/addons/vehicle` is in the current source and not yet published.
+`67js/addons/vehicle` is available from version `0.10.0`.
It animates a wheeled vehicle along a path without physics.
Sampling the same time always returns the same pose, so frames can be rendered in any order.
diff --git a/package-lock.json b/package-lock.json
index 4a0773b4..2e9535a6 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "@codepawlhq/67js",
- "version": "0.9.1",
+ "version": "0.10.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@codepawlhq/67js",
- "version": "0.9.1",
+ "version": "0.10.0",
"license": "MIT",
"dependencies": {
"playwright-core": "1.64.0"
diff --git a/package.json b/package.json
index dcd89081..8c346fb9 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "@codepawlhq/67js",
- "version": "0.9.1",
+ "version": "0.10.0",
"private": false,
"type": "module",
"description": "JavaScript tools for agent-driven 3D authoring, browser previews and memory-aware CPU/GPU rendering",