<p>This problem might occur, because the most left vertices and the most right vertices are connected while the UV coordinates (texture coordinates) are 1(right) and 0(left)... so the whole texture is interpolated within the small area. (See figure 1)</p>
<p><a href="https://i.sstatic.net/MSIIx.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/MSIIx.png" alt="enter image description here" /></a></p>
<p><strong>Figure 1:</strong> This is what you have right now. The green triangles are correct, the red triangles show the problem you have...</p>
<p>You can add an additional vertex column on the right, where the vertex positions are the same as the most left vertices. (see Figure 2)</p>
<p><a href="https://i.sstatic.net/DOx5q.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/DOx5q.png" alt="enter image description here" /></a></p>
<p><strong>Figure 2:</strong> This is what you need. The orange vertices have the same position as the blue vertices. So this column of vertices is duplicated. But the texture coordinates are different. The blue vertices have a texture coordinate (x) = 0 and the orange vertices have a texture coordinate (x) = 1.</p>

CC BY-SA 4.0
2023-04-28T07:18:02.293Z
2023-04-28T08:26:56.603Z
2023-04-28T08:26:56.603Z
Thomas
<p>I am trying to map a texture on a UV sphere. I created an algorithm to generate the vertices of the sphere and the UV texture coordinates for each vertex. How I do fix the distortion or aliasing?
The formulas I used to generate the vertices of the sphere are:
x = rsinΦcosθ
y = rcosΦ
z = -rsinΦsinθ</p>
<p>The formulas used to generate the UV texture coordinates for each vertex are:
θ = arctan(z / x) / 2π
Φ = arcos(y) / π</p>
<p>I am using Direct3D 12 to render the sphere.</p>
<p><a href="https://i.sstatic.net/vQYIg.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/vQYIg.png" alt="enter image description here" /></a></p>

CC BY-SA 4.0
2023-04-28T07:17:59.757Z
Some code might be beneficial here. Since only a single strip is affected by the distortion and you use a formula where you divide by the coordinate `x`, my first guess would be that you have a "division by zero" error. Turn on all compiler warnings and check the UV-values you are getting.
wychmaster
CC BY-SA 4.0
2023-04-28T07:24:07.970Z
It looks like you are generating vertices and use an index buffer object to define the triangles (connection of the vertices). the last vertex column seems to be the problem, because they are connected to the first vertex column. so the texture inbetween is interpolated over the whole texture. The solution is to add an additional vertex column with position of vertex column 0 and texture coordinates x = 1
Thomas
CC BY-SA 4.0
2023-04-28T07:31:11.553Z
if you look closer to the distorted column, you can see, that the whole earth texture is rendered within this small range... This tells us, that the UV coordinates are wrong... maybe because of the reason you can see in my answer, or like wychmaster said, that you divide by 0 in equation: θ = arctan(z / x) / 2π
Thomas
<texture><uv-mapping>
Distortion or Aliasing of a UV Sphere
Learning CG
# Distortion or Aliasing of a UV Sphere

(Asked by: username_0 on 2023-04-27)

I am trying to map a texture on a UV sphere. I created an algorithm to generate the vertices of the sphere and the UV texture coordinates for each vertex. How I do fix the distortion or aliasing?
The formulas I used to generate the vertices of the sphere are:
x = rsinΦcosθ
y = rcosΦ
z = -rsinΦsinθ

The formulas used to generate the UV texture coordinates for each vertex are:
θ = arctan(z / x) / 2π
Φ = arcos(y) / π

I am using Direct3D 12 to render the sphere.

[![enter image description here](https://i.sstatic.net/vQYIg.png)](https://i.sstatic.net/vQYIg.png)

**Tags:** texture, uv-mapping

> **Comments:**
> **username_1**: Some code might be beneficial here. Since only a single strip is affected by the distortion and you use a formula where you divide by the coordinate `x`, my first guess would be that you have a "division by zero" error. Turn on all compiler warnings and check the UV-values you are getting.  
> **username_2**: It looks like you are generating vertices and use an index buffer object to define the triangles (connection of the vertices). the last vertex column seems to be the problem, because they are connected to the first vertex column. so the texture inbetween is interpolated over the whole texture. The solution is to add an additional vertex column with position of vertex column 0 and texture coordinates x = 1  
> **username_2**: if you look closer to the distorted column, you can see, that the whole earth texture is rendered within this small range... This tells us, that the UV coordinates are wrong... maybe because of the reason you can see in my answer, or like username_1 said, that you divide by 0 in equation: θ = arctan(z / x) / 2π  

---

## 1 answers

### Answer by username_2 on 2023-04-28. Score: 1 | Accepted answer

This problem might occur, because the most left vertices and the most right vertices are connected while the UV coordinates (texture coordinates) are 1(right) and 0(left)... so the whole texture is interpolated within the small area. (See figure 1)

[![enter image description here](https://i.sstatic.net/MSIIx.png)](https://i.sstatic.net/MSIIx.png)

**Figure 1:** This is what you have right now. The green triangles are correct, the red triangles show the problem you have...

You can add an additional vertex column on the right, where the vertex positions are the same as the most left vertices. (see Figure 2)

[![enter image description here](https://i.sstatic.net/DOx5q.png)](https://i.sstatic.net/DOx5q.png)

**Figure 2:** This is what you need. The orange vertices have the same position as the blue vertices. So this column of vertices is duplicated. But the texture coordinates are different. The blue vertices have a texture coordinate (x) = 0 and the orange vertices have a texture coordinate (x) = 1.


---

