Creating a Sphere from a Cube

Started by
9 comments, last by JustJim 9 years, 7 months ago

Hey there. I've got a general Question about Morphing a Cube to a Sphere.

As stated in my other Threads, I am working with a Quad-Tree ( but that doesn't really mean anything) which stores the

coordinates for each vertex.

My problem is, when morphing the cube into a sphere, (realized with normalization) not every length is 1.

This goes for the Vertices at edges and corners. It seems as I could almost see the Quads edges and corners.

This, at the first look, does not seem like a big problem. My problem is, that I am going deeper the Quadtree, the nearer I am to the

Sphere. This means at a certain distance a small area of the sphere is more detailed. But when the sphere or the Cam rotates and as

it comes to the edges, the area gets wider as the edges are a little longer.

How can I solve that? I mean I am scaling those Spheres a huge time to model planets and this means a small irregularity results in a big one.

Advertisement

Mh as noone seems to answer, I'd like to rephrase my question:

Could this problem be solved when using something with more resolution to begin with? Like a Icosahedron?

As every part of it has the same size when subdividing and normalizing and won't get stretched as a cube, I think it COULD be better.

Is my assumption correct?

Really don't understand a single thing you're saying... are you trying to make a procedurally generated planet, or are you trying to animate a cube so that it nicely morphs into a sphere?

I am generating a Sphere from a cube right at the moment, meaning I have the coordinates for a cube at the beginning and then let the Quad-Tree beein built which subdivides the Quads and normalizes its vertives.

This means at the end there is a sphere, which I can work with.

So I am procedurally generating a sphere atm.

Problem is with this sphere that the lengthes at the former edges are a little longer than the others, though they all got normalized.

Not quite sure if I understand you completely, but it seems to me that the underlying problem is this:

It is impossible to cover a sphere with undistorted squares, equilateral triangles, hexagons etc. E.g. with a subdivided cube, there will be 8 corners (the original corners of the cube) with 3 edges, but all other corners have 4 edges. If you start with an icosahedron and subdivide with triangles, you will have corners with 5 and corners with 6 edges.

How could I generate a Sphere where all vertices have the same distance to the center? Because thats my problem.

My Sphere seems to have the distance 1.0f for most of the time. But when It comes to the vertices which are at the positions of the originally Edges and Corners of the Cube they have the length of 1.0000012f which will get bigger when scaling.

Single-precision floats only guarantee 6 significant decimals of precision.

Niko Suni

Yeah well could be I wronte a zero too much, either way it has a difference, which is pretty annoying when it comes up to scaling.

I rewrote my whole Quad-Tree-Logic to use Triangles instead of Quads and building a Icosahedron as a Base-Figure.

The problem seems to gets really small, as my Triangles won't get different sizes at all. All triangles have the exact same size.

One problem now is the massive grow of data using 20 faces and 12 vertices as a base instead of 12 faces (Quad from 2 Triangles) and 8 vertices though it seems

more efficient.

The Sphere looks more detailed at lower levels. But having 20 Trees doesn't make things fast haha.

If what you want is a "perfect" sphere, then why don't you just create a sphere model in the first place, instead of trying to make one out of a cube?

What exactly was the motivation for you to try to create a sphere out of a cube (that's not a rhetorical question, I really wonder)? That doesn't make much sense to me, honestly. Why do you generate verticles or a cube and then modify (with huge problems) to form a sphere instead? Did you try to use google and find out how to directly generate verticles of a sphere?

This topic is closed to new replies.

Advertisement