Алексей
Алексей

Reputation: 57

How can I remove influence of setting color in mesh's material in Three.js?

First I set material's map (simple texture) and color for the mesh

mesh.material.map = .... mesh.material.color.set('#ff0000');

Then I want to set another texture

mesh.material.map = ....

The mesh became red, but texture is blue for example

How can I remove color from material?

Upvotes: 1

Views: 944

Answers (1)

Mugen87
Mugen87

Reputation: 31026

If you don't want that the color property to affect the texture's color, set it to its default value white. Meaning:

mesh.material.color.set( 0xffffff );

That works because the material's color and the sampled color of the diffuse texture are multiplied in order to produce the fragment's final color value.

Upvotes: 1

Related Questions