Jump to content
  • Advertisement
Sign in to follow this  
Budinga

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.

If you intended to correct an error in the post then please contact us.

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.

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]

Share this post


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

Share this post


Link to post
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 this post


Link to post
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 this post


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

Share this post


Link to post
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 plane
dim normal as vector3 = new vector3(p.a,p.b,p.c)


is this correct or am i missing something??

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!