开发者

How do I map a texture onto a Octahedron?

I'm about to go mad. I c开发者_如何学运维ant 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


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.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜