The Shader Graph documentation for Power Node
says:
The following example code represents one possible outcome of this
node.
void Unity_Power_float4(float4 A, float4 B, out float4 Out)
{
Out = pow(A, B);
}
And if we then look up the documentation for the pow()
function using float4
it says (emphasis mine):
pow(float4, float4)
Returns the componentwise result of raising x to the power y.
Thus the comment by @PepeOjeda is correct and with respect to Shader Graph, you have:
$$(2,3,4)^{(8,8,8)} = (2^8,3^8,4^8)$$
From a float4
is a vector perspective this might feel like misleading overload. But from a SIMD (single instruction, multiple data) perspective, the operation makes sense. In that context, the float4
can be seen as parallel data packaged together for
parallel processing, hence the componentwise math operation. As @DMGregory points out, this convention is common in in shader languages and many operators are treated this way. For example, if you search the Math class docs for "returns the componentwise", you'll see over a dozen functions operate as described.
(2⁸, 3⁸,4⁸)
, since that is how shaders tend to handle scalar math on vectors. I can't really verify this, though. \$\endgroup\$