0

It's possible add an image to a cube face without change the base color of this? I've trying this way but the base color turns black.

 var loader = new THREE.TextureLoader();
 loader.load( './img/arona.png', function ( texture ) {
 var geometry = new THREE.BoxGeometry( 8 , 8 , 8 );
 var material = new THREE.MeshBasicMaterial( { map: texture, color: 0xBC997A } );
 var mesh = new THREE.Mesh( geometry, material );
 scene.add( mesh );
 } );

And this is the result:

enter image description here

Thanks in advance.

Jprada
  • 97
  • 13
  • See http://stackoverflow.com/questions/12368200/displaying-background-colour-through-transparent-png-on-material/13547817#13547817 – WestLangley Dec 29 '16 at 22:04
  • @WestLangley Thanks for the answer, i applied the code of the jsfiddle but currently the cube has color but the console is showing a warning: THREE.WebGLRenderer: Texture marked for update but image is undefined. Can you help me please? – Jprada Dec 30 '16 at 12:54
  • You are probably setting `texture.needsUpdate = true;`. Remove that line. The loader sets the flag for you after the texture loads. – WestLangley Dec 30 '16 at 17:16

0 Answers0