Procedural Planet Engine Status

Previously I mentioned I was going to do a mulligan on my procedural planet engine. The few hours I’ve worked on it so far have lead to a beautiful new architecture that’s doing most of the same things as before, as well as some major new things, using about 25% of the code.

Previously I mentioned I was going to do a mulligan on my procedural planet engine. The few hours I’ve worked on it so far have lead to a beautiful new architecture that’s doing most of the same things as before, as well as some major new things, using about 25% of the code.

Here is where things stand currently. I’ll go through some of these in more detail in a later post:

The planet consists of a cube, with the vertices mapped to a sphere. Each of the six cube faces is a quad tree which is used for subdividing the terrain as you move closer to the planet. Each node in the quad tree represents a patch of terrain with 33×33 vertices that are spread out evenly to cover the patch’s area.

In the previous version the quad tree nodes were subdivided synchronously, which resulted in jerkiness when moving slowly, and outright 5 second waits when moving quickly if a lot of nodes needed to be subdivided. That was good enough then since my priorities were elsewhere, but it’s not good enough for the new version. Now, when a node needs to be split the request is queued on a separate thread. The current node will continue to draw until the split is complete. The split requests can be cancelled as well if the camera has moved elsewhere before the split request reaches the head of the queue.

The nice thing about this design is that if you’re moving very fast you end up getting fewer node splits because they’re cancelled before they happen since they’re no longer necessary. Conversely, if you’re moving slowly the splits can easily keep up with your location so you get all of the required detail. On the con side, if you’re moving quickly down to a low level, then stop, it can take a bit for the queue to catch up generating the terrain patches, so the detail can take awhile to show up.

Generating a patch currently happens on the CPU using Perlin as a noise basis and various fractal algorithms such as fBm, Turbulence, and Ridged Multifractal. I will be moving this to the GPU over the coming weeks which will vastly improve the “catching up” problem mentioned previously. This will also enable creating procedural normal maps and textures on the fly.

So, the current version of the app lets me start out in space and fly to an Earth-sized planet down to ground level with ever increasing detail, and absolutely no stalling. The entire planet can be explored, but there is no texturing yet, and lighting is using vertex normals so it’s fairly ugly, but it gets the job done at this stage.

I think the next thing I will do is work on moving the patch generation to the GPU. This seemed like a daunting task 8 months ago, but it should be pretty straightforward now. This is a requirement to allow generating higher resolution procedural normal maps, which will be a big step in improving the look of the terrain.

So, that’s it for now. In future posts I’ll go through some of these features in more detail and discuss how I did things.

What Next?

So, I worked on Guardian since May, and finally finished it up several weeks ago and it’s up on Xbox Live Indie Games. I won’t be purchasing a fancy car any time soon, but I might be able to use the proceeds for a Sunburn Lighting Engine license in a few weeks. I’ll buy the license anyway, but it’d be cool to do it with money earned from my game.

I spent way too much time and energy finishing Guardian, but I’m pleased to know that I still have it in me after all these years. Still, I want to move back to working on these things as a hobby rather than a money-making enterprise. It was much more enjoyable and relaxing.

So, after a couple weeks off letting my brain recover, I’ve decided to dust off my procedural planet engine and work on it some more. By “dust off”, I mean completely scrap it and start over, using what I learned during the first iteration, and some of the things I’ve learned since while working on other things.

I also plan get back to posting useful things on this blog.

So, I worked on Guardian since May, and finally finished it up several weeks ago and it’s up on Xbox Live Indie Games. I won’t be purchasing a fancy car any time soon, but I might be able to use the proceeds for a Sunburn Lighting Engine license in a few weeks. I’ll buy the license anyway, but it’d be cool to do it with money earned from my game.

I spent way too much time and energy finishing Guardian, but I’m pleased to know that I still have it in me after all these years. Still, I want to move back to working on these things as a hobby rather than a money-making enterprise. It was much more enjoyable and relaxing.

So, after a couple weeks off letting my brain recover, I’ve decided to dust off my procedural planet engine and work on it some more. By “dust off”, I mean completely scrap it and start over, using what I learned during the first iteration, and some of the things I’ve learned since while working on other things.

I also plan get back to posting useful things on this blog.