MeshBasicMaterial color tints texture map three.js

3.6k views Asked by At

I'm working with a MeshBasicMaterial to which I have applied a color.

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

at some point I need to add a texture to the material

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

this works fine but the color of the material is tinting the texture.

I realise I can change the color of the material to white to remove this tinting but cannot find a a way of deleting the material's color or changing the way the color and texture blend - is this possible ? I'm trying to avoid creating a new material and replacing if possible.

demonstrated in Lee Stemkoski's examples - change map to 'grass' and then change the material color

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

1

There are 1 answers

0
Edward On

By the fact you can set the material's .map after the fact, you should be able to set the material's .color after the fact.

material.color = myColor;

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