tags:

views:

47

answers:

2

I'm about to go mad. I cant for the life of me figure out texture coords. I have a Octahedron defined by the 8 triangles below. I want to map a texture of the earth on it. See the texture here: http://img37.imageshack.us/f/earthmap1k.jpg/

I would like the north pole at the top point and the south pole at the oposite point with the equator wrapped around the center points. Can someone show me the UVs for each point to map the texture please?

 0,  0,  1
 1, -1,  0
 1,  1,  0

-1,  1,  0
 0,  0,  1
 1,  1,  0

 0,  0,  1
-1,  1,  0
-1, -1,  0

 1, -1,  0
 0,  0,  1
-1, -1,  0

 1, -1,  0
 0,  0, -1
 1,  1,  0

 0,  0, -1
-1,  1,  0
 1,  1,  0

 0,  0, -1
-1, -1,  0
-1,  1,  0

 0,  0, -1
 1, -1,  0
-1, -1,  0
A: 

a simple way to think about it is to unwrap your octahedron like so:

   /\     /\     /\     /\   
  /  \   /  \   /  \   /  \  
 /    \ /    \ /    \ /    \ 
X------X------X------X------X
 \    / \    / \    / \    / 
  \  /   \  /   \  /   \  /  
   \/     \/     \/     \/

then, you can just map the points on the plane to texture coordinates

cobbal
Pity about Europe, but hey, they've been on plenty of maps.
Beta
@Beta: True. This is quite an oversimplification, but to properly cover the entire texture in a sane way would require either a change in the geometry (to quads) or a change in the texture (to compress used map bits onto the area that does get rendered).
cobbal
A: 

I'm not sure what you mean by UVs, but each face of the octahedron will correspond to a rectangular region of the map. This will involve stretching and compression, but no cutting, no missing places.

Start by dividing the map into two rectangles, North and South. Now make three cuts from North to South, cutting the map into 8 equal rectangles. The upper left rectangle contains the western half of North America, the eastern half of the North Pacific, and Hawaii. Let's map that onto the first triangle you describe.

If we put a coordinate frame in the rectangle, running from (0,0) (central Pacific at the equator) to (1,0) (somewhere near Equador) and up to (0,1) and (1,1) (both the North Pole), then we can map it to the octahedron as follows:

(s,t) -> (1-t, (1-t)(2t-1), t)

It should be clear how to the same for the other faces.

Beta
Certainly octahedron facets must correspond to *Triangular* map regions - not rectangular. (Triangular in the sense that such regions are bound by 3 geodesic circles, not 4)
Ofek Shilon
@Ofek Shilon: The map regions I describe *are* triangular in that sense. Notice that the entire upper edge of the map, `(x,100)`, corresponds to *one point* on the globe, the North Pole.
Beta