3

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?

Mentalist
  • 19,092
  • 7
  • 94
  • 166
  • 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. – Gordon Brinkmann Jun 21 '23 at 09:31
  • @GordonBrinkmann (Power avoided, for efficiency, but no great shakes) – Robin Betts Jun 21 '23 at 09:33
  • 1
    @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$. – Gordon Brinkmann Jun 21 '23 at 09:40
  • 1
    @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. – Mentalist Jun 23 '23 at 01:02
  • @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. – Gordon Brinkmann Jun 23 '23 at 06:54

1 Answers1

5

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

enter image description here

Robin Betts
  • 76,260
  • 8
  • 77
  • 190
  • Worth a check though, that whatever color-processing you're doing, is not already provided by the compositor, internally .. – Robin Betts Jun 21 '23 at 07:37
  • 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). ;-) – Mentalist Jun 23 '23 at 00:43
  • @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. – Robin Betts Jun 23 '23 at 07:21
  • 1
    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. – Mentalist Jun 23 '23 at 08:38
  • 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. – Mentalist Jun 23 '23 at 10:46