3
$\begingroup$

I have a Material node setup that processes color and I want to recreate that node tree for the Compositor.

Unfortunately the setup relies on a Vector Math : Length node to accomplish what it does.

Looking at the Blender Manual's entry for the Vector Math node, we can see that Length is performing the following function:

Can this be replicated using Math nodes in the Compositor?

$\endgroup$
5
  • $\begingroup$ Well, even without looking into the Blender Manual, this formula is simply the formula for the Euclidean distance, the length of a line segment between two points in Euclidean space. And since everything is written out there and you have a Math node in the Compositor, I'm a bit confused what is the problem to recreate it... anyway, Robin provided an answer for you. If his multiplying the X, Y and Z values with themselves does not look close enough to the original formula for you, you could instead of Multiply set the nodes to Power and choose 2 as Exponent. $\endgroup$ Commented Jun 21, 2023 at 9:31
  • $\begingroup$ @GordonBrinkmann (Power avoided, for efficiency, but no great shakes) $\endgroup$
    – Robin Betts
    Commented Jun 21, 2023 at 9:33
  • 1
    $\begingroup$ @RobinBetts I would have done it that way, too... but since not everybody might have great math skills I just mentioned it if something like $A_x \cdot A_x$ looks wrong to him compared to $A_x^2$. $\endgroup$ Commented Jun 21, 2023 at 9:40
  • 1
    $\begingroup$ @GordonBrinkmann Bingo! I don't understand mathematical notation, so I wouldn't be certain whether to do (A * A)*x or A*(x*2) and since I don't want to patch something together based on assumptions, I just ask. But the math makes perfect sense to me when I see it in the form of Blender nodes! I realize there would probably be value in studying mathematical notation at some point, but that can be said of many things. Will I ever get around to it? Remains to be seen... :-) And by posting Q&A about it, hopefully others of limited math skills will also find this info helpful. $\endgroup$
    – Mentalist
    Commented Jun 23, 2023 at 1:02
  • $\begingroup$ @Mentalist Yes, I think maths can be challenging sometimes. Especially since working with Blender in many tasks not necessarily requires math skills from the user. $\endgroup$ Commented Jun 23, 2023 at 6:54

1 Answer 1

5
$\begingroup$

Yup. Just transcribe the expression, and group it up:

enter image description here

$\endgroup$
5
  • $\begingroup$ Worth a check though, that whatever color-processing you're doing, is not already provided by the compositor, internally .. $\endgroup$
    – Robin Betts
    Commented Jun 21, 2023 at 7:37
  • $\begingroup$ Thank you! The purpose is to approximate the operation which in Photoshop terminology would be called Select → Color Range... Here is a Material Nodes solution, which is based on previous contributions of yours (see links in that answer). ;-) $\endgroup$
    – Mentalist
    Commented Jun 23, 2023 at 0:43
  • $\begingroup$ @Mentalist Hehe ... I thought it might be :) That's provided by the Distance Key node. Variations are available, whereby you can set separate thresholds for H,S,and V, for example. $\endgroup$
    – Robin Betts
    Commented Jun 23, 2023 at 7:21
  • 1
    $\begingroup$ Good to know! Thanks for mentioning that. Having inter-compatibility between node types (Materials/Compositor) is satisfying in its own right though - so even if there is overlap with an existing node's functionality, a custom Vector Math: Length node is still welcome, as far as I'm concerned. ;-) But I will definitely play around with Distance Key as well. Cheers. $\endgroup$
    – Mentalist
    Commented Jun 23, 2023 at 8:38
  • $\begingroup$ Here's a .blend of what I've been tinkering with, in case you're curious to see how your answer helped. Matching Compositor/Material node setups for isolating image hue. A bit geeky... maybe not useful to everyone... but I'm pretty happy about it. $\endgroup$
    – Mentalist
    Commented Jun 23, 2023 at 10:46

You must log in to answer this question.

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