I have an RGB texture each channel of which contains a grayscale 8-bit PBR map (metallic, roughness, etc.). However I am not sure what color space I should use for it. Switching from sRGB to Non-Color changes shading quite a lot. Which color space is correct one?
If no channel contains color data, use non-color. Otherwise use something different - sRGB is a good first guess, but ideally the provider of the texture should tell you what is the color space used.
|Non-color||sRGB or different|
|roughness, glossiness, metaliness, normal, displace, ambient occlusion||albedo, diffuse, base, subsurface, emission|
There is no guarantee someone will not give you a normal texture in sRGB color space. It's very unlikely and makes no sense, but it can happen. Likewise you can get base color in linear ("non-color") color space - makes more sense, but still little. I think especially in case of combined textures, where each channel holds different data, it's possible that you will get color data mixed with non-color data and therefore either of those will be encoded in sub-optimal color space - which makes it harder to guess what color space that is, but I'd bet sRGB if at least one channel holds color data.
It's actually very simple: when you set color space in your Image Texture node, you're not telling Blender "remember this, and treat this data as a color/non-color from now on". What you're doing is simply telling if the image is non-color data - in which case Blender just loads it - or uses some color space like sRGB - in which case Blender converts it to non-color data, because Blender uses linear (physical) color space. This hopefully explains why there's no obvious answer to what color space has to be used (actually it could even be considered off-topic, as it doesn't strictly relate to Blender) - it depends on how the image was created, and not on how Blender uses it. Blender only decodes data if it was encoded.
Perhaps it's worth to mention why the data is encoded. Human vision does not perceive light linearly: for example, the sky is actually violet, but we're almost blind to this color, so we see it as blue. Likewise, if you increase the intensity of light over time, even though you increase it linearly, you will perceive it as accelerating/decelerating at times. Conversion to sRGB fights exactly that, so now you no longer increase the strength of the lamp linearly, but thanks to that you perceive the increase as linear.