So I have been using textures before to apply color to to my objects… now I want to switch to colors. Is there a way I can assign my object color without using textures?
You can use Material.color property in the objects’ materials (it’s available for all materials, not only MeshBasicMaterial.)
2 Likes
var color = new THREE.Color( 0xFFB6C1 );
// torso
var torsoLoader = new THREE.OBJLoader();
torsoLoader.load( 'torso.obj', function ( object ) {
object.traverse( function () {
MeshBasicMaterial.color = color;
} );
scene.add( object );
} );
is something wrong with this? its not working.
nvm found it
Something like this:
object.traverse( function (obj) {
if (obj.isMesh){
obj.material.color.set(0xFFB6C1);
}
} );
And don’t forget to add light source(s) in your scene.
1 Like