Readit News logoReadit News
mattdesl commented on What are OKLCH colors?   jakub.kr/components/oklch... · Posted by u/tontonius
mattdesl · 7 days ago
Nice post. OKLCH is quite handy but for writing colors in CSS I hope eventually we’ll get some form of OKHSL/OKHSV[1] so users don’t need to worry about gamut boundaries.

[1] https://bottosson.github.io/posts/colorpicker/

mattdesl commented on So what's the difference between plotted and printed artwork?   lostpixels.io/writings/th... · Posted by u/cosiiine
NelsonMinar · 18 days ago
I love plotter art and have dabbled a bit myself. The really fun part is how pen-on-paper is not completely reliable or a perfect line. You get a little texture if the pen skips. You can use watercolor pens that bleed. You can get crazy with something like Copic markers on Yupo paper so the whole thing stays wet and smears for minutes. It's part of the art.

This bit from the article made me laugh ruefully though: "it's as simple as buying some black paper and a white gel pen." You can get some beautiful effects with white ink on black paper but it is notoriously difficult to get looking good. White ink is tricky stuff. But that's part of the fun!

mattdesl · 18 days ago
A lot of it comes down to which pens you happen to have - I’ve had some success with Sakura gelly rolls for white, and also more recently have been enjoying sharpie creative acrylic markers which has a moderately opaque white ink. I’ve also had some really frustrating experiences with some other pens and instruments!
mattdesl commented on HyAB k-means for color quantization   30fps.net/pages/hyab-kmea... · Posted by u/ibobev
refulgentis · 2 months ago
No offense, but I do find the interlocution here somewhat hard-headed.

In a sentence, color science is a science.

The words you are using have technical meanings.

When we say "Oklab isn't a perceptually accurate color system", we are not saying "it is bad" - we are saying "it is a singular matmul that is meant to imitate a perceptually accurate color system" -- and that really matters, really -- Google doesn't launch Material 3 dynamic color if we just went in on that.

The goal was singular matmul. Not perceptual accuracy.

Let me give you another tell something is really off that you'll understand intuitively.

People love quoting back the Oklab blog post, you'll also see in a sibling comment something about gradients and CAM16-UCS.

The author took two colors across the color wheel, blue and yellow, then claimed that because the CAM16-UCS gradient has gray in it, Oklab is better.

That's an absolutely insane claim.

Blue and yellow are across the color wheel from each other.

Therefore, a linear gradient between the two has to pass through the center of the color wheel.

Therefore a gradient, i.e. a lerp, will have gray in it -- if it didn't, that would be really weird and indicate some sort of fundamental issue with the color modeling.

So of course, Oklab doesn't have gray in the blue-yellow gradient, and this is written up as a good quality.

If they knew what they were talking about at the time, they wouldn't have been doing gradients in CAM16-UCS, and not done a lerp, but used the standard CSS gradient technique of "rotating" to the new point.

Because that's how you avoid gray.

Not making up a new color space, writing it up with a ton of misinfo, then leaving it up without clarification so otherwise-smart people end up completely confused for years, repeating either the blog post or "nothings perfect" ad naseum as an excuse to never engage with anything past it. They walk away with the mistaken understanding a singular matmul somehow magically blew up 50 years of color science.

I just hope this era passes within my lifetime. HSL was a tragedy. This will be worse, if it leaves the ability to do actual color science some sort of fringe slow thing in people's heads.

mattdesl · 2 months ago
Yes, it's a matmul; many color models just boil down to simple math. For example, look at Li and Luo's 2024 "simple color appearance model"[1], which is very similar to OKLab (just matmul!), and created for many of the same reasons (just an approximation!). Like OKLab, it also improves upon CAM16-UCS hue linearity issues in blue. Ironically, Luo was one of the authors who proposed CAM16-UCS in 2017. And, although it certainly improves upon CAM16-UCS for many applications, I'm not yet convinced it is superior to OKLab (you can see my implementation here: [2]).

And I think you might be mis-remembering Ottosson's original blog post; he demonstrates a gradient between white and blue, not blue and yellow.

[1] https://opg.optica.org/oe/fulltext.cfm?uri=oe-32-3-3100

[2] https://github.com/texel-org/color/blob/main/test/spaces/sim...

mattdesl commented on HyAB k-means for color quantization   30fps.net/pages/hyab-kmea... · Posted by u/ibobev
yorwba · 2 months ago
If the target is parity with CAM16-UCS, CAM16-UCS is best, tautologically. Sure, if you need a fast approximation, by all means fall back to Oklab, but that optimization isn't going to be necessary in all cases.
mattdesl · 2 months ago
Obviously; but this doesn’t suggest that OKLab is not a perceptually uniform color space.

There is no “one true” UCS model - all of these are just approximations of various perception and color matching studies, and at some point CAM16-UCS will probably be made obsolete as well.

mattdesl commented on HyAB k-means for color quantization   30fps.net/pages/hyab-kmea... · Posted by u/ibobev
yorwba · 2 months ago
Oklab is not perceptually uniform. It's better than other color spaces with equally simple conversion functions, but in the end, it was created as a simple approximation to more complex color spaces, so compared to the best you could do, it's merely OK (hence the name).
mattdesl · 2 months ago
> Oklab is not perceptually uniform

By what metric? If the target is parity with CAM16-UCS, OKLab comes closer than many color spaces also designed to be perceptually uniform.

mattdesl commented on HyAB k-means for color quantization   30fps.net/pages/hyab-kmea... · Posted by u/ibobev
refulgentis · 2 months ago
I am very strongly opinionated on this, but am aware this isn't a very serious matter most of the time. Imagine my tongue in cheek, and a smile, i.e. I'm open to discussion:

Oklab is a nightmare in practice - it's not linked to any perceptual color space, but it has the sheen of such in colloquial discussion. It's a singular matmul that is supposed to emulate CAM16 as best as it can.

It reminds me of the initial state of color extraction I walked into at Google, where they were using HSL -- that is more obviously wrong, but I submit they suffer from the same exact issue: their verbiage is close enough to actual verbiage that they obfuscate discussion, and prevent people from working with the actual perceptual spaces, where all of a sudden a ton of problems just...go away.

</end rant>

In practice, quantizers are all slow enough at multimegapixel that I downscale - significantly, IIRC I used 96x96 or 112x112. IIRC you could convert all 16M of RGB to CAM16 and L* in 6 seconds, in debug mode, in Dart, transpiled to Javascript in 2021, so I try to advocate for doing things with a proper color space as much as possible, the perf just doesn't matter.

EDIT: Also, I should point out that my goal was to get a completely dynamic color system built, which required mathematically guaranteeing a given contrast ratio for two given lightness values, no matter hue and chroma, so trying to use pseudo-perceptual-lightness would have been enough to completely prevent that.

I do still think it's bad in general, i.e. if it was people doing effects on images in realtime, a couple weeks ago I finally got past what I had internally at Google, and was able to use appearance modeling (i.e. the AM in CAM-16) to do an exquisite UI whose colors change based on the lighting naturally. https://x.com/jpohhhh/status/1937698857879515450

mattdesl · 2 months ago
It does a pretty good job at emulating CAM16 with a fraction of the parameters, computational complexity, and processing; it’s no wonder it was adopted by CSS.

I don’t know what you mean by “not being linked to any perceptual color space” - it is derived from CAM16 & CIEDE2000, pretty similar in ethos to other spaces like ITP and the more recently published sUCS.

There’s also tons of discussion on w3c GitHub about OKLab, and it’s evolved in many ways since the original blog post such as improved matrices, new lightness estimate and OKHSV/OKHSL, and very useful cusp & gamut approximations.

I have a hard time seeing how it’s a nightmare in practice!

mattdesl commented on HyAB k-means for color quantization   30fps.net/pages/hyab-kmea... · Posted by u/ibobev
mattdesl · 2 months ago
I’ve done some color quantization tests with HyAB and OKLab on this same image. A couple notes:

- what works well for this image might not work well for other images! I learned the hard way after lots of testing on this image, only to find things that did not generalize well.

- parametrizing the AB plane weight is pretty useful for color quantization; I’ve found some images will be best with more weight given to colour, and other images need more weight given to tone. OKLab creator suggests a factor of 2 in deltaEOK[1] but again this is something that should be adjustable IMHO..

- there’s another interesting and efficient color space (poorly named) sUCS and sCAM[2] that boasts impressive results in their paper for tasks like this. Although I’ve found it not much better for my needs than OKLab in my brief tests[3] (and note, both color spaces are derived using CIEDE2000)

[1] https://github.com/color-js/color.js/blob/9d812464aa318a9b47...

[2] https://opg.optica.org/oe/fulltext.cfm?uri=oe-32-3-3100&id=5...

[3] https://x.com/mattdesl/status/1902699888057446670

mattdesl commented on HyAB k-means for color quantization   30fps.net/pages/hyab-kmea... · Posted by u/ibobev
refulgentis · 2 months ago
Highly recommend Celebi's K-Means, weighted square means.

It feeds the results from a box cutting quantizer (Wu) into K-Means, giving you deterministic initial clusters and deterministic results. It leverages CIELAB distance to avoid a bunch of computation. I used it for Material 3's dynamic color and it was awesome as it enabled higher cluster counts.

mattdesl · 2 months ago
Surely this would be even faster and potentially better with OKLab? Especially in the context of CIELab based distance metrics like CIEDE2000 which are a bit heavy.

My own gripe with box cutting is that perceptual color spaces tend not to have cube shaped volumes. But they are very fast algorithms.

mattdesl commented on Compiling a neural net to C for a speedup   slightknack.dev/blog/diff... · Posted by u/todsacerdoti
enricozb · 3 months ago
Differentiable Logic Gate Networks [0] are super interesting. However, I still don't like that the wiring is fixed initially rather than learned.

I did some extremely rough research into doing learnable wirings [1], but couldn't get past even learning ~4-bit addition.

[0]: https://arxiv.org/abs/2210.08277

[1]: https://ezb.io/thoughts/program_synthesis/boolean_circuits/2...

mattdesl · 3 months ago
I think the techniques in “Weight Agnostic Neural Networks” should be applicable here, too. It uses a variant of NEAT I believe. This would allow for learning the topology and wiring rather than just gates. But, in practice it is probably pretty slow, and may not be all that different than a pruned and optimized DLGN..

https://weightagnostic.github.io/

mattdesl commented on Questioning Representational Optimism in Deep Learning   github.com/akarshkumar010... · Posted by u/mattdesl
mattdesl · 3 months ago
The full title of the paper is “Questioning Representational Optimism in Deep Learning: The Fractured Entangled Representation Hypothesis.”

https://arxiv.org/abs/2505.11581

u/mattdesl

KarmaCake day1608March 28, 2014
About
generative artist

https://mattdesl.com

View Original