Texture mapping a sphere

Note: p = Pi = 3.141592.

Define q as the angle from the X axis (0 <= q <= 2p) and f as the angle from the Z axis (0.0 <= f <= p).

Then the equation for a sphere:

X = R sin (f) * cos (q) = R sin (pv) * cos (2pu) where f/p = v (0.0 <= v <= 1.0)

Y = R sin (f) * sin (q) = R sin (pv) * sin (2pu) where q/2p = u (0.0 <= u <= 1.0))

Z = R cos (f) = R cos (pv)

From the equation for Z we get: v = f/p = arccos (Z/R) / p

From the equation for X we get: u = [arccos ( X/R sin (pv) ) ] / 2p

Note: q = arccos x => x = cos q

So if we know the point on the surface, X, Y, Z, then we can compute the point in U,V, texture space.


Two-Dimensional Texture domain
HyperGraph Table of Contents.
HyperGraph Home page.

Last changed June 02, 1999, G. Scott Owen, owen@siggraph.org