# Distortion or Aliasing of a UV Sphere

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. • 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. Apr 28 at 7:17
• 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 Apr 28 at 7:24
• 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π Apr 28 at 7:31  