Heightmapping a sphere

Started by
9 comments, last by Numsgil 17 years, 6 months ago
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]
[size=2]Darwinbots - [size=2]Artificial life simulation
Advertisement
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

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.
This is not new though.. 3dsmax has a "spherify" modifier that does the same thing....
you could also use a geodesic sphere to eliminate the increasing samples towards the poles
I like the idea of a "geodesic spherical grid", which I'm looking into now. This atmospheric model has some good links.
[size=2]Darwinbots - [size=2]Artificial life simulation
Quote:Original post by ph33r
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


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.
Quote:Original post by Ysaneya
Quote:Original post by ph33r
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


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.

Quote:Original post by Ysaneya
Quote:Original post by ph33r
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


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

This topic is closed to new replies.

Advertisement