Hi,
I have an issue with an animated GLTF model. GLTF loader import all the model’s materials as MeshStandardMaterial. As it is expensive, I wish to change some of them to MeshLambertMaterial. However, when I do it with a SkinnedMesh, the animation doesn’t work. I tried to set the material skinning and morphTargets to true, but it still doesn’t work.
How can I change the material of my SkinnedMesh, while keeping the animation ?
This is how my code looks like :
/// Material creation
var myLambertMaterial = new THREE.MeshLambertMaterial({
color:0x00ff00,
skinning:true,
morphTargets:true,
morphNormals:true
});
/// Material assignation
changeMaterial( importedModel );
function changeMaterial( obj ) {
if ( obj.material ) {
obj.material = myLambertMaterial;
};
if ( obj.children.length > 0 ) {
obj.children.forEach( (child)=> {
changeMaterial( child );
});
};
};