Isaac C. answered 06/21/19
Physics, Chemistry, Math, and Computer Programming Tutor
To find the angle between any two vectors you can take advantage of the dot product, an operation that is readily available in glsl.
For any two vectors v1 and v2, v1 dot v2 = |v1||v2| cos u where u is the angle between the two vectors.
so cos u = (v1 dot v2) / (|v1||v2|)
You can easily find the dot product and the magnitudes of the vectors in glsl. You also have the inverse cosine function available. Just note that your angle will come out in radians.