Saturday, 7 January 2012


I have been terrible at updating this blog, but with the holiday season over I hope to spend more time keeping it current. I have several things to cover in this post, let me start off with:

Asteroid Belts

What good is a solar system without an asteroid belt or planetary rings? It's not. So therefore I've decided I need them. At the moment I'm just using randomly scaled spheres for asteroids, but soon I will be procedurally generating something a little more realistic. The rings themselves use the same underlying code as the planet. A ring model is created and the patches are subdivided based on a metric. (In this case, distance to the camera). At each subdivision, asteroids are created that are proportional to the size and density of the patch. The asteroids are then distributed within the patch based on density, and Normally distributed 'vertically' from the patch.  The density is determined by a randomly generated 1D texture that is smeared across the ring model. This is the same texture that is used at long-distance to give the appearance of rings.


After I made asteroid belts and asteroids, I thought about impact craters. Planets without atmospheres don't get a lot of protection from stray rocks whizzing around space, and tend to get bruised up. I modified Voronoi noise to only return values for cells that had a 'color' greater than a given threshold. Then, using the distance of a point to the cell center, we can build a reasonable approximation of a crater. It's not perfect, but its good enough for the time being. 


I finally got around to 'implementing' a model loader so that I can load in some human generated content if I need to. I chose the OBJ format because, well, I found an open-source loader for it online. It integrated into my code very easily and I was up and running with some free models I got off TurboSquid.

That's all for now. I have some more things to write about Atmospheric Scattering but that will have to wait for another time.