6 ms·
sRGB Gamut Clipping (2021)
- Rapzid 2y agoColor management is such a shit show on PCs. Most phones these days support a large percentage of DCI-P3 and are configured for it. But even if you have a monitor that supports DCI-P3 you have to slog through modes, profiles, and blog posts to get it setup. Should you always have HDR on? Why does SDR content always look "wrong" when HDR is on? Oh, it's because the peak brightness and color saturation blah blah blah. Gamma 2.0, 2.2, or 2.4? Now you learn the hard way the "desktop" is not color managed, it's the individual applications.. If they want to be. Maybe they'll use the windows configured profile, maybe not.
- deleted 2y ago[deleted]
- Jasper_ 2y ago[flagged]
- Rapzid 2y ago[flagged]
- SideQuark 2y agoMaybe because others interested in color management, including how it works in modern tech, could be attracted to this topic. Then it makes sense to put related things here. If you don't like this comment, which seems pretty useful to get discussion, perhaps even solving the users issues, then don't engage it. Others will find it useful and topical.
- jacobolus 2y agoTo be fair, it's pretty hard to perform or judge reasonable gamut clipping/adaptation if you don't have a well characterized display.
- pier25 2y ago> Now you learn the hard way the "desktop" is not color managed On Windows and probably Linux. MacOS is fully color managed which has its pros and cons since so much of desktop users are on Windows which simply assumes sRGB. At least P3 and sRGB have the same gamma. People working with video are so confused about uploading rec709 content to youtube with 2.4 gamma.
- kuschku 2y agoAt least KDE nowadays supports color management, which is how the steamdeck implements HDR.
- qingcharles 2y agoI read this recently and it just added to the madness: https://www.mux.com/blog/your-browser-and-my-browser-see-different-colors https://www.mux.com/blog/your-browser-and-my-browser-see-dif...
- herf 2y agoIt's a good generalization of several techniques. The main thing I want to know is this: how does it look with actual HDR exposures, not the synthetic ones made by "increasing exposure and colorfulness significantly"? We shouldn't choose a method based on how natural the result is, when there is a "stretching" step like this that is not at all natural.
- pixelpoet 2y agoOMG, it's Mike Herf! I even linked your "give me a gigabyte" article randomly yesterday to someone complaining of an application using 1gb on his 64gb machine, and remember most of your website off by heart still, in particular the soft shadows / roundrects, all the way to random funny things like SreeD :) Thanks so much for the great articles <3
- jacobolus 2y agoI think any kind of hard clipping approach which takes each pixel independently is going to necessarily create some significant artifacts, though as the examples here make clear, some directions of clipping work better than others. The most important part to preserve for the image to look reasonable is lightness contrast, as when it gets crunched away the image loses visible detail, and the better methods demonstrated in this post manage to save at least some lightness contrast. But all of the methods here end up blowing out / compressing away chroma contrast in some regions where it existed in the original image. What I'd like to see someone try is do is record the relative lightness and chroma, and (adaptation/context dependent) color relationships from the original image, and then try to preserve those to the extent practical even when bringing out-of-gamut colors into gamut. This will necessarily require modifying in-gamut colors to some extent as well. This is what good Photoshop users do when they manually adjust the color of an image from one display medium to another, but it involves some amount of careful conscious choice and skill.
- cmovq 2y agoIn games it’s common to have a tone mapping step [1] to map the HDR image to sRGB while maintaining pleasant colors. The exposure parameter is usually dynamically chosen by using the average brightness of a previous frame. [1]: http://filmicworlds.com/blog/filmic-tonemapping-operators/ http://filmicworlds.com/blog/filmic-tonemapping-operators/
- SideQuark 2y agoThose ideas fail for anyone with a modern screen, which goes far beyond sRGB and it's ancient 80 nits brightness. I doubt there's a phone, laptop, PC monitor, or TV made with such low limits now.
- TeMPOraL 2y agoAh so that's why so many movies, shows and even videogames got so dark you can barely see a thing, unless you're viewing them on a relatively recent TV?
- SideQuark 2y agoThat and overall poor color management practices. Most likely this will all get smoothed out as specs, knowledge, and ecosystems mature
- jiggawatts 2y agoSooo... there's a whole story here of interacting forces, technology advancements, etc... I've recently dipped a toe into this space because I got myself a camera that can shoot 8K HDR "raw" footage with 12-bit color. As I learned to edit and process this into something I can upload to YouTube I got a glimpse into the madness that's going on in the industry. Basically, digital cameras got really good really quickly, and at the same time OLED monitors and super-bright LCDs with local dimming become available for mere mortals. The industry meanwhile was stuck in the mindset that there is only one standard, and it is basically "whatever the RGB phosphors of a CRT TV made in the 1980s did". The software, the hardware, the entire pipeline revolved around some very old assumptions that were all violated by advancing technology. The changes were so rapid that mistakes are still common. Essentially, video editing tools had to "grow up" and deal with color management properly, but there was an awful lot of push-back from both the editors/colorists, and the vendors themselves. Examples: - Professional grading monitors have buttons on the side to emulate various color spaces. These buttons generally don't "report back" the active color space to the OS or the grading software. It's possible to complete an entire project and not notice that what you see on your setup is not at all what anyone else will see. ("Oops.") - Some OLED grading monitors are so good now that in a dark room you won't notice that you've accidentally packed the brightness range into the bottom 10% of the signal range. (This is basically what happened with that episode of Game of Thrones.) - Both recording devices and color grading software like DaVinci Resolve treats color "artistically" and are basically incapable of the equivalent of "strong typing". Video from the camera is often not tagged with the color space used, which is just crazy to me, but this is the "way things are done"! Similarly, these tools generally don't have a strict mapping into the working space, they allow overrides and it's all very flexible and squishy. - Colorists are so used to the specifics of old formats that they think in terms of RGB values in the encoded output space. Same as Photoshop users who think in terms of 255,127,0 being a specific color instead of a specific encoding. ("In what space!?") This extends to tooling like Resolve that shows the output-space values instead of the actual color space in all controls. - Video cards and monitors "do their own thing". Without closing the loop with a hardware calibrator, there is absolutely no way to know what you're actually seeing is what others will see. - The software has a mind of its own too. It's absurdly difficult to avoid "black crush" especially. It just happens. Forums are full of people basically fiddling with every combination of checkboxes and drop-down options until it "goes away"... on their specific monitor and driver setup. Then it looks too bright on YouTube... but not NetFlix. Or whatever. - Basic assumptions one might have about HDR editing are still mired in the SDR world. E.g.: I would expect a fade-out to be equivalent to turning down exposure of the camera. It isn't! Instead it's the equivalent of blending the output tone mapped image with black, so bright parts of the scene turn grey instead of less bright. For reference, outside of the video editing space, tools like Adobe Lightroom (for stills photo editing) are much more strict and consistent in the way they work. RAW stills photos are always tagged with the input gamut and color space, are automatically mapped to a very wide gamut that won't "clip" during editing, and all editing controls operate in this ultra-HDR space. It's only the final output step that tone maps into the target HDR or SDR space. As a random example of this, switching from SDR to HDR mode in Lightroom will just make the highlights get brighter and more colorful. In DaVinci Resolve, unpredictable brightness shifts will occur throughout the image.
- suzumer 2y agoI haven't gone through the whole article, but it seems to be conflating chroma and saturation. If lightness of a color is scaled by a factor c, then chroma needs to be scaled by that same factor, or saturation won't be preserved, and the color will appear more vibrant then it should.
- refulgentis 2y agoWell, no, it's not straight up scaling. (Not directed at you) Color science is a real field, CAM16 addresses all of the ideas and complaints that anyone could have, and yet, because it's 400 lines of code, we are robbed of principled, grounded, color. Instead people reach for the grab bag of simple algorithmic tricks
- SideQuark 2y agoWhile CAM16 helps, it doesn't address all the ideas and complaints. The field that brought you CAM 16 has many more advanced models to address shortcomings, and there's papers published nearly daily addressing flaws in those models. It's by no means a solved problem or field.
- jacobolus 2y ago> CAM16 addresses all of the ideas and complaints that anyone could have A statement this emphatic and absolute can't possibly be true. Here's a concrete complaint that I have with CAM16: the unique hues and hue spacing it defines for its concept of hue quadrature and hue composition are nontrivially different than the ones in CIECAM02 or CIECAM97s, but those changes are not justified or explained anywhere, because the change was just an accidental oversight. (The previous models' unique hues were chosen carefully based on psychometric data.) > because it's 400 lines of code, we are robbed It's not really surprising that people reach for math which is computationally cheap when they need to do something to every pixel which appears in a large video file or is sent to a computer's display.
- 8n4vidtmkvmk 2y agoThen give us both. fast_decent_colormap() and slow_better_colormap() and hide away all your fancy maths. Give me some images and the kinds of transforms each color space is good at, and let me pick one, already implemented in a library in a couple different languages. What's the best color space if I want pretty gradients between 2 arbitrary colors? What's the best color space if want 16 maximally perceptually unique colors? What color space do I use for a heat map image? What color space do I use if I want to pick k-means colors from an image or down sample an image to 6 colors?
- mattdesl 2y agoI’ve implemented[1] some of these algorithms into @texel/color, a modern JS color library, and it also supports gamut mapping to certain wide gamut color spaces (Display P3, Rec2020, Adobe 1998) rather than just sRGB. https://github.com/texel-org/color https://github.com/texel-org/color Many popular color libraries (Colorjs.io, culori) attempt to match CSS gamut mapping spec, which is an order of magnitude slower than the approach in Ottosson’s blog post, and also less accurate (CSS gamut mapping may not fall neatly on the gamut boundary). [1] “Ported” might be a better term as I used a combination of Ottosson’s own JS OKHSL picker, Colorjs.io code, and Coloraide (Python), and adjusted it for performance, more gamuts, and smaller bundle sizes.
- jacobolus 2y agoThe method described at https://drafts.csswg.org/css-color/#css-gamut-mapping https://drafts.csswg.org/css-color/#css-gamut-mapping is equivalent to "Keep lightness constant, only compress chroma" from this blog post. They presumably picked that one because it is straightforward and should be good enough for the purpose at hand, which is figuring out what to do when someone puts an out-of-gamut color in their CSS. The CSS spec doesn't say you have to implement this gamut clipping method via binary search. It's just one possible algorithm that is straightforward to describe so that people can get the intended result with a naïve implementation. Other clipping methods and better algorithms for accomplishing them require significantly more explanation with a bunch of math and color-model-dependent data. The binary search approach is plenty fast for the CSS use case involving single isolated colors, but would not be appropriate for e.g. adapting photographic images from one output medium to another.
- smittywerben 2y agoI used to ignore all of this color stuff until I made a custom health potion asset (Note: not an artist). It looked surprisingly good. I sent it to my friend on Discord and immediately noticed a change: it converted my beautiful Blood Red into Bog Water Brown. I had an existential crisis. Is every Blood Red on the web converted to to Bog Water Brown? Does sRGB's red not go more "red" than that? Now every red on the internet looks like brown to me.
- strogonoff 2y agoClipping is a danger not just with sRGB gamut but in any case where you process a wider dynamic or colour range into a narrower one—for example, that is essentially what photography is (because a sensor capable of capturing the full range of human sight does not exist, and neither does display media capable of reproducing the range of values captured by a modern digital camera sensor). If you are a photographer, this process starts with camera settings at shooting time and ends with delivery to preferred display space. I believe the whole process can or even should be a creative one rather than purely algorithmic, and fitting dynamic range is an opportunity for you to accentuate/attenuate the right aspects of the image to convey a desirable effect. (This is not unlike microphone placement in audio recording, or equalisation/compression in subsequent mixing. First you deal with extreme range of actual physical sound and limit it to capabilities of recording media, then you further fit it to the range of audio reproducing capabilities of consumer equipment and to modern listening conditions, and throughout the entire process you accentuate and attenuate.)
- Anitalawson 2y ago[dead]