Originally Posted by

**ugluk**
I'm trying to do the classical sphere texturing like this:

u = (phi + M_PI) / M_TWOPI;

v = theta / M_PI;

phi belongs to [-M_PI, M_PI];

theta belongs to [0, M_HALFPI];

The problem I have is the following, as phi approaches M_PI, u approaches 1, then between the starting and final vertices phi = 0, u = 0 and phi ~ M_PI, u ~ 1 the entire texture will be interpolated into. The way to solve this problem is to interpolate with a function that starts and ends in the same value, maybe some candidates:

u = (cos(phi) + 1) / 2;

u = abs(cos(phi));

u = 1 - abs(phi / M_PI);

These make the sphere look really funky. A mirrored texture results.

The other way might be to duplicate a vertex (one for phi=-M_PI, another for phi=M_PI. But really, I hate duplication.

I suppose you go with vertex duplication nonetheless.