Tangents on a sphere

Hi, I am trying to do some bumpmapping on a cube sphere, that is a cube projected to a sphere. The normals are easy to know obviously but i need to get the per vertex tangent, I have searched all over the place but can’t seem to find any clue on how to do this. I guess the tangent is just perpendicular to the normal but how do I calculate this?

Please help!

If you know the 2 angles of the vertices of your sphere and the change in angle between neighboring vertices, you can calculate the tangents by simply doing

tangent = sphere(theta+delta_theta, phi) - sphere(theta, phi)

You will run into a problem at the poles, so you’ll have to decide what to do there separately since the above equation will return a vector with 0 length. This is because there are actually infinitely many tangents at the poles.

There’s an exact closed for for the tangents similar to the cos*sin, sin*sin, cos formula for a sphere but I don’t have it on hand right now.

I’m interested too.
So, for example, having:

x = -sin(theta) * sin(rho);
y = cos(theta) * sin(rho);
z = cos(rho);

how can i compute the tangents?

this will help, an article on a patched sphere