# OpenGL Mapping a Cube To A Sphere

This topic is 2993 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Could somebody please explain a bit more on how this works, i have been looking at various proof especially this maths proof.

http://mathproofs.blogspot.com/2005/07/mapping-cube-to-sphere.html

What i dont really get it do i make a cube and then project it on to a sphere or am i drawing a sphere and map the heightmap using log and lat to the sphere.

Also them equations are a bit dificult to understand, im can program terrains etc, but i cant for the life of me get round them equations, well the best way to aproach this.

Also i have no idea how to aproach this with code all examples are in opengl, anything directx lurking around, or maybe im just to dumb to undertsand it.

So far i have 6 Vertex buffers and 6 Index buffers all hold 1 face of a cube, which is a grid i can define the width and depth of the cube, in the class. Now i want to morph it so to speak in to a sphere, after i will atempt to add some sort of LOD, but for now gotta get this working.

so far i got this. different colors representing diferent faces, esentially there all just a simple brute force terrain, without the heightmap applyed.

[IMG=http://img404.imageshack.us/img404/6907/screenshot1tx.jpg][/IMG]

[Edited by - Budinga on July 4, 2010 9:43:28 AM]

##### Share on other sites
ok i managed work it out just gotta work on the normals and the heightmap conversion, i supose the heightmap has to be converted over to sphere coords too.

[IMG=http://img69.imageshack.us/img69/6458/screenshot7bo.jpg][/IMG]

##### Share on other sites
I know it may lack details but I do have an image up when I worked on this myself showing some LOD levels and how it looks when image mapped here.

##### Share on other sites
very nice, i am in the process of implementing LOD now, but the way i did it was 6 heightmaps of a cube then comverted it to sphererical coords. So once i finnish the LOD classes i will have 6 quadtrees all bent in to a sphere. By the way any idea on how to calculate the normal of direct3d 9 plane, im having a hard time finding the answer.?

##### Share on other sites
Quote:
 Original post by BudingaCould somebody please explain a bit more on how this works, i have been looking at various proof especially this maths proof. http://mathproofs.blogspot.com/2005/07/mapping-cube-to-sphere.html
You might also be interested in Iñigo Quílez' technique for the same. His has the advantage of also showing a way to compute a continuous tangent space.

##### Share on other sites
Thanx. Any ideas on getting normal vector of a d3d plane??? as far as i can see its just

dim p as planedim normal as vector3 = new vector3(p.a,p.b,p.c)

is this correct or am i missing something??

##### Share on other sites
ok this is solved now. But just a question of advice do you guyz think i should use Roam or Quadtree for my planatery engine.

1. 1
2. 2
3. 3
4. 4
Rutin
14
5. 5

• 10
• 11
• 14
• 10
• 25
• ### Forum Statistics

• Total Topics
632652
• Total Posts
3007659
• ### Who's Online (See full list)

There are no registered users currently online

×