I have a sphere in 3D. At runtime i'm generating a dynamic 2048x1024 texture for it. On this texture a tiny circle is drawn, which could be anywhere. I have the x/y of this circle on the texture, and consequently the corresponding UV coordinates. Now, i'd like to interpolate where exactly on my sphere this little circle is located.
This is the code I've been using, but it always seems to be off by +/-90 degrees
// U, V are original UV obtained from dynamic texture.
_u = Math.PI * U;
_v = -2 * Math.PI * V;
_x = Math.cos(_u) * Math.sin(_v) * radius;
_y = Math.sin(_u) * Math.sin(_v) * radius;
_z = Math.cos(_v) * radius;
Thanks for any help!