-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for Kubelka-Munk theory "pigment-based" color mixing #2
Comments
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. |
Back reference to where the idea started: https://discourse.vvvv.org/t/vl-mixbox/22649 |
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: |
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 😄 |
One more thing while it's on my mind: if this does lead to some notion of |
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🤔? |
I haven't a clue, tbh. |
I've spent some time looking into this on the I'm confident I can support some level of Kubelka-Munk mixing but I'm not yet feeling comfortable about it, and I'll need to ruminate and experiment some more. I've got a notion of a
In the following images:
I could also/instead have a notion of a
So the big questions for me to consider: Finally, Mixbox goes a step further which is out of scope for Unicolour: "unmixing" RGB colours back into some approximation of a pigment for the interactive painting. As far as I understand this is done by precomputing a model based on 4 pigments, and a different choice of pigments would require recomputing the model. I don't see this as feasible at runtime for a library. |
Before I shut the door on this, I'll investigate generating reflectance curves from RGB through this method: http://scottburns.us/reflectance-curves-from-srgb-10/. (Given there's no "true" answer and this is finding one of infinite possibilities that would generate a target RGB, any implementation would probably end up as some kind of utility outside of the core Unicolour functions. To let people imagine "but what if I had a pigment that actually looked like If possible, this would necessitate at least the single-constant implementation (a reflectance value per wavelength, not a I'll see where this leads anyway. |
What's been bothering me about both Mixbox and Spectral.js is that they start with concrete Kubelka-Munk theory before extending into something less tangible. The goal of Unicolour is to be accurate, but it can't be accurate when there isn't a correct answer. I want Unicolour to be a library of certainties, and both of these implementations introduce uncertainties. Mixbox 1
Regardless of how compelling it is, the code they provide is licensed under the somewhat restrictive Creative Commons Attribution-NonCommercial 4.0. If I ever want to provide a Mixbox-style implementation, it will be entirely my own work based only on the paper, and even then I'm not entirely sure that's enough. So for that reason I focused my attention on... Spectral.js 2
UnicolourAll this said, I've ended up with some prototypes that produce convincing results. For a quick comparison:
The least convincing is the standard single-constant KM implementation, but I've got no reason to believe it's wrong, especially when simply tweaking the desired pigment concentrations gives very similar results to Spectral.js. Additionally, now that I see what's going on with Spectral.js, it's easy enough to extend it to support mixing of N colours, not limited to 2 (and not currently implemented in Spectral.js). Here are the above gradients with a constant small amount of a third pigment mixed in as well: PlanI think there is merit in incorporating things that are useful or interesting, even if they come with a certain level of ambiguity, with no exact "correct answer". But I don't feel like they belong in the core
I expect this will take at least a few weeks or months. Items 1 & 2 are largely complete in the If all goes well, I might even look into a custom MIT implementation of the Mixbox algorithm one day, for more realistic two-constant pigment-style mixing of any RGB colour. Footnotes
|
Not sure if these will help in any way but thought I'll leave them here just for reference:
|
Similar to mixbox (commercial).
The text was updated successfully, but these errors were encountered: