up vote
0
down vote
favorite
I want to attach a few images to a few sides of a cube, and then leave the other sides blank. I’m having a very difficult time getting this to work. I can load the file and display it fine if I set all the sides to be one material, but if I try to set just one side to show the image, it just is blank.
var textureLoader = new THREE.TextureLoader();
var texture0 = textureLoader.load( 'images/0.png' );
var texture1 = textureLoader.load( 'images/1.png' );
var texture2 = textureLoader.load( 'images/2.png' );
var texture3 = textureLoader.load( 'images/3.png' );
var texture4 = textureLoader.load( 'images/4.png' );
var texture5 = textureLoader.load( 'images/5.png' );
var cubeMaterials = [
new THREE.MeshBasicMaterial( { map: texture0 } ),
new THREE.MeshBasicMaterial( { map: texture1 } ),
new THREE.MeshBasicMaterial( { map: texture2 } ),
new THREE.MeshBasicMaterial( { map: texture3 } ),
new THREE.MeshBasicMaterial( { map: texture4 } ),
new THREE.MeshBasicMaterial( { map: texture5 } )
];
var cubegeometry = new THREE.CubeGeometry(3,2,3);
let cube = new THREE.Mesh(cubegeometry, cubeMaterials);
group.add( cube );