3
$\begingroup$

Such that, using nodes, we could dynamically combine the hue, saturation and value to two given colors. Example : Red + Blue = Purple / Violet Green + Black = Dark Green

Basically, this is my node setup. Running the noise texture through a color ramp gives me random noise of varying size in the shades of white, grey and black, which I want to combine the green to form the respective lighter and darker shades of green.

And taking this idea a step ahead, I want to combine any two colors as stated above in the example.

enter image description here

$\endgroup$
2
  • $\begingroup$ @NascentSpace already in use, doesn't work that way $\endgroup$
    – Tejas
    Commented Oct 8, 2020 at 0:21
  • $\begingroup$ CMYK is more appropriate than RGB @NascentSpace $\endgroup$
    – JCRM
    Commented Oct 8, 2020 at 8:43

1 Answer 1

5
$\begingroup$

I think the behavior you describe is human perceptual mixing color, which the color need to be deal in HSV, HSL like color space. Then the mixing between two value can be meaningful.

Main Node

enter image description here

AVG Node Group

enter image description here

Circulate Connected Average Node

enter image description here

Circulate Details:

let color1, color2
if abs(color1 - color2) > 0.5:
then:  # We need to get the closest average rather than the far one
output = avg(color1, color2) - 0.5
else:
output = avg(color1, color2)

The interpolation of HSV color can preserve saturated and value(brightness) and interpolate between color. While RGB value is bind to it's own R,G and B color, which make the color "dirty" when you trying to mix them directly.

I can't find directly HSV color ring node inside node editor so I manually separate them into HSV, and mix them together, and then combine them back to color. The given result is desirable compare to MixRGB node.

Different Behavior when Hue is difference by 180 degree

enter image description here

A more reasonable result using XYZ for interpolation and HSV for tuning

enter image description here

XYZ model is additive color space graphics - Calculation of a mixed color in RGB - Stack Overflow, it could be used in mixing light color properly, but in your requirement, HSV model is suitable for lightness, so manually separate them and combine after XYZ is done mixing.

$\endgroup$
13
  • 1
    $\begingroup$ There is a mistake in the Hue mixing node, the final value should substract 0.5 if the difference between input is higher than 0.5 . $\endgroup$
    – HikariTW
    Commented Oct 8, 2020 at 10:07
  • 1
    $\begingroup$ It is for sure able to darkening and lightening color, but the Hue color need to take care about. Mixing Hue is not a common sense. I'll update the node group ASAP. $\endgroup$
    – HikariTW
    Commented Oct 8, 2020 at 10:35
  • 1
    $\begingroup$ @Tejas Updated. The node itself is not complicate but just a little bit math, and I think there might be some improvement can be done in those node setting. So I would rather leave the node setting not uploaded and let others figure out a better way. $\endgroup$
    – HikariTW
    Commented Oct 8, 2020 at 11:08
  • 1
    $\begingroup$ The Hue value is a ring, but in value it is 0~1. When average between eg. 0.9, 0.3, it should use the value 0.1 rather than 0.9 + 0.3 / 2 = 0.6. And this only happen to final value more than 0.5. So minus it if the difference is bigger then 0.5 $\endgroup$
    – HikariTW
    Commented Oct 8, 2020 at 12:00
  • 1
    $\begingroup$ It's a bit tricky but there isn't a node doing similar thing so we need to handle it explicitly $\endgroup$
    – HikariTW
    Commented Oct 8, 2020 at 12:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .