Post

I've been working on a Kotlin/Compose Multiplatform to interpolate sRGB colors as mixtures of paints/pigments. It can produce results that are more appealing than the traditional sRGB interpolation that Composes uses (see screenshot). Not quite ready for release yet. github.com/romainguy/vi...

5 reposts51 likes

My implementation is based on their paper. The differences are, from what I can tell, that my version doesn't rely on a large 3D LUT (which was a requirement to target Android apps), and that I don't have any restrictions for commercial use.

My repository provides all the scripts used to generate the LUT and train the MLPs. There's no secret anything :) I gotta say, I love the insight from the original paper of adding RGB remainders to the latent space.

The implementation is based on the extended Kubelka-Munk theory, using a fixed paint layer thickness and a fixed substrate reflectance. The latent space is based on the great paper Practical Pigment Mixing for Digital Painting. The main difference is that my implementation uses two small MLPs.

The first neural net is used to avoid using a ~50 MiB 3D LUT. The second one encodes the spectral integration and is more precise than a polynomial fit. I get excellent performance results on 5 years old Pixel phone. Still need to tweak the training though.

That looks great to me, much better than the straight sRGB interpolation. The one that looks slightly odd is the yellow to blue at the left edge - yellow to green feels too quick, and draws my eye away from the otherwise smooth transition. I very much look forward to trying this out though

That behavior is there in the ground truth computations as well. Funnily enough, it gets less abrupt when I make the approximations worse 😄