Space Demo

June 15, 2011 General News 0 Comments

I've set aside terrains for a bit to explore more space-related content. In particular, I wanted to build a decent 3rd-person camera for use with all things space-related. The camera came out nicely; I just used simple damped spring physics. The scene that I'm using for testing, however, is actually turning out to be more interesting than the camera.

I slapped together an implicit model of some kind of blobby battleship or something, just to do some flybys and test out the camera. Of course, given how easy it is to tweak implicit models, I quickly got carried away and ended up adding a pretty cool interior - meaning that you can fly the fighter right into one of the side tunnels (BSG style :D) and park in one of the four garages inside the ship. Cool! It amused me for quite some time. And it only took about 45 minutes of experimentation to make it. I love implicit models!!

The only downside, as is evident in some of the pictures, is that the normals aren't well-behaved when you start getting really fancy with density functions (i.e., when you start having regions carved out of solid regions). The normals produced using my standard method of gradient estimation were complete garbage at some points on the mesh (especially inside the ship), so I had to discard them and use post-computed normals instead (the kind where you sum up all the planar normals for each vertex and compute the weighted average). This makes the normals a little nasty at points, since marching cubes tends to add slivers and such that screw with the normal computation.

Oh well. On the whole, I'm really happy with how this demo is shaping up. Did I mention it's only 198 lines of code/28kb packed exe? Hooray for procedural content!