@needle-tools/three-mesh-effects 0.2.2 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +28 -6
- package/README.md +76 -1
- package/SKILL.md +9 -1
- package/build/box-impostor-runtime.js +1298 -0
- package/build/box-impostor-runtime.js.map +7 -0
- package/build/deformation-runtime.js +85 -31
- package/build/deformation-runtime.js.map +4 -4
- package/build/hull-effects.js +60 -28
- package/build/hull-effects.js.map +3 -3
- package/build/impostor-runtime.js +235 -116
- package/build/impostor-runtime.js.map +4 -4
- package/build/index.js +4 -0
- package/build/index.js.map +2 -2
- package/build/internal/box-impostor/box-impostor-display-settings.js +50 -0
- package/build/internal/box-impostor/box-impostor-display-settings.js.map +7 -0
- package/build/internal/box-impostor/box-impostor-display.js +1005 -0
- package/build/internal/box-impostor/box-impostor-display.js.map +7 -0
- package/build/internal/box-impostor/box-impostor-face-axes.js +15 -0
- package/build/internal/box-impostor/box-impostor-face-axes.js.map +7 -0
- package/build/internal/box-impostor/box-impostor-faces.js +125 -0
- package/build/internal/box-impostor/box-impostor-faces.js.map +7 -0
- package/build/internal/box-impostor/box-impostor-geometry.js +230 -0
- package/build/internal/box-impostor/box-impostor-geometry.js.map +7 -0
- package/build/internal/box-impostor/box-impostor-material.js +964 -0
- package/build/internal/box-impostor/box-impostor-material.js.map +7 -0
- package/build/internal/box-impostor/box-impostor-metadata.js +108 -0
- package/build/internal/box-impostor/box-impostor-metadata.js.map +7 -0
- package/build/internal/box-impostor/box-impostor-projection.js +256 -0
- package/build/internal/box-impostor/box-impostor-projection.js.map +7 -0
- package/build/internal/box-impostor/box-impostor-runtime.js +1252 -0
- package/build/internal/box-impostor/box-impostor-runtime.js.map +7 -0
- package/build/internal/box-impostor/box-impostor-surface-search.js +21 -0
- package/build/internal/box-impostor/box-impostor-surface-search.js.map +7 -0
- package/build/internal/deformation/cloth-surface.js +23 -17
- package/build/internal/deformation/cloth-surface.js.map +3 -3
- package/build/internal/deformation/fur-surface.js +55 -12
- package/build/internal/deformation/fur-surface.js.map +3 -3
- package/build/internal/deformation/pin-cloth.js +7 -2
- package/build/internal/deformation/pin-cloth.js.map +2 -2
- package/build/internal/deformation/rig-runtime.js +85 -31
- package/build/internal/deformation/rig-runtime.js.map +4 -4
- package/build/internal/impostor/impostor-node-material.js +235 -116
- package/build/internal/impostor/impostor-node-material.js.map +4 -4
- package/build/internal/rendering/hull-effect-runtime.js +59 -27
- package/build/internal/rendering/hull-effect-runtime.js.map +3 -3
- package/build/internal/rendering/texture-slot.js +26 -0
- package/build/internal/rendering/texture-slot.js.map +7 -0
- package/build/internal/rendering/wireframe.js +41 -9
- package/build/internal/rendering/wireframe.js.map +2 -2
- package/build/internal/rendering/wrap-preview.js +59 -27
- package/build/internal/rendering/wrap-preview.js.map +3 -3
- package/build/types/box-impostor/box-impostor-display-settings.d.ts +30 -0
- package/build/types/box-impostor/box-impostor-display-settings.js +1 -0
- package/build/types/box-impostor/box-impostor-display.d.ts +5 -0
- package/build/types/box-impostor/box-impostor-display.js +1 -0
- package/build/types/box-impostor/box-impostor-face-axes.d.ts +5 -0
- package/build/types/box-impostor/box-impostor-face-axes.js +1 -0
- package/build/types/box-impostor/box-impostor-faces.d.ts +11 -0
- package/build/types/box-impostor/box-impostor-faces.js +1 -0
- package/build/types/box-impostor/box-impostor-geometry.d.ts +5 -0
- package/build/types/box-impostor/box-impostor-geometry.js +1 -0
- package/build/types/box-impostor/box-impostor-material.d.ts +10 -0
- package/build/types/box-impostor/box-impostor-material.js +1 -0
- package/build/types/box-impostor/box-impostor-metadata.d.ts +31 -0
- package/build/types/box-impostor/box-impostor-metadata.js +1 -0
- package/build/types/box-impostor/box-impostor-projection.d.ts +19 -0
- package/build/types/box-impostor/box-impostor-projection.js +1 -0
- package/build/types/box-impostor/box-impostor-runtime.d.ts +25 -0
- package/build/types/box-impostor/box-impostor-runtime.js +1 -0
- package/build/types/box-impostor/box-impostor-surface-search.d.ts +13 -0
- package/build/types/box-impostor/box-impostor-surface-search.js +1 -0
- package/build/types/deformation/cloth-surface.d.ts +1 -0
- package/build/types/deformation/pin-cloth.d.ts +1 -0
- package/build/types/public/box-impostor-runtime.d.ts +6 -0
- package/build/types/public/box-impostor-runtime.js +1 -0
- package/build/types/public/hull-effects.d.ts +1 -0
- package/build/types/public/index.d.ts +1 -1
- package/build/types/rendering/texture-slot.d.ts +10 -0
- package/build/types/rendering/texture-slot.js +1 -0
- package/build/types/rendering/wireframe.d.ts +2 -2
- package/package.json +27 -6
- package/src/box-impostor/box-impostor-display-settings.js +54 -0
- package/src/box-impostor/box-impostor-display.js +38 -0
- package/src/box-impostor/box-impostor-face-axes.js +11 -0
- package/src/box-impostor/box-impostor-faces.js +118 -0
- package/src/box-impostor/box-impostor-geometry.js +140 -0
- package/src/box-impostor/box-impostor-material.js +721 -0
- package/src/box-impostor/box-impostor-metadata.js +122 -0
- package/src/box-impostor/box-impostor-projection.js +287 -0
- package/src/box-impostor/box-impostor-runtime.js +122 -0
- package/src/box-impostor/box-impostor-surface-search.js +11 -0
- package/src/deformation/cloth-surface.ts +28 -17
- package/src/deformation/fur-surface.ts +22 -12
- package/src/deformation/pin-cloth.ts +9 -3
- package/src/impostor/impostor-node-material.js +238 -150
- package/src/public/box-impostor-runtime.js +14 -0
- package/src/public/hull-effects.js +1 -0
- package/src/public/index.js +5 -1
- package/src/rendering/texture-slot.js +27 -0
- package/src/rendering/wireframe.js +51 -13
package/CHANGELOG.md
CHANGED
|
@@ -1,16 +1,38 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.3.1 - 2026-11-11
|
|
4
|
+
|
|
5
|
+
- Show card and box carrier outlines without triangulation diagonals, including card overlays on WebGPU.
|
|
6
|
+
- Add High Contrast with black lines and a thin gray outline, plus Cyan, Lime and Magenta preview wireframe colors.
|
|
7
|
+
|
|
8
|
+
- Keep narrow captured surfaces visible in box impostors at oblique angles. The traced renderer now scales its search to the crossed texture pixels, improving detailed assets at increased GPU cost.
|
|
9
|
+
|
|
10
|
+
- Preserve steep surfaces between sparse octahedral captures, with bounded candidate validation that rejects false depth shells. This improves coverage at an increased GPU cost.
|
|
11
|
+
|
|
12
|
+
## 0.3.0 - 2026-11-06
|
|
13
|
+
|
|
14
|
+
- Keep nearer surfaces visible when another card or box capture sees a farther layer.
|
|
15
|
+
- Add experimental basic cards, fitted cards and fitted-box impostors with automatic glTF loading and shared PBR atlases.
|
|
16
|
+
- Recover more silhouette detail in card and box impostors, with smoother edge lighting and voxel-based empty-space rejection.
|
|
17
|
+
- Reduce GPU rendering cost for depth-reconstructed card and box impostors without lowering image quality.
|
|
18
|
+
- Improve cloth stability and contact handling with overlapping colliders.
|
|
19
|
+
|
|
20
|
+
## 0.2.3 - 2026-10-30
|
|
21
|
+
|
|
22
|
+
- Preserve impostor shading and fur detail as higher-quality textures arrive through progressive loading.
|
|
23
|
+
- Keep impostor views aligned and sharp when color and shading textures load at different resolutions.
|
|
24
|
+
|
|
3
25
|
## 0.2.2 - 2026-10-21
|
|
4
26
|
|
|
5
|
-
-
|
|
27
|
+
- Help coding agents integrate Mesh Effects with bundled guidance for Three.js and Needle Engine, covering loading, animation and cleanup.
|
|
6
28
|
|
|
7
29
|
## 0.2.1 - 2026-10-21
|
|
8
30
|
|
|
9
|
-
-
|
|
31
|
+
- Get started more easily with a reorganized Quick start and guidance for compressed model loading.
|
|
10
32
|
|
|
11
33
|
## 0.2.0 - 2026-10-21
|
|
12
34
|
|
|
13
|
-
- Register `useLoader(loader, renderer)` once to load any combination of Needle glTF
|
|
14
|
-
-
|
|
15
|
-
-
|
|
16
|
-
-
|
|
35
|
+
- Register `useLoader(loader, renderer)` once to load any combination of supported Needle glTF extensions automatically.
|
|
36
|
+
- Choose which effects to enable with the typed `disable` option. Optional effects retain their portable fallback; required effects report when they cannot load.
|
|
37
|
+
- Restore exported hull effects with their saved appearance and settings, including animated models.
|
|
38
|
+
- Attach or detach an original model with `bindHull` for display and animation syncing, or use a hull effect on its own.
|
package/README.md
CHANGED
|
@@ -13,6 +13,7 @@ optional import. The examples use ordinary Three.js and assume an existing
|
|
|
13
13
|
## Features
|
|
14
14
|
|
|
15
15
|
- **Hull effects:** Restore the saved effect automatically, optionally binding its source model.
|
|
16
|
+
- **Card and box impostors (experimental):** Project or reconstruct six captures per part using shared PBR atlases.
|
|
16
17
|
- **Octahedral impostors:** Load exported glTF extensions with a Three.js TSL material.
|
|
17
18
|
- **Deformation rigs:** Run IK and secondary motion alongside standard animation clips.
|
|
18
19
|
- **Pixel and voxel impostors:** Create the display mode selected in the workbench.
|
|
@@ -44,7 +45,7 @@ their glTF extension names in the optional third argument:
|
|
|
44
45
|
useLoader(loader, renderer, { disable: ['NEEDLE_mesh_impostor'] });
|
|
45
46
|
```
|
|
46
47
|
|
|
47
|
-
Supported keys are `NEEDLE_hull_effect`, `NEEDLE_mesh_impostor`, `NEEDLE_pixel_impostor`, and
|
|
48
|
+
Supported keys are `NEEDLE_box_impostor`, `NEEDLE_hull_effect`, `NEEDLE_mesh_impostor`, `NEEDLE_pixel_impostor`, and
|
|
48
49
|
`NEEDLE_deformation_rig`. Disabled optional extensions keep their portable
|
|
49
50
|
fallback without importing the handler. A disabled extension listed in the
|
|
50
51
|
asset's `extensionsRequired` rejects the load with an error. Calling `useLoader`
|
|
@@ -58,6 +59,80 @@ Rig animation still needs a per-frame update, pixel display modes remain availab
|
|
|
58
59
|
through `createPixelImpostorDisplay`. Hull effects load alone; optionally use
|
|
59
60
|
`bindHull` to add an original model and animation syncing.
|
|
60
61
|
|
|
62
|
+
When your loader also supports `NEEDLE_progressive`, impostor shading and fur
|
|
63
|
+
textures can change resolution in place. Material bindings and size-dependent
|
|
64
|
+
sampling update when a texture is replaced; fur height keeps its UV channel and
|
|
65
|
+
texture transforms. Resize impostor atlases per frame rather than filtering
|
|
66
|
+
across neighboring views. Compact shading alpha stores material data and needs
|
|
67
|
+
independent channel filtering and lossless PNG encoding. Packed depth/geometry
|
|
68
|
+
and sparse pixel-impostor records must retain their authored resolution.
|
|
69
|
+
|
|
70
|
+
## Card and fitted-box impostors (experimental)
|
|
71
|
+
|
|
72
|
+
`NEEDLE_box_impostor` stores six orthographic PBR/depth views for each oriented
|
|
73
|
+
part, packed into four shared atlases. Basic mode draws one camera-facing card;
|
|
74
|
+
`cards` draws one per fitted region, and `fitted` draws twelve-triangle box proxies. Motion/opacity batches share atlas textures;
|
|
75
|
+
transparent boxes use separate draws for depth sorting. The runtime supports direct
|
|
76
|
+
plane projection, source-material transparency and standard rigid node
|
|
77
|
+
animation. Auto depth uses projection for flat captures and traces other captures.
|
|
78
|
+
Every display setting retains the same compact geometry: two triangles per card
|
|
79
|
+
or twelve per fitted box. Explicit projection trades curved silhouette/parallax
|
|
80
|
+
accuracy for lower shader cost. Fitted boxes with projection and no view blending
|
|
81
|
+
use ordinary fitted faces with no fragment depth search. Projected cards select
|
|
82
|
+
the nearest supported plane before blending. Captured depth bounds shorten traced
|
|
83
|
+
searches, and padded depth needs one texture read per step. Tracing checks the
|
|
84
|
+
supported captures in facing order and retains the nearest validated surface,
|
|
85
|
+
including surfaces hidden from the most directly facing capture.
|
|
86
|
+
Conservative voxel masks reject empty rays without reducing texture resolution.
|
|
87
|
+
Filtered normals preserve edge lighting. Geometric occupancy
|
|
88
|
+
in the material atlas rejects empty hits. Sampling rejects depth discontinuities
|
|
89
|
+
that would otherwise form extruded walls. Captures preserve surface opacity
|
|
90
|
+
independently of the display cutoff. `useLoader(loader, renderer)` enables it automatically.
|
|
91
|
+
|
|
92
|
+
Use `WebGPURenderer` from `three/webgpu`, with either its native WebGPU or WebGL2
|
|
93
|
+
backend. Classic `WebGLRenderer` keeps the portable textured fallback when the
|
|
94
|
+
extension is optional and rejects a required box extension. Captures remain fixed in their animated node frame.
|
|
95
|
+
A nearest-surface depth field cannot represent all hidden layers; split complex
|
|
96
|
+
parts into more boxes when gaps or occluded surfaces disappear.
|
|
97
|
+
|
|
98
|
+
For manual integration, `@needle-tools/three-mesh-effects/box-impostor-runtime`
|
|
99
|
+
exports `registerNeedleBoxImpostorLoader(loader, { renderer })`,
|
|
100
|
+
`createBoxImpostorGeometry(descriptor)`, `createBoxImpostorMaterial(descriptor, maps)`
|
|
101
|
+
`parseBoxImpostorDescriptor`, and `setBoxImpostorDisplay(root, options)`. `maps` binds `baseColor`, `normalDepth`, `orm`
|
|
102
|
+
and `emissive` explicitly. The material owns its small rectangle lookup texture;
|
|
103
|
+
dispose the material and geometry on unload, and dispose shared atlas textures
|
|
104
|
+
once their last consumer is gone. No per-frame update is needed.
|
|
105
|
+
|
|
106
|
+
Change display settings after loading without rebuilding the geometry or atlases:
|
|
107
|
+
|
|
108
|
+
```js
|
|
109
|
+
import { setBoxImpostorDisplay } from '@needle-tools/three-mesh-effects/box-impostor-runtime';
|
|
110
|
+
setBoxImpostorDisplay(gltf.scene, {
|
|
111
|
+
depthMode: 'auto', // auto, projection, depth
|
|
112
|
+
raySteps: 16,
|
|
113
|
+
interpolation: 'smooth', // none, linear, smooth
|
|
114
|
+
transparency: 'auto', // auto, cutout, dithered, blended
|
|
115
|
+
alphaCutoff: 0.5,
|
|
116
|
+
});
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
Interpolation blends occupied captured planes, or depth-consistent samples on traced surfaces. Auto transparency follows each primitive’s source alpha mode. Blended
|
|
120
|
+
opacity uses sorted draws without depth writes. Dithered opacity uses
|
|
121
|
+
alpha hashing; captures do not represent layered glass or refraction. Cutout
|
|
122
|
+
uses the live alpha cutoff.
|
|
123
|
+
Depth quality, interpolation and transparency select cached compiled materials;
|
|
124
|
+
disposing the geometry releases the cached material variants without disposing shared atlases.
|
|
125
|
+
`DEFAULT_BOX_IMPOSTOR_DISPLAY` and `normalizeBoxImpostorDisplay` expose the same
|
|
126
|
+
defaults and validation used by loading and live updates.
|
|
127
|
+
|
|
128
|
+
Explicit depth reconstruction compiles Low, Medium or High adaptive sampling
|
|
129
|
+
(`raySteps: 8`, `16` or `32`). These set minimum interval budgets and respectively
|
|
130
|
+
1, 2 or 4 samples per projected capture texel along the dominant texture axis;
|
|
131
|
+
they are not maximum counts. Oblique rays can require hundreds of samples.
|
|
132
|
+
Projection omits depth search entirely. Keep depth bytes lossless, atlas
|
|
133
|
+
resolution unchanged and mipmaps disabled: filtering packed 16-bit depth or
|
|
134
|
+
across neighboring views corrupts reconstruction.
|
|
135
|
+
|
|
61
136
|
## Hull effects
|
|
62
137
|
|
|
63
138
|
When exporting with a hull effect selected, Mesh Baker saves its mode and
|
package/SKILL.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: three-mesh-effects
|
|
3
|
-
description: Integrate Mesh Baker glTF models into Three.js or Needle Engine applications, including extension loading, hull effects, deformation rigs, and
|
|
3
|
+
description: Integrate Mesh Baker glTF models into Three.js or Needle Engine applications, including extension loading, hull effects, deformation rigs, and impostor displays.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Three Mesh Effects
|
|
@@ -43,6 +43,14 @@ independent animation loop.
|
|
|
43
43
|
- Pixel impostors: extension loading restores atlas bindings. Custom display
|
|
44
44
|
modes still use `createPixelImpostorDisplay` from `/pixel-impostor-runtime`;
|
|
45
45
|
update its viewport and dispose it as documented in the README.
|
|
46
|
+
- Card and fitted-box impostors: `useLoader` restores `NEEDLE_box_impostor` with
|
|
47
|
+
WebGPURenderer (WebGPU or WebGL2 backend). Use `setBoxImpostorDisplay` from
|
|
48
|
+
`/box-impostor-runtime` for live depth, view blending, transparency and cutoff
|
|
49
|
+
changes. Rigid node animation uses the application's AnimationMixer. Dispose
|
|
50
|
+
geometry and materials on unload; geometry disposal also releases cached
|
|
51
|
+
display variants. Dispose shared atlas textures after their final consumer.
|
|
52
|
+
Captures contain one surface per direction, so hidden layers and refraction
|
|
53
|
+
are approximations; projection and traced modes have different quality costs.
|
|
46
54
|
- Octahedral impostors: pass the actual renderer to `useLoader` so the handler
|
|
47
55
|
can choose the supported material implementation.
|
|
48
56
|
|