Normalize skin weights possible? #667
-
Hey! Is there a way to normalize skin weights with gltf-transform? To get rid of |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Hi @Olaf-Wolf3D! I did implement a function to normalize skin weights, though it is only used internally and not exported currently: glTF-Transform/packages/functions/src/quantize.ts Lines 434 to 468 in 18c4757 Sorting the weights (so the highest weights are all in WEIGHT_0) and then dropping WEIGHTS_1+ could be done very similarly. Feel free to open a 'feature request' issue or PR for this if you'd like these exported from the /functions package. |
Beta Was this translation helpful? Give feedback.
-
Updating my previous answer for the latest release after #670 — const limit = 4;
for (const mesh of document.getRoot().listMeshes()) {
for (const prim of mesh.listPrimitives()) {
sortPrimitiveWeights(prim, limit);
}
} |
Beta Was this translation helpful? Give feedback.
Updating my previous answer for the latest release after #670 —