Fun with Spheres

I’ve been getting the feeling that my random planet generator isn’t finished yet. I’d really have liked to polish it up and make it look really nice, so a couple days ago I set out to fix the most daunting thing, the aliasing near the poles. The issue is basically that some points are too close together while others are too far apart. While this problem isn’t easy to solve mathematically, you can get pretty close by making each point act as a repeller, and then constraining all of them to move along a sphere:

Oct23-Oct23-0832

An initial set of 100 random points after it’s settled into stability. It’s pretty even, but the points don’t have the regularity that I’d like them to.

Oct23-Oct23-3121

The rectangular projection after it has been repelling for a short while; you can still clearly see the sampled lines. This is already significantly better than before, partly because of the repelling but also partly because I created proper nodes for the two poles. What’s interesting is that if you KEEP letting this run, pretty soon the symmetry of the lines gets broken and a pattern similar to the random points appears.

Oct23-Oct23-1458

This one starts with a surface refinement described in http://paulbourke.net/miscellaneous/sphere_cylinder/. You start with an octahedron and then turn each face into four faces by bisecting the edges of the faces and creating new triangles out of the resulting shapes… the URL describes it much better :P This has good spread and regularity, and also has the added bonus of already having calculated the edges that each node is next to (so I don’t have to triangulate it to get a mesh).


Just for funzies, I decided to wrap the whole thing in a GUI and give some options to play with.

Click to see sketch

Advertisements