MeshBasicMaterial color shades texture map three.js

I am working with a MeshBasicMaterial that I have applied a color to.

var material = new THREE.MeshBasicMaterial({color: myColor});

      

at some point i need to add texture to the material

material.map = new THREE.ImageUtils.loadTexture(...);

      

this works great, but the color of the material colors the texture.

I realize that I can change the color of the material to white to remove this tint, but I can't find a way to remove the color of the material or change the way the colors and textures are mixed - is this possible? I try to avoid creating new material and replace it if possible.

demonstrated in examples by Lee Stemkoski - change the map to "grass" and then change the color of the material

http://threejs.org/docs/scenes/material-browser.html#MeshBasicMaterial

+3


source to share


1 answer


In fact, you can set the material .map

after the fact, you should be able to set the material .color

after the fact.

material.color = myColor;

      



Of course, this new color must be white for your texture to be visible, not black.

0


source







All Articles