1

I've done a fair bit of research and I just can't really seem to find anything that can help. Basically, I'm trying to obtain the correct UV coordinates on on icosphere so I can apply my texture correctly. I can see two ways of doing this- by allowing the UV coordinates go past 1 and setting the UV wrap mode to repeating, or by duplicating the vertices past the seam.

Here are some pictures that should describe my problem a little better. One is an Icosahedron which has been subdivided once and the second has been subdivided twice. The problem still remains.

Icosphere earth

The zipper problem

The problem is I have absolutely no idea how to go about detecting the UV coordinates that need to be fixed, or the vertices that should be duplicated. Here is the script I am using. (Mine's a small bit different but the generation of the icosphere is the same)

In an effort to better explain what's happening, here's what I want the UV map to look like, versus what it currently looks like.

enter image description here enter image description here

How do I detect these points in code, and then edit the UV coordinate array to point to an "imaginary" vertex?

DCON
  • 628
  • 5
  • 18
  • Any comments to help me improve the question are more than welcome. – DCON Nov 22 '17 at 18:47
  • It is unclear if you want to map your texture onto the whole icosphere, or if you want some kind of repeating pattern? – Dan Byström Nov 22 '17 at 20:41
  • Yes, I wish to map the texture onto the whole icosphere. I'm aware that if I could make the UVs U value at the seam increase by 1, the issue would be resolved and the shape will still remain as a real icosphere. I just have no idea how to detect the UVs that are on said seam from code. – DCON Nov 22 '17 at 21:19
  • You could treat it as a sphere. That's a common and well-known problem. However, at the poles it gets a little twisted... – Dan Byström Nov 22 '17 at 21:34
  • Yeah, using a UV sphere would be good- however, I'm planning on deforming the mesh with various types of noise at run time in the game. This makes a typical UV-Sphere somewhat unsuitable for me. – DCON Nov 22 '17 at 21:52
  • Well, by treating your icosphere as a sphere, you can calculate polar coordinates for the verticies. Your task then is to come up with a formula to convert (ϕ, θ) into (u,w). That's about it! ;-) – Dan Byström Nov 23 '17 at 13:29
  • Could you point me in a direction where I may be able to visualize what you're trying to say a little better? – DCON Nov 23 '17 at 20:54
  • It's ok now! I figured out how to do it. I duplicated the vertices on the seam and then made my before the seam go to the new vertices. I did this by detecting the triangles that were first on the seam, and then filtering out the vertices that had a UV coordinate > 0.2. This left me with the vertices that were in need of duplication. I then duplicated them and made the triangles on the mesh that matched the above conditions use the duplicated vertex as part of the triangle. I also increased the UV coordinates of the new vertex by 1. – DCON Nov 24 '17 at 00:36
  • 1
    I will be adding this change to the unity wiki of creating an IcoSphere. – DCON Nov 24 '17 at 00:37
  • Nice work!! :-) – Dan Byström Nov 24 '17 at 07:56

0 Answers0