Note: This solution is specifically for older versions of three.js
In this example, each face in a geometry can have a different material assigned to it. Some faces are set to be transparent while others share a common material:
// geometry
var geometry = new THREE.BoxGeometry( 100, 100, 100, 4, 4, 4 );
// materials
materials = [
new THREE.MeshLambertMaterial( { color: 0xffff00, side: THREE.DoubleSide } ),
new THREE.MeshBasicMaterial( { transparent: true, opacity: 0 } )
];
// assign material to each face
for( var i = 0; i < geometry.faces.length; i++ ) {
geometry.faces[ i ].materialIndex = THREE.Math.randInt( 0, 1 );
}
geometry.sortFacesByMaterialIndex(); // optional, for optimization
// mesh
mesh = new THREE.Mesh( geometry, materials );
scene.add( mesh );
Version: three.js r.87