Colorspace question

If you hover over a color in a shader, you get a info box that lists several different representations for a color. Notably, RGB triple shown above the red square (0.31,0.066,0.066) is different from the RGBA triple listed below (0.596,0.286,0.286). They’re obviously different color spaces, but which ones are they?

I’m guessing the RGBA one sRGB, and the one on top is a linear space. (I haven’t changed any color management defaults.) But what’s confusing is, from reading what documentation there is, it seems like Blender is only supposed to use sRGB for PNG and JPEG textures, and everything else (until rendering) is in linear space. But here it looks like sRGB can pop up in other places. I suppose any time you see a hex representation of a color you should just assume that’s sRGB since it’s from the web, which is mostly used on screen.

(Parenthetical why I care: I’m using Blender to create scenery for a game which is way too cheap to worry about color space. But I started seeing that things with same color in Blender had different colors in the game, and I realized Blender API was inconsistent about the color space it was reporting. Querying things like vertex color attribute gave me an RGB value in a different color space than querying the color from a shader node.)

Hi there! I don’t know much about color spaces, but hope that additional bit of info helps somehow :person_shrugging:
In v5.2 the info looks like this now:

The “RGB” values are changing depending on which Color Management > Display setting is chosen.

The color you see in the box, so this one:

image

is in sRGB (for some arbitrary, unknown and hard to understand reason). It doesn’t matter what settings you use in your color management, what display you view it on or anything really, it’s just always sRGB :laughing: (Yes, if you have a display that is not in sRGB, you see it wrong :laughing: then). It is always same as if you used sRGB display setting, “Standard” color transform and None for look. Same applies to the hex value. Some people hate hex values, because they are the source of confusion and technically, no one ever specifies what color space they are in, but then… they should always be in sRGB. It’s a web thing and the web is in sRGB after all… :man_shrugging: So you are right there! Hex is sRGB as it should always be. This is the fact that many professional graphic designers are not smart enough to be aware of with their fancy P3 displays. You are already ahead of majority of professionals in graphic design by knowing this. Congratulations! :fireworks:

The linear values are in your working space that is set as working space:

And what you see on screen or save to files depends on your color management settings:

Unless you use EXR format, then it’s always linear(unless you override it :laughing: (don’t do that))

So that’s about it. I guess the only thing to know is that Blender uses sRGB for showing the colors in UI and doesn’t care if that matches your display.

:laughing:
And of course what stray said is also true, those numbers are shown in display color space. :laughing: :laughing: :laughing:

So this is the same color:

Thanks for the replies, folks. I need to export all colors as sRGB (graphics libraries typically assume color inputs are sRGB if you don’t tell it otherwise), so I guess my export scripts now have to be aware of when Blender is reporting linear space and convert it.

The good news is, now the colors in Blender will match the game a lot better. The bad news is I gotta change a whole lot of colors in the existing models so they are correct in linear space now. Glad I have scripting skills.

I don’t think you have to do much. I don’t know the full situation, but it seems to me you possibly only need to set your settings to Standard view transform and that’s pretty much it:

If you render things, you will get sRGB. Actually you will get sRGB if you set your Display to sRGB either way, but other view transforms may get to that sRGB in different ways. If you export the models with solid colors, I would recommend you double check how it works for them really carefully. Trusting that things just work the way it would make sense would be a big mistake with color management. It’s best to never ever trust anything about color management :laughing:

Thanks again. I have resolved my issue, thanks in part to your helpful answer in your first post (and was able to use a script to change all my material colors so they’d have the correct sRGB color).

As a matter of interest, I will mention that what you said in your second post didn’t really apply. I’m not using Blender to render anything; I’m pretty much just using it for the geometry. Python scripts collect data (including color information) from the scene and output it in a format used in the game. As such, adjusting color management wouldn’t have helped.