Set material of imported blender model

Hi guys,

Is it possible to update the material of an imported skinnedmesh and still be able to play animations? The default material for imported meshes is MeshStandardMaterial, but for some objects, I want to change the material to MeshBasicMaterial since for some objects I don’t want the color to be influenced by the surrounding lights. When I update the material, the object is no longer able to move along in the animated behavior but stays in the same position and orientation.

var basicMaterial = new THREE.MeshBasicMaterial({ color: 0xffffff });
model.traverse( function ( child ) {
    // child.material.lights = false // This line breaks the Three.js model 
    child.material = basicMaterial;
    child.material.needsUpdate = true;         

I also tried to play with metalness, emissive and lights properties, but none of those properties gave the desired result. Also, when I try to disable the lights property (child.material.lights=false), the whole model seems to break (no longer visible and in the console the following Error is printed: Error: WebGL warning: uniform3fv: Expected an array of length a multiple of 3, got an array of length 0. three.min.js:46:402).

Is there a way to define the material of an object to not be influenced by the surrounding lights and still be able to play animated behaviors?

Three.js version: 104
Animations are created in Blender and executed via the AnimationMixer

Thanks in advance,


Try this:
var basicMaterial = new THREE.MeshBasicMaterial({ color: 0xffffff, skinning: true });


Thank you very much for your quick response!

Setting skining to true fixed the issue for me

You’re welcome :slight_smile: :beers: