@needle-tools/three-mesh-effects 0.3.4 → 0.3.5
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 +4 -0
- package/README.md +1 -1
- package/build/box-impostor-runtime.js +14 -2
- package/build/box-impostor-runtime.js.map +2 -2
- package/build/internal/box-impostor/box-impostor-display.js +10 -2
- package/build/internal/box-impostor/box-impostor-display.js.map +2 -2
- package/build/internal/box-impostor/box-impostor-faces.js.map +1 -1
- package/build/internal/box-impostor/box-impostor-geometry.js +4 -0
- package/build/internal/box-impostor/box-impostor-geometry.js.map +2 -2
- package/build/internal/box-impostor/box-impostor-material.js +10 -2
- package/build/internal/box-impostor/box-impostor-material.js.map +2 -2
- package/build/internal/box-impostor/box-impostor-metadata.js +4 -0
- package/build/internal/box-impostor/box-impostor-metadata.js.map +2 -2
- package/build/internal/box-impostor/box-impostor-projection.js.map +1 -1
- package/build/internal/box-impostor/box-impostor-runtime.js +14 -2
- package/build/internal/box-impostor/box-impostor-runtime.js.map +2 -2
- package/build/types/box-impostor/box-impostor-metadata.d.ts +3 -1
- package/package.json +1 -1
- package/src/box-impostor/box-impostor-material.js +10 -2
- package/src/box-impostor/box-impostor-metadata.js +5 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.3.5 - 2026-11-22
|
|
4
|
+
|
|
5
|
+
- Give glass and lights their shine in box and card impostors, with edge reflections and HDR glow.
|
|
6
|
+
|
|
3
7
|
## 0.3.4 - 2026-11-22
|
|
4
8
|
|
|
5
9
|
- Use Mesh Effects with the latest Three.js, r187. WebGPURenderer is supported from r185 and WebGLRenderer from r187.
|
package/README.md
CHANGED
|
@@ -14,7 +14,7 @@ optional import. The examples use ordinary Three.js and assume an existing
|
|
|
14
14
|
## Features
|
|
15
15
|
|
|
16
16
|
- **Hull effects:** Restore the saved effect automatically, optionally binding its source model.
|
|
17
|
-
- **Card and box impostors (experimental):** Project or reconstruct six captures per part using shared PBR atlases.
|
|
17
|
+
- **Card and box impostors (experimental):** Project or reconstruct six captures per part using shared PBR atlases, with captured glass edge reflections and HDR emission.
|
|
18
18
|
- **Octahedral impostors:** Load exported glTF extensions with a Three.js TSL material.
|
|
19
19
|
- **Deformation rigs:** Run IK and secondary motion alongside standard animation clips.
|
|
20
20
|
- **Pixel and voxel impostors:** Create the display mode selected in the workbench.
|
|
@@ -69,6 +69,8 @@ function parseBoxImpostorDescriptor(raw) {
|
|
|
69
69
|
fail();
|
|
70
70
|
if (d.alphaMode !== void 0 && !["opaque", "mask", "blend"].includes(d.alphaMode))
|
|
71
71
|
fail();
|
|
72
|
+
if (d.fresnelOpacity !== void 0 && typeof d.fresnelOpacity !== "boolean") fail();
|
|
73
|
+
if (d.emissiveStrength !== void 0 && (!Number.isFinite(d.emissiveStrength) || d.emissiveStrength < 1)) fail();
|
|
72
74
|
if (d.mode === "basic" && d.boxes.length !== 1) fail();
|
|
73
75
|
for (const b of d.boxes) {
|
|
74
76
|
if (b.occupancy !== void 0 && (!Array.isArray(b.occupancy) || b.occupancy.length !== BOX_OCCUPANCY_WORDS || !b.occupancy.every(
|
|
@@ -103,6 +105,8 @@ function parseBoxImpostorDescriptor(raw) {
|
|
|
103
105
|
atlasResolution: d.atlasResolution,
|
|
104
106
|
padding: d.padding,
|
|
105
107
|
boxes: d.boxes,
|
|
108
|
+
...d.fresnelOpacity !== void 0 ? { fresnelOpacity: d.fresnelOpacity } : {},
|
|
109
|
+
...d.emissiveStrength !== void 0 ? { emissiveStrength: d.emissiveStrength } : {},
|
|
106
110
|
...d.alphaMode ? { alphaMode: d.alphaMode } : {},
|
|
107
111
|
...normalizeBoxImpostorDisplay(d)
|
|
108
112
|
};
|
|
@@ -284,6 +288,7 @@ import {
|
|
|
284
288
|
attribute as attribute3,
|
|
285
289
|
varying,
|
|
286
290
|
positionLocal as positionLocal2,
|
|
291
|
+
positionViewDirection,
|
|
287
292
|
modelWorldMatrixInverse,
|
|
288
293
|
cameraPosition,
|
|
289
294
|
cameraWorldMatrix,
|
|
@@ -1213,8 +1218,15 @@ function createBoxImpostorMaterialVariant(descriptor, maps, { filtering = false
|
|
|
1213
1218
|
material.roughnessNode = surfaceOrm.g;
|
|
1214
1219
|
material.metalnessNode = surfaceOrm.b;
|
|
1215
1220
|
material.aoNode = surfaceOrm.r;
|
|
1216
|
-
material.emissiveNode = emission;
|
|
1217
|
-
if (transparency !== "cutout")
|
|
1221
|
+
material.emissiveNode = emission.mul(descriptor.emissiveStrength ?? 1);
|
|
1222
|
+
if (transparency !== "cutout") {
|
|
1223
|
+
let opacity = color.a.clamp(0, 1);
|
|
1224
|
+
if (descriptor.fresnelOpacity) {
|
|
1225
|
+
const cosine = material.normalNode.dot(positionViewDirection).abs().clamp(0, 1);
|
|
1226
|
+
opacity = opacity.add(opacity.oneMinus().mul(cosine.oneMinus().pow(5)));
|
|
1227
|
+
}
|
|
1228
|
+
material.opacityNode = opacity;
|
|
1229
|
+
}
|
|
1218
1230
|
material.maskNode = hit.get("valid").greaterThan(0.5);
|
|
1219
1231
|
material.maskShadowNode = material.maskNode;
|
|
1220
1232
|
material.depthNode = capturedSurfaceDepth(hit.get("position"));
|