How to sum the elements of a vector?

Godot Version

4.4

Question

Is there a simpler way to sum the elements of my Vector3 in the Shader Visual editor? I could not find a Sum function.

DerivativeFunc, Vector3, Sum

Thank you! it says that it is only for Vulkan though :confused: so I guess I can’t use it without knowing if my target devices support Vulkan.

I found how to do it by reading the code of the triplanar shader.

Basically a dot product with a vector filled with 1 will give you the sum of the elements of Vector a:

2 Likes