# How to make a sphere

I want to make a sphere mesh. I want the sphere to be a collection of symetrical flat faces. The is, the sphere is made up of some number of polygons, all of which are the same size.

Please give a really good explantional (mathmatical) about how this is done.

thanks,
Matthew
###### Who is Participating?

x

Commented:
What you are asking may not be possible.

There are the Platonic Solid (regular polyhedra)
http://mathworld.wolfram.com/PlatonicSolid.html

The most spherical is probably the duodecahedron (12 pentagons)

Then there are the Archimedean Solids (semi regular)
http://mathworld.wolfram.com/ArchimedeanSolid.html

The most spherical is probably the soccer ball, but it uses two different polygons.
0

Commented:
The Soccer Ball is properly called a Truncated Icosahedron
http://mathworld.wolfram.com/TruncatedIcosahedron.html

You can approximate a sphere with other polygons (triangles for exampe), but you can not guarantee that they will be the same size or shape.  In fact, you can guarantee that they won't be.
0

Commented:
Take a look at the Geodesic Dome:
http://mathworld.wolfram.com/GeodesicDome.html

How close an approximation to you need??
0

Commented:
0

Author Commented:
It would be really convienent if all the faces were the same. Since that's apprentent not possible, the goal would be to limite the variation and number of faces as much as possible. Using the 'soccer-ball' method, it is possible to use the two shapes, a pentagon and hexagon without variying the face size, and using any number of faces?
0

Commented:
No.  You can't add more faces to the soccer ball.

You can add faces to a geodesic dome, but not an arbitrary number.

What are you trying to do??
0

Author Commented:
programming a scene where I am representing a planet. I want to be able to move for and away from the planet and have a good representation of varying terrain.

The real trick is the transition between being far enough out that the suface of the sphere has no relief, and coming to the point where it starts to. The logical way I see to handle this is to create a spehere made up of large number of flat surfaces, each of which has its own relief pattern. When the camera is close enough to an individual surface the relief of that surface, and a nunder of the surrounding ones, will become visible, this will act as a smooth transition to the surface of the planet.

In order to do this, I need to be able to break the surface of this planet up into roughy equal sections that are mapped.
0

Commented:
Going back to geodesic domes:

Take the first triangulation of the duodecahedron:

I believe when you can replace each pentagon with five identical triangles.
So the sphere can be covered with 60 identical triangles.
The triangles are indentical, but isosceles not equilateral.

So in the next step, when you replace each triangle with three smaller triangles, they will not be identical.  You will need 180 triangles, but only two different shapes.

It gets worse from there, but that is quite a good approximation to a sphere.

Does it have to be better than that??
0

Commented:
Hi

A question: What engine are you using?
If you're using OpenGL you can use MipMaps to achieve this kind of effect with gluBuild2DMipmaps, and you prefer, you could use gluSphere to generate the mapping coords automatically...

Bye
0

Author Commented:
the duodecahedron will not work. It's way too far from sphereical.

I need to formula which allows me to stipulate a variable number of surfaces which make up the sphere.

The geodesical dome might work, except the sufaces seem to be highly variable in size, which will not work either.
0

Author Commented:
I do not want a api specific solution, nor do I want to achieve the effect with texturing.
0

Commented:
Ok...

So try using geodesic dome, and if you want to use different detail levels, i suggest you to use Octrees, to achieve a good performance.

http://www.gamedev.net/reference/articles/article1485.asp
http://en.wikipedia.org/wiki/Octree
0

Commented:
You have a sphere.  You know how big it is.

So you can find the area:   A = 4 * Pi * rÂ²

You know how many faces you want: Call it n.
So take N equilateral triangles (or squares, or pentagons, or octogons) each with area  A/n.

Start pasting them on the sphere.  They won't fit perfectly.
When you're done, you'll have to tweak everything.
You will probably wind up with a lot of different shapes.
0

Author Commented:
what do you mean, 'alot of different shapes'?  You specify using the ~ N equilateral triangles (or squares, or pentagons, or octogons) each with area  A/n.

this method might over strictly using a slight overlap, if I use a sufficant number of faces. I'll have to try it.
0

Commented:
starting with a triangles from an icosahedron like
[
[[0,-1,\$p],[0,1,\$p],[\$p,0,1]],
[[0,-1,\$p],[0,1,\$p],[\$p,0,-1]],
[[0,-1,-\$p],[0,1,-\$p],[-\$p,0,1]],
[[0,-1,-\$p],[0,1,-\$p],[-\$p,0,-1]],

[[-1,\$p,0],[1,\$p,0],[0,1\$,p]],
[[-1,\$p,0],[1,\$p,0],[0,-1,\$p]],
[[-1,-\$p,0],[1,-\$p,0],[0,1,-\$p]],
[[-1,-\$p,0],[1,-\$p,0],[0,-1,-\$p]],

[[\$p,0,-1],[\$p,0,1],[1,\$p,0]],
[[\$p,0,-1],[\$p,0,1],[-1,\$p,0]],
[[-\$p,0,-1],[-\$p,0,1],[1,-\$p,0]],
[[-\$p,0,-1],[-\$p,0,1],[-1,-\$p,0]],

[[0,1,\$p],[1,\$p,0],[\$p,0,1]],
[[0,1,-\$p],[1,\$p,0],[\$p,0,-1]],
[[0,-1,\$p],[1,-\$p,0],[\$p,0,1]],
[[0,-1,-\$p],[1,-\$p,0],[\$p,0,-1]],
[[0,1,\$p],[-1,\$p,0],[-\$p,0,1]],
[[0,1,-\$p],[-1,\$p,0],[-\$p,0,-1]],
[[0,-1,\$p],[-1,-\$p,0],[-\$p,0,1]],
[[0,-1,-\$p],[-1,-\$p,0],[-\$p,0,-1]],
]
where
\$p=(1+sqrt 5)/2;
you can subdivide them triangles with vertices at
\$p = \$p0*sin((1-\$t0)*\$w)+\$p1*sin((1-\$t1)*\$w)+\$p2*sin((1-\$t2)*\$w);
\$p = \$p/sqrt(\$p Â· \$p);
where \$w = arccos((1+sqrt 5)/sqrt(20+8*sqrt 5));
for 3 t values of the form
(\$t0,\$t1,\$t2) = (i/n,j/n,(n-i-j)/n))
(\$t0,\$t1,\$t2) = (i+1)/n,j/n,(n-i-j-1)/n)
(\$t0,\$t1,\$t2) = (i/n,(j+1)/n,(n-i-j-1)/n)
where 0 <= i+j < n,
or
(\$t0,\$t1,\$t2) = (i/n,j/n,(n-i-j)/n))
(\$t0,\$t1,\$t2) = (i-1)/n,j/n,(n-i-j+1)/n)
(\$t0,\$t1,\$t2) = (i/n,(j-1)/n,(n-i-j+1)/n)
where 0 < i+j <= n
and (\$p0,\$p1,\$p2) = one of the above triangles

0

Commented:
Here is a more organized way to cover the sphere:

You have a sphere.  You know how big it is.
So you can find the area:   A = 4 * Pi * rÂ²

You know how many faces you want: Call it n.
So take N squares with area  A/n.

The edge dimension of each square is  s = sqrt( A/n).

Put a belt of squares around the equator.

You will need approximately   K  =  nint( 2 * Pi * r / s)  squares.

Adjust the dimensions slightly so that they fit and have the same area.

Work your way toward the poles.  You will need approximately K rows.

Because of symmetry, you will only need approx K/2 distinct shapes.
Most of the shapes will be spherical trapezoids.

When you get near the polar cap, you can switch to either a single regular polygon or set of triangles (pie slices).
0

Author Commented:
d-glitch, this is the way most sphere mesh creating programs work, when you say you will only have k/2 shapes, this is true. But for a well defined sphere, it would be well into the hunders.

Again, one patter would be best (I realize not possible); two patters is very doable, at three we are getting into looking for a completely different way of accomplishing this. Having 10's of different shapes (or more) is not an option.
0

Commented:
> I need to be able to break the surface of this planet up into roughy equal sections
How roughly equal to they need to be?
Would the triangles generated by http:#a21829966 be close enough?
If not it may be possible to tweak them to be a little closer.
Would you prefer to allow a slight distortion of the sphere to make the triangle
areas slightly closer?
0

Author Commented:
(ozo) they need to be sections that I can map definitions to. If every one of them is difference (or lots of them a difference, then I need alot of definitions and thats not going to work.

I am still considering your technical post. I can't just look at that and understand what you saying, I'm going to need to plug that into code. May take a little while but i'll get to it.

Maybe another way to state the problem would be this. Is it possible to break up the sphere, not into a group a flat polgons, but a group of polygons which represents part of the curvature.  A hemisphere would be an example of this. How far down can that concept be taken?
0

Commented:
0

Commented:
here's a close to uniform tesselation
http://public.lanl.gov/ringler/files/2001.11.01.EOS.pdf
0

Author Commented:
The concept of the  Dodecahedral Sphere looks very promising. Please give me some time to consider it.
0

Commented:
Just start with any platonic solid (cube is easy), then recursively tessellate the faces until you have the approximation you want.
0

Commented:
After tesselation, all the faces will be congruent isoceles triangles.  However, I'm not sure if that meets your 'symmetrical' requirement.
0

Commented:
after tessellation, the faces will be only approximately congruent.
0

Commented:
Wait, you're right.  When an isosceles triangle is tesselated, you get 2 congruent triangles and another triangle different from the first two.
0

Author Commented:
What  a pain this is. While some of these solutions definately fit the bill of the original problem I proposed, the solution will only really work if there the polygons that make up the surface of the sphere are similar in shape and orientation.

I think I'm going to try a difference approach. I will construct a algorithm that build a sphere mesh in the traditional method, as a series of elipsodial rectacngles with a triangle fan at both poles. This is not what I really wanted, but I think it will be easier to map the elipsodial rectangles to a 'map' than to try to map triangles of different orientations to a map.

Everyone who contributed to this solution will get credit.
Thanks!
0

Author Commented:
Thanks for the input!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.