I would like to procedurally generate planets, but I don't know how to wrap a heightmap around a sphere. I already know how to generate plane heightmaps, but not how to generate spherical ones. Can someone push me in the right direction?
1 Answer
Typically the strategy is not to produce a spherical height map, but instead to produce a normal height-map and wrap it around a sphere. You can find some questions on the site already about this process.
There are a number of strategies for doing this, some of them as simple as mapping the Cartesian coordinates to spherical coordinates, or warping the 6 faces of a cube into a sphere (similar to this). There are plenty of ways to represent your map.
Care needs to be taken to ensure your height-map properly wraps so that the terrain meets up where your height-map touches itself. Creating tileable noise is a start, but you can also use techniques like the diamond square algorithm to easily generate wrapped noise.