Procedural Generation

Recently I’ve gotten really into procedural generation and decided to move on to 3D. I managed to follow this tutorial: http://www.gameprogrammer.com/fractal.html#heightmaps and generate nice looking 3D terrain from a heightmap. My question is how to take that terrain and wrap it around a sphere? I want to start making procedural planets, then moons, then asteroids, etc. and once I can figure out how to generate planets I assume most astronomical objects will be pretty easy. Also, how do I implement LOD and quad trees to be able to render whole objects at a distance? I’m not very familiar with how procedural planets work as there aren’t many examples I can find so any help, articles, links, etc. will be very much appreciated.

Well, first you have to work out how to map a heightmap to a sphere, which is impossible because the all the x coordinates at y=0 and y=MAX fall on the same place (the north and south poles)

Funnily enough though, I recently did some experimenting with what you seem to be trying to do.

(this one was before I refined the noise scaling. As you can see the planet got a bit deformed)

Basically what I did was start off with an icosahedron, and then subdivide & normalise it a few times to keep the general round shape:

Then you offset all the points by a random amount, then subdivide again. When subdividing it now, you can’t normalise it, but instead offset the values by the difference between the chord and the arc between the two points.

You’ll need to change the amplitude of the random values as you get more and more refined, but after a lot of tweaking, you can get the sort of landscape like in the second screenshot.

After having read all this post you’re probably going to be quite confused. Planets are not fun to generate unless you have a reasonable idea of what you’re doing. You may be better off trying some simpler things first.

Not if you generate directly in 3D.

To be honest I think what you are trying to achieve is a bit silly. For asteroids and things of similar scale @HeroesGraveDev is nice. But as soon as you move up to moons or even planets, the scales you are talking about mean that either you are going to see a sphere (as seen from far away) or you are going to see a section of terrain.

Why not treat the planet as an icosahedron and generate each triangle as you would a flat (you know what I mean) 3d terrain. The only time the fact that it is a sphere comes into play is when you need to work out the triangles’ neighbours.