I’m stepping through a tutorial for a basic sky.

My texture is stretched at the top of the sky. Why?

I included the html file you can open to easily see the issue.

index2.html (16.8 KB)

Also there’s a seam running down the side.

Might be related to this part?

```
// Sphere skybox
// Take the Arcsine of the Y component to eliminate the stretch near the top.
// Divide by Pi/2, since Arcsin(1) = Pi/2.
// Calculate the Arctangent2 of the X and Z component, the angle on the circumference of the skybox. Divide by 2PI
vec3 i = normalize(vWorldPosition);
vec2 uv = vec2(atan(i.x, i.z) / PI2, asin(i.y) / PI_HALF);
// vec2 uv = vec2(atan2(i.xz) / PI2, asin(i.y) / PI_HALF);
```

**Solved: This is the correct uv, much simpler:**

```
vec3 wPosNorm = normalize(vWorldPosition);
vec2 uv = wPosNorm.xz / wPosNorm.y;
```

Screenshot looking directly above:

Ref: