I have a 3d point on a sphere and want to convert from that, to a UV point on the sphere's texture.
Could someone point in the right direction for the please? I can take a pure math solution.
Edit:
I currently have this, which does not return the correct UV coordinate. p is the 3d point on the sphere mesh.position is the position of the sphere
var x = (p.x-mesh.position.x)/500;
var y = (p.y-mesh.position.y)/500;
var z = (p.z-mesh.position.z)/500;
var u = Math.atan2(x, z) / (2 * Math.PI) + 0.5;
var v = Math.asin(y) / Math.PI + .5;