Is it possible to color correct a texture?

Hello everyone.

I´m new to the forum and new to threejs and hope to find some help here.

I really searched a lot, but I did not find anything on that: is it possible to do some color correction to a texture while runtime (e.g. brightness)? Or alternatively mix two textures with blendmodes (like multiply)?

I cannot do color correction in advance in Photoshop or something like that, because the textures are generated dynamically.

I would appreciate any help / hints.

Thank you very much and kind regards.

Sascha

If you need complex color correction - you can use CanvasTexture (docs). Paint your texture on the canvas, manipulate the pixels (there’s also quite a few libraries that can help you with this, ex. jimp) and then use it as a texture.

Another option would be to use color property of the material (docs) that uses the Texture. Texture color is multiplied by color property, so you can use it to change the Texture hue and / or make the Texture darker (it is not possible to make it brighter, setting color to white will just multiply the texture color by 1.0. To make it brighter you can use emissive property, which in turn can make the texture lighter but not darker than the original color :’) )

(Ah, also if you’re brave, you can try to make the texture brighter by setting opacity property above 1.0, while simultaneously attempting to ignore @mrdoob yelling in the distance that you misuse the API. :’) )

3 Likes

Hey @mjurczyk .

Cool, thank you very much! I will check this right tomorrow. The color and emmissive approach might do all I need at the moment, since I only need to make the texture a bit darker.

…and whoever @mrdoob is: it seems that you guys have a good sense of humor :wink:

Thanks again and kind regards.

Sascha

2 Likes

Hey @mjurczyk .

Works perfect! Thank you very much for you help!

Kind regards.

Sascha