Now I know that I do not like to read pages before I can answer a question so, I will type the formula here:

So what does this arctan2 do? it returns the arctangent of . Because , we convert as follow, after adding to if .

Now you might wonder, what kind of results does this give us? I will show you a picture what kind of result it should be giving with bilinear interpolation applied.

Well how does it look for me?

(Please do not pay attention to the edges, I cut them with Photoshop so you don't have to bother looking at the rest of the image, which contains no spheres at all except the one I'm showing.)

Now how did I tried to fix this? By fixing it accourding to the image.

I ended up with the best result given by:

when I do .

My best result:

Now my question, is there any possible way that I can fix my best result to resemble the correct result?

If yes how can I do this by only modfying my equations? (please do not tell me to debug my code, but if you have a suggestion where the bug may lie, I will be happy to hear your suggestion.)

If I remove the devided by and , I will end up having a lot of image tiles in my image, which is a good thing. However when tiling is not needed (the picture is large enough to fit onto the sphere), it will still places replicas of the image onto my sphere . That is not correct. I need equations that only places replicas when the image is too small.

If you have other methods of doing a spherical uv mapping please tell me. I am very happy to look into it!