I have a gltf model of a skeleton. I want to only color the arm of skeleton how can i achieve that?
By either:
- applying proper UV mapping in Blender / other 3D software, then modifying the texture in three (ex. by using CanvasTexture.)
- applying vertex colors (low precision colouring, but easier than modifying textures.)
- applying proper UV mapping, then creating a custom shader than applies colors based on a separate mask texture.
1 Like
@mjurczyk , would you happen to have an example for methods 2 and 3. I am unable to understand what exactly is the method ?
Just adding one more option:
- If the meshes of the body parts in the GLTF model are individual subobjects, it is sufficient just to change the
.color
of the corresponding materials.
1 Like
Thank you ! I managed to get a similar solution to work. But had to look for a skeleton model which was made with individual subobjects and did something like this -
gltf.scene.traverse((node) => {
if (node.isMesh) {
if (node.name == 'left_arm') {
applyVertexColors(node.geometry, new THREE.Color(0xff0000));
node.material = new THREE.MeshStandardMaterial({
vertexColors: true,
side: THREE.DoubleSide
});
}
}
}