Sign in to follow this  
bpoint

6 polygons - sphere

Recommended Posts

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!

Share this post


Link to post
Share on other sites
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).

Share this post


Link to post
Share on other sites
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? :)

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this