Three.js: Status of Multiple Materials

Created on 21 Aug 2017  ·  3Comments  ·  Source: mrdoob/three.js

I don't know if multiple materials is now supported in any way?

MultiMaterial has been deprecated - but I cannot find any documentation or help on how to create a custom mesh (NOT a CUBE) with multiple materials - or how my faceVertexUvs structure has to look or how to get this working..

Any help or links please?

Question

Most helpful comment

I might not understand correctly what you are trying to achieve, but supplying an array should work? Upon using THREE.MultiMaterial a warning should be logged to console, which reads:

THREE.MultiMaterial has been removed. Use an Array instead.

Example:

const geo = new THREE.BoxGeometry( 1, 1, 1 );
const mat = [
    new THREE.MeshBasicMaterial({ color: 0xFF00FF }),
    new THREE.MeshBasicMaterial({ color: 0x00FF00 }),
    new THREE.MeshBasicMaterial({ color: 0xFF00FF }),
    new THREE.MeshBasicMaterial({ color: 0x00FF00 }),
    new THREE.MeshBasicMaterial({ color: 0xFF00FF }),
    new THREE.MeshBasicMaterial({ color: 0x00FF00 }),
];
const mesh = new THREE.Mesh( geo, mat ); 

I'm using this for my own custom mesh.

All 3 comments

I might not understand correctly what you are trying to achieve, but supplying an array should work? Upon using THREE.MultiMaterial a warning should be logged to console, which reads:

THREE.MultiMaterial has been removed. Use an Array instead.

Example:

const geo = new THREE.BoxGeometry( 1, 1, 1 );
const mat = [
    new THREE.MeshBasicMaterial({ color: 0xFF00FF }),
    new THREE.MeshBasicMaterial({ color: 0x00FF00 }),
    new THREE.MeshBasicMaterial({ color: 0xFF00FF }),
    new THREE.MeshBasicMaterial({ color: 0x00FF00 }),
    new THREE.MeshBasicMaterial({ color: 0xFF00FF }),
    new THREE.MeshBasicMaterial({ color: 0x00FF00 }),
];
const mesh = new THREE.Mesh( geo, mat ); 

I'm using this for my own custom mesh.

As @imjasonmiller said, the only difference should be the usage of a plain array object instead of an instance of THREE.MultiMaterial. The setup of material indices in the geometries has not changed.

alright thanks - all good

Was this page helpful?
0 / 5 - 0 ratings