# Heightmapping a sphere

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

## Recommended Posts

I'm working on a game where the heightmap is determined at run time from user inputs. I know the standard method of applying a texture to a sphere, which results in the poles having more sampling points. I'd like to expore other options that are better suited to the surface of a sphere than a rectanglular grid. I'm trying to find a method that satisfies the following criteria: 1. More or less equal sample points for an area of any arbitrary longitude or latitude. 2. A well defined and easy to calculate neighborhood for any given sample point. In the same way that a regular 2D square grid has well defined neighbors. (Neighborhood(x,y) in a 2D grid is the set of points such that x is in {x-1, x, x+1} and y is in {y-1, y, y+1}) 3. A method that makes it easy to calculate the value of any given data point. A 2D regular grid is easy, since you just have an array of arrays. I can imagine some tree structures that would make you traverse the tree to find the values of certain data points, which isn't a good solution. Hope I've been clear so far. I'm thinking of a geodesic sphere or something similar. I'm not sure how to represent the data points of the sphere in memory. Since it doesn't need to be stored in any sort of image format, alot of possibilities open up I think. Just interested in some outside opinions. [Edited by - Numsgil on November 11, 2006 10:25:43 PM]

##### Share on other sites
My coworker solved how to map a cube to a sphere. It works pretty well, check it out here

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

##### Share on other sites
Gotta love the internet. I spent my weekend trying to turn a cube into a sphere (with not very pleasing results) through trial and error and very little maths, then browsing Gamedev during my lunch break on Monday I find exactly what I need.

##### Share on other sites
This is not new though.. 3dsmax has a "spherify" modifier that does the same thing....

##### Share on other sites
you could also use a geodesic sphere to eliminate the increasing samples towards the poles

##### Share on other sites
I like the idea of a "geodesic spherical grid", which I'm looking into now. This atmospheric model has some good links.

##### Share on other sites
Quote:
 Original post by ph33rMy coworker solved how to map a cube to a sphere. It works pretty well, check it out herehttp://mathproofs.blogspot.com/2005/07/mapping-cube-to-sphere.html

Wow, that's a lot of maths. Personally i'm just normalizing and rescaling by the radius each vertex in the grid of each face of the cube. What's the advantage of your method ?

Y.

##### Share on other sites
Quote:
Original post by Ysaneya
Quote:
 Original post by ph33rMy coworker solved how to map a cube to a sphere. It works pretty well, check it out herehttp://mathproofs.blogspot.com/2005/07/mapping-cube-to-sphere.html

Wow, that's a lot of maths. Personally i'm just normalizing and rescaling by the radius each vertex in the grid of each face of the cube. What's the advantage of your method ?

Y.

...that's not really a lot of math. ...Are you looking at the proof and saying that(even if you are, that still isn't very much math....probably took 10 minutes to perform that transformation once he had his theory correct)
x' = {x*((sqrt)(1-((y*y)/2) - ((z*z*)/2) + ((y*y*z*z)/3)}

that computation isn't very expensive at all considering the millions of other methods.

##### Share on other sites
Quote:
Original post by Ysaneya
Quote:
 Original post by ph33rMy coworker solved how to map a cube to a sphere. It works pretty well, check it out herehttp://mathproofs.blogspot.com/2005/07/mapping-cube-to-sphere.html

Wow, that's a lot of maths. Personally i'm just normalizing and rescaling by the radius each vertex in the grid of each face of the cube. What's the advantage of your method ?

Y.

Using you're method you'll get a higher distribution of vertices near the corners of the cube.

##### Share on other sites
What if you read the information from the height map as elevations of latitude and longitude? That way the map is already in spherical coordinates and the duplication of the vertices would be at the poles.

1. 1
2. 2
3. 3
4. 4
Rutin
12
5. 5

• 12
• 16
• 10
• 14
• 10
• ### Forum Statistics

• Total Topics
632659
• Total Posts
3007692
• ### Who's Online (See full list)

There are no registered users currently online

×