Paint like color mixing (Kubelka-Munk)

Red and green will result in a darker color, this is how paint mixing works.
You can play with how colors mix with spectral.js on my site.

For reference this is real paint pigment mixing result I just got in Rebelle. Not saying that we need to do it like rebelle does, but here the greyscale remains evenly blended which for some works it is important.


3 Likes

image

This is the version I submitted in MR, and I feel that its performance is normal. Spectral mixing is a bit similar to pigment mixing, where the three primary colors of light become darker or even blacker when mixed with each other.

Basically, light will be reflected multiple times inside the pigment before being emitted from inside. Due to multiple reflections, the saturation increases, but at the same time, the intensity of the light will also decrease, so mixing colors with pigments can only result in darker colors.

You are right, it’s called subtractive mixing.
Technically Kubelka-Munk is responsible for the subtractive mixing, spectral mixing can be additive too.
The spectral data set you used comes from a real time renderer and is used for additive mixing (hence why it was important for them to let the three base SPD’s sum up to 1 on every wavelength).

1 Like

Hi! Sorry for the dumb question, I don’t know anything about coding or plugins or computers haha. When I try to import krita-5.3.0-spectral-colorsmudge-mr1997-dk1.zip I get the error “X-KDE-Library not found.” Google’s only giving me results for people who know what they’re doing, so I have no idea what this means. Would anyone mind helping me troubleshoot this?

:slight_smile: Hello @wario, and welcome to the forum!

It is not a plugin, but a full portable version of Krita to execute on your system. You have to unzip that package to a location of your choice and can start it using the link krita in its root directory.
By the way, that version you name “krita-5.3.0-spectral-colorsmudge-mr1997-dk1.zip” is not offered here on this topic, from where do you have it, we need the exact link? The versions offered from Dmitri are for Windows.

But it would be better to scroll down the topic, to find the most recent version of that file in this posting from Dmitri:

Michelist

Add/Edit: Now even I found it - under a text-link in the first opening post.

1 Like

Hi! Sorry I took so long to respond, I’ve been pretty busy.

That makes a lot more sense, thanks so much! I still can’t quite get it to work, but it seems like it might be an issue with my computer this time. I think I’ve decided that I don’t value this enough to keep pursuing it for the time being haha.

Thank you so much for the help anyways! I really appreciate it.

1 Like

I just want to chime in that I would love this feature (more than than the existing implementation of the same via the MyPaint brush engine, per the example images comparing blending with that and this), and I hope it is implemented and released in Krita :slight_smile: I would love to use it both for a layer blend mode and same-layer / brush blend mode.

(My previous deleted reply was unintended; I couldn’t figure out how to just make a new reply to the whole thread)

2 Likes

To chime in again, this would be amazing! Mixing like natural pigments in this clearly much better way would be huge!

Edit: just for future reference for myself or anyone else, to use this, it’s found in the layers palette > mode drop-down > mix modes dropdown > tickmark Spectral. Then it will be available as a blend mode if your document’s color space is sRGB. And to compare “Normal” sRGB to this, where yellow and blue in sRGB produce gray, where pigment emulation (here as “Spectral”) produces green:


1 Like

I come to krita from the perspective of an oil painter, and I found this thread while trying to figure out if the software currently supports subtractive colour mixing. I want to contribute to an open source project with art assets and this would be my preferred way of working, as CMYK subtractive is what I do in traditional art. Seeing how there are some oil and watercolour brushes already made for Krita, being able to properly mix colours on the canvas would be an amazing tool for me.

Thank you for your efforts in bringing this feature to the masses.

4 Likes

I have been checking updates regarding this experimental feature and latest post seems to be this and latest MR update on the KDE site (as far as I can tell) is 6 months to a year old. Is this still something that is under development for 5.3.0 or 5.3.x overall? I feel like addition of such a feature would make for a good point of advertisement for Krita as well as a wonderful addition for people who transition from traditional to digital and at the very least a cool feature people can play with regardless of usefulness. I tested the package by rvanwijnen provided by dkazakov. It seems really heavy on the application (at least on that specific package) and crashes on occasions but the effect of spectral on the brushes feels quite close to what Artrage Vitae has. I would love to see this become part of at least maybe an official Krita Next package. I wish the best of luck to developers and hope this is still on their radar.

8 Likes

I Port Spectral Blend to Krita 5.3.0 as I said in diclamer do not know C++ to help for now, but know C# so just implement changes from original code was easy, thank you for your awsome work @raghukamath and @urzeye.

5 Likes

I downloaded the krita_spectral_atualization above but could not figure out how to start Krita from this file. If anyone knows how to do this, please let me know.

1 Like

I don’t know for certain but I believe what you downloaded would be source code.

I think to get the prototype of this version you’ll want to download and extract the archive linked from this previous comment that I’ll link to; I used the rvanwijnen build:

You can either use it as standalone by running krita.exe from within the extracted folder, or MAYBE copy it over a Krita install and hope it works. That has worked for me but I don’t guarantee it will work for others. I think I patch it over Krita v5.2.6.

For spectral blending paint, use:

  • “Spectral” layer mode in layers. Layer opacity affects the mixing factor.
  • and/or “Spectral” blend mode in individual brush settings.

@Typhoon I agree :slight_smile: I’ve been eager to see this implemented in a release, and in any case I’m regularly using the above build because the “sprectral” color blending / smearing in layers / brushes can be so cool.

@miguel_gomes_almeida what is your project doing? Why are you implementing it in C# instead of C++? What language(s) does the Krita project use?

2 Likes

Since I was using the rvanwijnen builds mentioned there, I assumed that the one distributed in miguel_gomes_almeida’s link could also be launched as a standalone Krita.
Do I need to know C++ to port the SpectralBlending functionality to the current Krita nightly build? I am new to programming and can read and write a little Python.

My post may have been a little off topic.
I found a page that explains how to build Krita, so I will study it a bit and give it a try.
But it will probably be difficult… :face_with_raised_eyebrow:

1 Like

Hey, it’s safe to say you should know C++ and several other “technologies” (Git, Ninja, CMake, etc.) to comfortably handle Krita at the source code level. It’s not the best place to start if you’re new, because you will get stumped quickly. OTOH, if you envision yourself getting into this type of work in the future, then by all means give it a go and resolve problems you encounter one by one. It’s just there may be easier ways to get your feet wet.

The problem I see however, is that it’s not clear to me why the work stalled and what the real blockers to completion were. AFAICT, there are two “competing” implementations:

Picking blindly one, or a rebased version of one, and not reflecting on the discussions in the opened MRs seems like a wasted effort. Even if you get a new version to build, there’s no clear path forward to get it merged. I haven’t really followed these threads, so can’t offer specific advice.

2 Likes

Hey all, spectral.js 4 is coming somewhere in the following weeks.
This version has more precision and a special SPD for the white channel.
With these changes there is no more green tinting.

https://x.com/onedayofcrypto/status/1908151288052744205

8 Likes

Hi @rvanwijnen, thanks for the head’s up.

Sorry, if you’re still around, can you share your take on what the blockers were for the ongoing implementations of spectral mixing? Were there still any licensing issues, or big technical disagreements? What do we need to do to make forward progress on this? Thanks.

3 Likes