Sunday, December 19, 2010

Procedural Nebulas



Now, I'm not sure that Carl Sagan would approve of space being so routinely depicted this colorfully, but let's face it... things can get a little boring without a splash of color. But if you want to get all "Sci Fi nerd" about it, the bulk of a player's time in this game will be spent on the fringes of an area of the universe known as "Wild Space." Further still, and the mostly vacuous solar systems of the inner universe are replaced with labyrinthine corrals of solid matter, which will hopefully be a feature of Ring Runner Part 2! We're crazy enough to want to include Wild Space in this installment of the game, but we're not crazy enough to attempt it, yet!

The video above is a demonstration of just a few of the over 4 billion possible nebulae that Ring Runner: Flight of the Sages can generate.

All nebulae are a result of simplex noise, which is basically a modernized version of Perlin noise of Tron fame, and fluid dynamics, which is a GPU-based, physics-driven simulation of the motion of fluids. These fluids can have varying density and are dispersed by a variety of forces, such as explosions, sine waves, cyclones, etc. The effected density map is used to determine alpha (transparency) values. The darker the pixel, the less opaque it will be.

The same density map is used as a height map, so it can be lit in a semi-realistic, three-dimensional way. Just imagine that rays of light are traveling across several hills. The tallest hilltops, represented by the brightest pixels, will receive the most light, while occluding areas of lower elevation, represented by dimmer pixels, in the direction that the light is traveling.

If there is enough interest, we would be willing to make more technical posts detailing elements of the process.

Happy holidays!

1 comment: