Mapping a Cube To A Sphere

Started by
5 comments, last by Budinga 13 years, 9 months ago
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.

Thanx in advance.


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]
Advertisement
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]
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.
Developer Journal: The Life of Corman
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.?
Quote:Original post by Budinga
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
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.

Tristam MacDonald. Ex-BigTech Software Engineer. Future farmer. [https://trist.am]

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??
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.

This topic is closed to new replies.

Advertisement