I tried to split equirectangular map to cubit map,it refer to https://stackoverflow.com/a/36976448/10988559, and it works(I think so) at here(jsfiddle).
/** MAIN CODE **/
void main() {
vec3 xyz = uvToXYZ(vUv, ${face});
float x = xyz.x;
float y = xyz.y;
float z = xyz.z;
float theta = PI + atan(y, x);
float r = pow(x * x + y * y, 0.5);
float phi = PI_DIV_2 - atan(z, r);
float uf = theta / PI2;
float vf = phi / PI;
if(uf > 1.0) {
uf -= 1.0;
} else if (uf < 0.0) {
uf += 1.0;
}
gl_FragColor = texture2D(texture, vec2(uf, vf));
}
BUT, Why singularity still exists in glsl and not exists in python? What's my fault? Thanks for any help.