6 polygons - sphere

Started by
4 comments, last by dimebolt 18 years, 6 months ago
Hello all, I have a bit of an odd request. I am attempting to render 6 polygons (built similar to a cube map) as a sphere within the world. All six "pieces" are actually separate objects themselves -- they have their own textures/normals/etc. Basically I'm guessing I will first have to subdivide the polygons by some desired amount, then distort the mesh so each corner is bent "downward" and the center is pulled "upward". From there, each mesh would have to simply be rotated and translated into position to give the desired sphere. I've tried implementing this myself already, but it doesn't generate very realistic meshes... the sphere is either not much of a sphere at all, or it's more like a rounded cube. :( I think the ideal method would be to extract 4 points (near the corners of the mesh, but not too close) and then warp against some algorithm, but I'm a bit lost. I've tried to Google for doing something similar to this, but the best I've been able to find is sphere generation code (which inevitably leads to using gluSphere -- definitely not what I'm looking for). Does anyone have any suggestions (links/papers/anything) on how something like this could be implemented? I apologize if my explanation is a bit hard to understand. If something needs clarification, please let me know. Thanks!
Advertisement
Sphere generation is usually done in one of the following ways:

1) Subdivide a platonic solid (usually icosahedron) - platonic solids are symmetrical so subdividing them and normalising each newly created point produces good approximations to a sphere.

2) The UV method - basically you subdivide the sphere into latitude and longitude.

3) The random repulsion method - I don't know much about this one but basically it involves placing a lot of points randomly on a sphere, then doing a repulsion phase where you move one randomly away from all the others, repeat a lot, then compute the convex hull of the result. I don't know much about that one, but I will say this: NEVER use quickhull for that calculation.

It sounds like you basically want to do (1) with a cube - see here for some sphere generation code. It doesn't seem to do cube-based ones though (actually it only seems to work with triangles).
Quote:It sounds like you basically want to do (1) with a cube


That sounds about right... so I started Googling again and managed to dig up this (scroll down near the bottom for the cube subdivision).

Unfortunately, this method looks like it suffers from a bit of distortion. Along each of the edges there would be a kind of compression of the vertices, which will undoubtedly cause some artifacts. If each of the planes are properly warped, I would think that they should align together perfectly, just like a cube... maybe? :)

Searching a bit more yielded this, where a bezier surface is used to distort a texture (scroll down halfway). This looks more correct, but I'm not sure how adaptable it would be to my mesh data. I'm gonna try to rummage through the source and see if I can get anything useful from it.

Anyone else have any other good ideas out there? :)
Find the spherical coordinates (r, θ, φ) which delineate each corner of each square. Then just make a mesh over the spherical coordinates for a given square, converted to rectangular coordinates.
Quote:Original post by Sneftel
Find the spherical coordinates (r, θ, φ) which delineate each corner of each square. Then just make a mesh over the spherical coordinates for a given square, converted to rectangular coordinates.


That sounds just like what I'd like to do.

Unfortunately, I haven't a clue as to where to start. I've never even messed with spherical coordinates before, to be honest.

Do you have any other resources or information on something I could start with?
Quote:Original post by bpoint
Quote:Original post by Sneftel
Find the spherical coordinates (r, θ, φ) which delineate each corner of each square. Then just make a mesh over the spherical coordinates for a given square, converted to rectangular coordinates.


That sounds just like what I'd like to do.

Unfortunately, I haven't a clue as to where to start. I've never even messed with spherical coordinates before, to be honest.

Do you have any other resources or information on something I could start with?


I like mathworld and the wikipedia. Another great site is google.

Tom

This topic is closed to new replies.

Advertisement