15
$\begingroup$

I'm creating my own merge functions in the compositor, but I've run into a bit of a wall. How do you calculate the square root with nodes? Would one have to write a python node to do this? If so, what would that look like?

$\endgroup$
16
$\begingroup$

The square root of x equals x^.5, so use a math node set to Power and put the value whose square root you want in the upper socket, and set the lower value to .5.

enter image description here

$\endgroup$
  • 1
    $\begingroup$ Thanks for this, Duane. I just discovered this myself minutes ago and was about to answer my own question. You beat me to it. Helps a lot. $\endgroup$ – H Petrus Dec 18 '16 at 20:46
  • 3
    $\begingroup$ To generalize a bit, the nth root is equal to the inverse power, i.e. root(x, n) == x^(1/n). So if you wanted, you could construct a node group which divides 1 by the root before feeding it to a power node, and then you'd have a root node. $\endgroup$ – gandalf3 Dec 18 '16 at 20:47
  • 1
    $\begingroup$ @gandalf3 an Absolute node, or similar, too to make sure input is >= 0 ? $\endgroup$ – batFINGER Dec 19 '16 at 12:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.