4 ms·
This is wrong, sRGB is not a "nonlinear color space". In fact, the term itself makes no sense, all color spaces are defined in terms of linear intensity. What y
by Asooka 4y ago
This is wrong, sRGB is not a "nonlinear color space". In fact, the term itself makes no sense, all color spaces are defined in terms of linear intensity. What you mean is that sRGB is usually stored and transmitted with a transfer function that is nonlinear. Once you linearise, i.e. apply the reverse transfer function, you are left with linear sRGB, as opposed to some other color space like Adobe RGB, or ACEScg.
But yes, you must do your blending in linear values, otherwise what you get is nonsense.
- pornel 4y agosRGB and its transfer function are inseparable, by definition. IEC 61966-2-1:1999 defines sRGB as a color space with its particular non-linear transfer function. When you linearize sRGB you create a new not-sRGB-anymore color space that happens to have a compatible white point and RGB primaries.
- esperent 4y ago> a new not-sRGB-anymore color space that happens to have a compatible white point and RGB primaries. Do you know if this new color space has an official name? I work with it basically everyday via the three.js renderer internals and mostly see it refered to as simply "linear", but if more specificity is needed usually I see "linear sRGB". I think that's common even if it's not correct. However as HDR color spaces take over from sRGB I expect it'll become more important to have a correct name for this color space. I have searched for one previously but haven't been able to come up with anything better than "linear sRGB".
- Espressosaurus 4y agoWhen you take sRGB and apply an inverse gamma curve to it you end up in linear light space. Is that what you're referring to? The choice of the inverse gamma curve you're using is a choice with no single answer depending on how you intend to map that linear light onto...whatever it is you're doing. The obvious one is to use the nominal gamma of 2.2. That may or may not make sense depending on your display technology and what you're doing.
- akvadrako 4y agoscRGB with the 16-bit encoding.
- dahart 4y ago“Linear” is in practice the official name. The only additional specificity you can have is to give the scalar conversion factor from your linear colors into physical units like lumens or candela or watts per solid angle or surface area. What linear means is that you’re working in a scaled set of physical units. The scale factor is the only thing missing. You might not ever need the physical scale factor, it doesn’t generally matter. You probably didn’t set your light or color intensities in three.js using physical units in the first place, and even if you did you might be simply scaling the values until things look right. We usually scale the inputs and outputs manually anyway, so the absolute scale of the intermediate linear color space in CG is frequently irrelevant. HDR is mostly referring to whether your values are conceptually [0..1] or [0..infinity]. Sometimes people are also referring to how many bits get used per color channel. (But note that the R is HDR is referring to ‘range’ and not to ‘resolution’.) 8 bit color values that represent [0..1] are unambiguously LDR, while 32 bits per channel color values that represent [0..inf] are unambiguously HDR. If you use 16 bit colors and your range is [0..3] to allow for headroom and glare effects, it’s not really considered HDR, but it’s not exactly LDR either. It mostly only makes sense to work with HDR values in a linear color space, but it’s not strictly or by definition necessary. “Linear sRGB” gets used sometimes, and what it means is that a color was converted from sRGB into linear. So the space is actually just linear. It’s useful to know if a color came from sRGB sometimes, because there’s less worry about going back into sRGB if you know it came from sRGB originally, and it helps you understand something about the scale and brightness of your linear values. If you have linear values and don’t know where they came from, you have no point of reference, and no idea if a value of 0.1 means invisible black, blinding white, or just middle gray. But unless I scale the linear colors, I do know a linear sRGB value of 0.1 is a dark gray that’s visible, because I know that the range of color is approximately [0..1] because it came from sRGB.
- mncharity 4y ago> You probably didn’t set your light or color intensities in three.js using physical units in the first place, Nod... unless you're using a color space, like Jzazbz, with an absolute (not relative) transfer function. Application context then motivates the nit pick. So a Jzazbz HDR of [0..10k], might get a daylight 1k nits picked for diffuse (non-highlight) white. Thus I appreciate it when color libraries provide a distinct Absolute XYZ D65 data type.
- Asooka 4y agoNo, it's still sRGB. Usually it's referred to as "linear sRGB" or "linear Rec. 709" to make the distinction clear. The latter uses the same XY coordinates for its R G and B channels, but a slightly different transfer function.
- dahart 4y agoYou have misunderstood what some people mean when they say “linear sRGB”. That is a term that means linear color space with the gamut of what used to be an sRGB color. It is no longer an sRGB color, but it’s safer to transfer back into sRGB later, there are fewer worries about whether your colors will be clipped to the wrong bounds. The term “linear sRGB” helps you understand the provenance of your inputs, it does not mean your color values are in the sRGB color space.
- dahart 4y ago> In fact, the term itself makes no sense, all color spaces are defined in terms of linear intensity. What do you mean, and why do you think this? The definition of the term “nonlinear color space” is one that has a nonlinear transfer function. What does it mean to say that all color spaces are defined in terms of linear intensity, exactly? (And in that case, what would a non-linear value be?)
- Asooka 4y agoBecause a color space is a definition of the physical characteristics of the R, G, and B channels, usually given as points in XYZ space, along with the white point of the color space. Every color space is defined in terms of linear intensity from 0 to 1 for each of the color channels. Technically you can even have a color space with more than 3 channels, like what Weta are doing in their spectral renderer. The point is that a "color space" is the definition of the physical characteristics of the individual channels. This is always linear. After that, many color spaces do define a transfer function for storing and transmitting the data, usually meant to be used for cases where not much precision is available, e.g. when you only have 8 bits per channel. So to say that you have to "switch to a linear color space" is incorrect, as you are not changing the color space, you are just transferring (applying the inverse transfer function) the values from their non-linear representation to linear.
- IshKebab 4y agoI think you're nitpicking. The term "colourspace" is used to refer to the actual colourspace plus the nonlinear transfer function. The sRGB spec defines that transfer function. You can nitpick and say that the "sRGB colourspace" is linear but it's still true that sRGB is nonlinear.
- dahart 4y agoWhat do you mean by “physical characteristics”? sRGB is not a physical color space, which is part of why it’s non-linear. You seem to be confused about what people mean when they say “nonlinear color space”, and what makes a value linear. A value is only “linear” with respect to something else. Not all values are linear. In the case of color, the words ‘linear’ and ‘non-linear’ are used with respect to physical measurements of light intensity such as watts per steradian or radiance. sRGB values are not linear, because those values are not a linear transform away from physical measurements, it takes a non-linear function to map from physical measurement into sRGB. The reason sRGB is non-linear is because when you add or multiply two sRGB colors to simulate physics like emission or reflection, you get the wrong color compared to what happens in the real world. To get the right color, you must transfer your sRGB inputs to linear space, combine them there, and then transfer the result back to sRGB space. > many color spaces do define a transfer function for storing and transmitting the data, usually meant to be used for cases where not much precision is available This is mostly wrong. The transfer functions define the color space, and they’re almost always defined for the purpose of emulating either display devices with non-linear response or human perception (which has non-linear response). sRGB’s non-linearity is emulating the non-linear gamma of your monitor https://en.wikipedia.org/wiki/SRGB#Transfer_function_(%22gamma%22) https://en.wikipedia.org/wiki/SRGB#Transfer_function_(%22gam... Data space savings is almost entirely a byproduct of more closely matching human perception, and data savings is more or less only relevant to 8-bit color data or less (because 8 bits is not enough to represent linear color without getting visible color banding, but is almost enough when using a non-linear color space like sRGB, while 9 or 10 bits actually is enough to keep things in linear without banding). You still have to switch to linear color spaces to blend colors, even when using 16 or 32 bits per channel, so the compression side-benefits have very little to do with whether you need to use your transfer functions to switch between color spaces. > So to say that you have to “switch to a linear color space” is incorrect, as you are not changing the color space, you are just transferring (applying the inverse transfer function) the values from their non-linear representation to linear. This is entirely wrong. Using a transfer function or inverse is always a change from one color space to another, by definition. That’s exactly what a transfer function does, and it’s the only thing a transfer function does: changes (transfers) values from one color space to another. There is no such thing as a ‘linear representation’ of sRGB, there is only sRGB space and linear space. You aren’t making sense with the “non-linear representation” part, you just said all color space values are linear (even though that’s not true).