waacton / Unicolour

🌈 Colour / Color conversion, interpolation, and comparison for .NET
https://unicolour.wacton.xyz
MIT License
58 stars 5 forks source link

Support for Kubelka-Munk theory "pigment-based" color mixing #2

Open bj-rn opened 6 months ago

bj-rn commented 6 months ago

Similar to mixbox (commercial).

waacton commented 6 months ago

There are a lot of moving parts to be considered!

Similar to CMYK where ICC profiles are not restricted to 4 colour prints (e.g. CMYK vs CMYKOGV), I'll need to make some decisions around handling N-channel spaces. The paper uses 4 primary pigments, whereas spectral.js appears to use 7.

The paper recommends defaults (Phthalo Blue, Quinacridone Magenta, Hansa Yellow, Titanium White) but ultimately the pigments used are the artist's choice, so I'd want to support customisation. spectral.js uses hardcoded SPDs and I don't know what pigments they refer to. I'm also not familiar enough to know why only SPDs are being used in spectral.js and not absorption and scattering coefficients as described in the paper.

Making things more difficult, it seems like the kind of datasets used in the paper are unavailable, unless I'm missing something?

I will probably investigate a first pass at a not-fully-integrated version (as with CMYK), if I can find suitable data.

tebjan commented 6 months ago

Back reference to where the idea started: https://discourse.vvvv.org/t/vl-mixbox/22649

bj-rn commented 6 months ago

Hey, thanks a lot for looking into this! TBH I didn't really read the paper...

Concerning your questions regarding spectral.js maybe this issue provides some answers.

I was able to find the Excel spreadsheet using wayback machine: https://web.archive.org/web/20190715095836/https://www.rit.edu/cos/colorscience/mellon/Data/Final_artist_database.xlsx

waacton commented 6 months ago

Ah excellent, that makes a bit more sense now, I'll take a look when I get a chance!

There's also more detail about the spectral.js implementation here but I'll need more coffee before I try to follow along 😄

waacton commented 6 months ago

One more thing while it's on my mind: if this does lead to some notion of Pigment in Unicolour, it'd be really convenient if it could be somehow generated from data found on https://infraart.inoe.ro/ (if it's even possible to download the raw data).

waacton commented 3 months ago

I've not forgotten about this, but I wanted to figure out how to support genuine CMYK using ICC profiles first as it's a much more common use case.

There's still work to do there (notably for ICC v4 profiles), but it made me wonder: could "pigment-based" mixing (at least for the suggested defaults Phthalo Blue, Quinacridone Magenta, Hansa Yellow, Titanium White in the first instance) be captured as an ICC lookup transform (4-colour to LAB D50 and reverse)?

I don't know anything about creating an ICC profile but it might be a shortcut to supporting a first pass without customisation of pigments. The ICC have a registry of CMYK profiles that each has its characterisation data reference e.g. FOGRA39. Perhaps with similar data for pigment-based mixing, the conversion could be distilled down to an elaborate series of lookup tables for convenience🤔?

bj-rn commented 3 months ago

I haven't a clue, tbh.