Advertisement

generate sphere

Started by May 29, 2022 02:37 PM
12 comments, last by _Flame_ 2 years, 8 months ago

Hello.

I am curious what is the best way to generate 3d sphere. I am using such simple method:

  1. Generate tetrahedron.
  2. Split tetrahedron faces into subfaces by dividing every its line by 2.
  3.  Repeat point 2 recursively until required detalization has reached.
  4. Normalize every point, multiply them by radius and draw triangles

This approach works but i don't get regular points. Look at the picture.

Is it because tetrahedron not the good starting shape and it is better to use a different shape like icosahedron?

Or is it something wrong with my implementation? What is the best approach  to do this?

Hmm… I'm not sure, but it may be that normalising at each step (rather than only at the end) might help.

I also seem to think that it might work better to split your tetrahedron faces at their vertices, with new edges running in towards what was the centre of the face. This should ensure that you keep producing triangles all the way through.

MWAHAHAHAHAHAHA!!!

My Twitter Account: @EbornIan

Advertisement

First approach doesn't help much.

Second is even worse. When a new triangle is created then one side will be from an original triangle and new ones will be much less. When we continue then border triangle will have same edge length every time. Definitively not regular.

I am thinking that maybe tetrahedron is not really a good starting shape. The problem is that despite vertices have same distance from a center but distance from a center to an edge is very different. Maybe for a perfect solution distances from a center to vertices and to edges must be same. It's not possible but maybe the less difference the better result is.

_Flame_ said:
When a new triangle is created then one side will be from an original triangle and new ones will be much less.

I'm not sure that this will hold if you then normalise the vertices.

After all, for each face so split into triangles, normalising should affect the new vertex (the one at the centre of the face) and not affect the two extant vertices, meaning that the edges that connect to that new vertex will become longer, while the edge between the extant vertices will be unchanged.

Thus I think that my two suggestions above, if used together, may help.

MWAHAHAHAHAHAHA!!!

My Twitter Account: @EbornIan

Sure distance from a center to vertices will be same but distance between triangle vertices will be very different anyway. Since we subdivide a triangle then two new sides will be definitely less and less. For regular points we need same distance between them.

Ah, yes, I see what you mean.

I'm not sure of the answer, then, I'm afraid. However, a quick search indicates that others have asked similar questions in the past--perhaps amongst them you might find a previous thread in which someone found the correct answer.

MWAHAHAHAHAHAHA!!!

My Twitter Account: @EbornIan

Advertisement

Thaumaturge said:
Hmm… I'm not sure, but it may be that normalising at each step (rather than only at the end) might help.

Running this in my imagination, i think normalizing each vertex on it's creation would help to get more uniform edge lengths.
If you tessellate a flat faced polyhedra, and project only the final result to the sphere, the edge lengths near the original vertices will be shorter, because they are initially already close to the sphere.

Thaumaturge said:
I also seem to think that it might work better to split your tetrahedron faces at their vertices, with new edges running in towards what was the centre of the face. This should ensure that you keep producing triangles all the way through.

Taking this literally, no this would be bad. If you create new vertices only at triangle centers, the initial edges would never refine to become round.
Splitting edges and forming a new triangle from the midpoints is good. It turns one initial triangle into 4 new triangles, improving the approximation over the whole surface. Triangles have similar area and similar angles. So that's ideal, and afaik it's called ‘loop subdivision’

Another good method would be to split edges, create one new vertex from triangle canter and create 3 new quads for the triangle. That's Catmull-Clark subdivision.

_Flame_ said:
Is it because tetrahedron not the good starting shape and it is better to use a different shape like icosahedron?

Icosahedron would give more regular initial triangles, after that you still have to choose from the same two options of subdivision.

Because your screenshot has no back face culling, it's confusing and i can't see what you have done.
But it does not look wrong. I can see higher tessellation at some spots. Normalizing should improve this?
Maybe you already have the best result we could expect from a tetrahedron, but that's maybe not what you want.

Notice: Tetrahedron creates only 4 singularities (at initial vertices), so our irregularity will be focused over 4 spots.
Trivial latitude / longitude tessellation has just 2 singularities, and here the poles really pop out from looking at the wireframe, because all sliver triangles focus on those poles, while all the rest is quads. That's sort of what i mean with 'focused irregularity'.
If you use a cube for the start we have 8 singularities, the initial vertices where only 3 quads meet, while all other vertices have 4 quads. That's much better already.
IDK how many singularities a icosahedron causes, but likely much more.

But singularities have their own downsides, for example texturing, which becomes much harder.
So if you want to texture your sphere, a cube is the clear winner and you should use that.
If you want cool wireframe, icosahedron gives that.

… wow, that was quite a lot of blah about simple spheres ;D

JoeJ said:
Splitting edges and forming a new triangle from the midpoints is good. It turns one initial triangle into 4 new triangles, improving the approximation over the whole surface. Triangles have similar area and similar angles. So that's ideal, and afaik it's called ‘loop subdivision’ Another good method would be to split edges, create one new vertex from triangle canter and create 3 new quads for the triangle. That's Catmull-Clark subdivision.

Ah, I see! I didn't know that--but it does make good sense, I think. That's interesting! ^_^

MWAHAHAHAHAHAHA!!!

My Twitter Account: @EbornIan

JoeJ said:

Running this in my imagination, i think normalizing each vertex on it's creation would help to get more uniform edge lengths.
If you tessellate a flat faced polyhedra, and project only the final result to the sphere, the edge lengths near the original vertices will be shorter, because they are initially already close to the sphere

Yes, my bad.

Here is what i have with back faces culling enabled.

Without normalization.

Only final step normalization

Every step normalization.

I am not sure every step normalization is better than only final step.

@JoeJ Thank you for such detailed explanation. I see that only approximation is possible. Generated triangles always have different densities because vertices and edges have different distances to a center.

JoeJ said:

… wow, that was quite a lot of blah about simple spheres ;D

I also thought this topic is very easy but turns out it is not quite

Maybe i will go for a cube.

I am not sure every step normalization is better than only final step.

Depends on our criteria. If we want all triangles to have the same area, similar edge lengths and angles, step normalization comes closer to our goal.
But the tessellation looks more irregular, so post normalization wireframe looks better to my eyes.

I now remember i tried the same two options with a cube a while back. And surprisingly i ended up preferring post normalization as well.
But i did not use recursive tessellation and tried to get equal edge lengths with some trig instead. Maybe i did something wrong with that math.

This topic is closed to new replies.

Advertisement