colormap icon indicating copy to clipboard operation
colormap copied to clipboard

Colorspace clarification

Open sguimmara opened this issue 2 years ago • 1 comments

Hello, I've been using the colormap library in the three.js 3D renderer.

Starting with version 152, three.js applies an automatic gamma encoding on colors.

With this automatic encoding, the same scene using the viridis color ramp renders differently:

Before: image

After: image

My understanding is that now three.js applies gamma encoding (i.e converts from sRGB to linear) on the colormap colors because it expects them to be in the sRGB color space. Obviously this is not the case.

Does it mean that colors generated by colormap are already in linear space ?

sguimmara avatar Jun 26 '23 14:06 sguimmara

I won't be able to help you here unfortunately. But the library is very straightforward, it simply lerps color values between min and max colors. The way that sequence of colors is treated after (like gamma-correction, remapping or whatsoever) is out of scope of this library. So feel free to check the code and possibly post the solution here if you wish 🙏🏼

dy avatar Jun 26 '23 18:06 dy