GLTF Model Animations problem after subdivision modifier

Good day!

I’ve got an issue with model animation after applying SubdivisionMidifier. Animation stops (not working without any errors in console.log), but modifier it self works (model looks smoother). WIthout applying modifier animation works fine.

Is this a bug or I’ve missed something?

p.s. the code:

var loaderGLTF = new GLTFLoader().setPath( 'models/' );
loaderGLTF.load( 'model.gltf', function ( gltf ) {
	let model = gltf.scene;
	let animations = gltf.animations;

	model.traverse( function ( node ) {

		if ( !node.isSkinnedMesh ) return;

		var modifier = new SubdivisionModifier( 2 );
		var smoothGeometry = modifier.modify( node.geometry );
		if ( node.geometry ) node.geometry.dispose();
		node.geometry = new THREE.BufferGeometry().fromGeometry( smoothGeometry );
	} );


	scene.add(model);
	mixer = new THREE.AnimationMixer( model );
	mixer.clipAction( animations[0] ).play();

} );

Hey @lolovo1, welcome to the forum.

Looks like skinning information is missing. I’m not sure exactly why. Possibly you have to copy that manually, or possibly modifier doesn’t produce skinning information in the first place.

3 Likes

It seems like all is fine inside of a skinned mesh… at least I can’t figure it out where the issue is. I’m quite new in threejs, so I don’t know how exactly this (i.e. subdivision modifier) affects on an animationclip.

SubdivisionModifier converts BufferGeometry to Geometry (which is deprecated), dropping the skinning information at that step. I think SubdivisionModifier needs to be updated to support BufferGeometry.

EDIT: Related – https://github.com/mrdoob/three.js/issues/17793#issuecomment-545115509