Przeglądaj źródła

Merge pull request #16611 from zeux/dev

GLTFLoader: Fix U8/U16 skinning weights
Mr.doob 6 lat temu
rodzic
commit
5fb22e4046
1 zmienionych plików z 7 dodań i 1 usunięć
  1. 7 1
      examples/js/loaders/GLTFLoader.js

+ 7 - 1
examples/js/loaders/GLTFLoader.js

@@ -2613,7 +2613,13 @@ THREE.GLTFLoader = ( function () {
 							? new THREE.SkinnedMesh( geometry, material )
 							: new THREE.Mesh( geometry, material );
 
-						if ( mesh.isSkinnedMesh === true ) mesh.normalizeSkinWeights(); // #15319
+						if ( mesh.isSkinnedMesh === true && !mesh.geometry.attributes.skinWeight.normalized ) {
+
+							// we normalize floating point skin weight array to fix malformed assets (see #15319)
+							// it's important to skip this for non-float32 data since normalizeSkinWeights assumes non-normalized inputs
+							mesh.normalizeSkinWeights();
+
+						}
 
 						if ( primitive.mode === WEBGL_CONSTANTS.TRIANGLE_STRIP ) {