@needle-tools/gltf-build-pipeline 2.4.0-alpha → 2.4.0-alpha.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 +1 -1
- package/dist/transforms/needle_mesh_transform.js +18 -12
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,7 +4,7 @@ All notable changes to this package will be documented in this file.
|
|
|
4
4
|
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
|
|
5
5
|
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
|
6
6
|
|
|
7
|
-
## [2.4.0-alpha] - 2023-06-26
|
|
7
|
+
## [2.4.0-alpha.1] - 2023-06-26
|
|
8
8
|
- add: heuristic for choosing mesh compression if not explictly configured
|
|
9
9
|
|
|
10
10
|
## [2.3.0-alpha.2] - 2023-06-26
|
|
@@ -53,19 +53,25 @@ async function applyMeshCompression(document, transform_context, context) {
|
|
|
53
53
|
sizeOfMeshes += prim.getAttribute('POSITION').getArray().length;
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
|
-
//
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
/** 25% of the size are blendshapres */
|
|
62
|
-
const ratioThreshold = 0.25;
|
|
63
|
-
if (blendshapeRatio >= ratioThreshold) {
|
|
64
|
-
document.getLogger().info(`[${NAME}]: will apply meshopt mesh compression because blendshapes are ${(blendshapeRatio * 100).toFixed(2)}% of the mesh size`);
|
|
65
|
-
const transform = meshopt({ encoder: MeshoptEncoder });
|
|
66
|
-
return transform(document, transform_context);
|
|
67
|
-
}
|
|
56
|
+
// TODO: make this more robus with progressive loading: when progressive loading is enabled we need to run this check on the root mesh and enforce the same mesh compression for all children. Until we can do that we can not use the code for choosing compression based on blendshape size
|
|
57
|
+
if (sizeOfBlendshapes > 0) {
|
|
58
|
+
document.getLogger().info(`[${NAME}]: will apply meshopt mesh compression because the mesh contains blendshapes`);
|
|
59
|
+
const transform = meshopt({ encoder: MeshoptEncoder });
|
|
60
|
+
return transform(document, transform_context);
|
|
68
61
|
}
|
|
62
|
+
// consider meshopt if blendshape size is > 256 KB
|
|
63
|
+
// const sizeThreshold = 256 * 1024;
|
|
64
|
+
// if (sizeOfBlendshapes > sizeThreshold) {
|
|
65
|
+
// /** How big are the blendshapes compared to the overall mesh size */
|
|
66
|
+
// const blendshapeRatio = sizeOfBlendshapes / sizeOfMeshes;
|
|
67
|
+
// /** 25% of the size are blendshapres */
|
|
68
|
+
// const ratioThreshold = 0.1;
|
|
69
|
+
// if (blendshapeRatio >= ratioThreshold) {
|
|
70
|
+
// document.getLogger().info(`[${NAME}]: will apply meshopt mesh compression because blendshapes are ${(blendshapeRatio * 100).toFixed(2)}% of the mesh size`);
|
|
71
|
+
// const transform = meshopt({ encoder: MeshoptEncoder });
|
|
72
|
+
// return transform(document, transform_context);
|
|
73
|
+
// }
|
|
74
|
+
// }
|
|
69
75
|
// by default we still want to run draco if the root doesnt have a compression model configured
|
|
70
76
|
document.getLogger().info(`[${NAME}]: → will apply draco mesh compression (default)`);
|
|
71
77
|
return draco()(document, transform_context);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@needle-tools/gltf-build-pipeline",
|
|
3
|
-
"version": "2.4.0-alpha",
|
|
3
|
+
"version": "2.4.0-alpha.1",
|
|
4
4
|
"description": "Pipeline and tools for optimizing gltf files using gltf-transform and compression settings within glTF extensions",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"type": "module",
|