#### Archived

This topic is now archived and is closed to further replies.

# making a sphere

This topic is 5653 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

hey, im sure we have all written code to do this a few million times, im getting a bit sick of it, so i figured someone somewhere must have written code to produce a nice evenly spaced sphere. (or close-to-evenly - [from memory perfectly evenly spaced is close-to-impossible/pain-in-the-a?] [i do want to be able to generate the sphere in a short time period..]) also, i was contemplating trying to make the sphere into one big triangle strip (is there much point to this? performance enhancements?) [i want texture coords aswell btw] thanks guys!

##### Share on other sites
you can produce even spheres, by using a docedahedron (20 faces), and recursively split the triangles into 4 triangles, by taking the midpoint of each edges and joining them. You need to ''normalise'' the midpoints (push them up a bit so the are on the surface of the ideal sphere), or else you''re gonna end up with a very tesselated dodecahedron. Not very useful

You can produce a LOD very simply like that (just reduce the recursion).

Note that you have to be careful about the way you texture it. As everyone knows, it''s pretty hard to apply a 2D texture to a sphere (squeeze at the poles, stretch at the equator, ...). I would suggest you don''t try to map the whole dodecahedron as a continuous strip of triangles, but rather, brake it in a few bits, to reduce the stretching. As if you literally took it apart and laid the bits flat on the table.

You could split the texture into 20 triangles, where each triangle of the dodecahedron would map directly to it. So you''ll have to duplicate the 20 vertices, to have a set of unique texture coords for each vertices, and each triangle would map to a triangle on the texture. After that, when recursing, you batch a single LOD of a each base triangles in one strip. So 20 strips * number of LODs. You don''t have to go to such extremes, and brake the dodecahedron into 4 or 5 parts.

An interesting part of this technique, is if you go pretty far in the LOD, you can directly produce terrain vertices, or make the sphere not so perfect easily, with even deformations.

1. 1
2. 2
3. 3
Rutin
15
4. 4
khawk
14
5. 5
frob
12

• 9
• 11
• 11
• 23
• 12
• ### Forum Statistics

• Total Topics
633662
• Total Posts
3013229
×