# How to get Vector Length in the compositor?

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?

• 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. Jun 21 at 9:31
• @GordonBrinkmann (Power avoided, for efficiency, but no great shakes) Jun 21 at 9:33
• @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$. Jun 21 at 9:40
• @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. Jun 23 at 1: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. Jun 23 at 6:54 • 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. Jun 23 at 8:38