Texturing Icosphere

I’m trying to texture an icosphere and am wondering, what I’m doing wrong.
I’m using this texture, which roughly shoud fill the triangles of the sphere with 5 stripes of color.
However, the result looks like that you see roughly 4 stripes, while instead of the 5th thin stripes of the 4 colors are shown:


The uv coordinates are e.g. for v=2/3: u=0; 0.2; 0.4; 0.6; 0.8, while the wrap mode is at WM_repeat for u and WM_clamp for v…

I don’t have any idea why I get these thin stripes, especially because it is not related to the poles of the icosphere (e.g. when painting the upper and lower part white, the stripes are still there).
I have the impression, that from the u-coordinate 0.8 it goes back to 0 instead of to 1 (as expected for WM_repeat) Is there any setting I am missing? Or is the only possibility to define some vertices doubled, to define the u-coordinate up to 1.0?

Thanks in advance.

Well, let me first note that in “repeat” mode, a UV-value of 1 is effectively the same as a UV-value of 0, I believe; the texture, being repeated, touches its 0-side at when it hits 1.

As to your specific problem, I’ll confess that I’m having some trouble figuring out exactly how you want the sphere to be filled.

Do you want the sphere to be filled such that, if one looks at it from a specific angle, one sees the stripes advancing, equally spaced, from one side to the other?

If so, then it may be a matter of going over your UVs and assigning them based on horizontal distance from the left-most point to the right-most.

Or do you want the stripes to surround the sphere, being of equal size to each other (roughly speaking)?

If so, then you might want to assign your UVs according to their top-down angle relative to some starting point–i.e. assigning them in a circle around the sphere.

That is, if the sphere looks from the top down like this, with vertices labelled as letters:

        A_______B
      /          \
   H/              \C
   |                |
   |                |
   |                |
   G\              /D
      \          /
       F--------E

Then we might start at vertex “A” as angle 0, after which vertex “B” would have an angle of 45 degrees (I believe), “C” an angle of 90 degrees, and so on. Divide these by a total of 360 degrees, and we get “B” having a U-(or V-)value of 0.125, “C” having a value of 0.25, and so on.

By the way, looking carefully, I can see a bit of your blue stripe–in the right-hand image, I see green, yellow, orange, and red–and at the very edge a narrow margin of blue, I believe.

Well, let me first note that in “repeat” mode, a UV-value of 1 is effectively the same as a UV-value of 0, I believe; the texture, being repeated, touches its 0-side at when it hits 1.

Yes, that is what I thought, however the periodicity seems only to work if using uv <0 and >1, e.g. for a tile filling a much larger area, not for my case.

Or do you want the stripes to surround the sphere, being of equal size to each other (roughly speaking)?

This, I was thinking of the triangles placed onto 2D like that:

 v ^   *   *   *   *   *           
   |  / \ / \ / \ / \ / \                          
   | *---*---*---*---*---*    
   |  \ / \ / \ / \ / \ / \                  
   |   *---*---*---*---*---*   
   |    \ / \ / \ / \ / \ /              
   |     *   *   *   *   *          
 0 +------------------------> u

So, every color should be shown in a roughly equally amount on the sphere. (The poles region are stretched in the texture)

Correct–although of course you control the scale of your UV-map.

(And even when the UV-map is pre-set, you should be able to offset or scale it in code.)

Ah, I see.

Note, however, that what you’ve described will not produce good tiling, and will have artefacts around the polar regions (those regions where there are separated triangles, at the top and the bottom) and the “edges” of the unwrapped sphere.

(Unless the texture is designed with those matters in mind.)

Note, too, that the map that you’ve laid out there largely avoids the blue areas of your texture–hence perhaps the lack of blue in your rendering.

Ok, with adding two (redundant) vertices, and changing the texture a bit, I get the wanted result:

1 Like