[name]
A Material to define multiple materials for the same geometry.
The geometry decides which material is used for which faces by the [page:Face3 faces materialindex].
The material index corresponds with the index of the material in the [page:.materials] array.
Examples
[example:webgl_animation_skinning_morph WebGL / animation / skinning / morph]
[example:webgl_effects_parallaxbarrier WebGL / effect / parallaxbarrier]
[example:webgl_geometry_colors_blender WebGL / geometry / colors / blender]
[example:webgl_geometry_text_earcut WebGL / geometry / text / earcut]
[example:webgl_geometry_text_pnltri WebGL / geometry / text / pnltri]
[example:webgl_geometry_text WebGL / geometry / text]
[example:webgl_loader_ctm_materials WebGL / loader / ctm / materials]
[example:webgl_loader_json_blender WebGL / loader / json / blender]
[example:webgl_loader_json_objconverter WebGL / loader / json / objconverter]
[example:webgl_loader_mmd WebGL / loader / mmd]
[example:webgl_materials_cars WebGL / materials / cars]
[example:webgl_materials_lightmap WebGL / materials / lightmap]
[example:webgl_materials WebGL / materials / / ]
[example:webgl_nearestneighbour WebGL / nearestneighbour]
[example:webgl_objects_update WebGL / objects / update]
[example:webgl_panorama_cube WebGL / panorama / cube]
[example:webgl_skinning_simple WebGL / skinning / simple]
//The following will create a cube with a different material applied to each side
var materials = [
new THREE.MeshBasicMaterial( { color: 0xff0000 } ), // right
new THREE.MeshBasicMaterial( { color: 0x0000ff } ), // left
new THREE.MeshBasicMaterial( { color: 0x00ff00 } ), // top
new THREE.MeshBasicMaterial( { color: 0xffff00 } ), // bottom
new THREE.MeshBasicMaterial( { color: 0x00ffff } ), // back
new THREE.MeshBasicMaterial( { color: 0xff00ff } ) // front
];
var cubeSidesMaterial = new THREE.MultiMaterial( materials );
var cubeGeometry = new THREE.BoxBufferGeometry( 100, 100, 100, 1, 1, 1 );
var cubeMesh = new THREE.Mesh( cubeGeometry, cubeSidesMaterial );
scene.add( cubeMesh );
Constructor
[name]( [page:Array materials] )
[page:Array materials] -- an array of [page:Material Materials] to be used in the MultiMaterial.
Creates a new [name].
Properties
[property:Boolean isMultiMaterial]
Used to check whether this or derived classes are multi materials. Default is *true*.
You should not change this, as it used internally for optimisation.
[property:Array materials]
An array containing the materials being used by the MultiMaterial.
[property:String uuid]
[link:http://en.wikipedia.org/wiki/Universally_unique_identifier UUID] of this material instance.
This gets automatically assigned, so this shouldn't be edited.
[property:Array visible]
Whether or not [page:Mesh meshes] using this material should be rendered.
Methods
[method:MultiMaterial clone]()
Return a clone of this MultiMaterial.
[method:null toJSON]( [page:object meta] )
meta -- object containing metadata such as textures or images for the material.
Convert the material to three.js JSON format.
Source
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]