Creating Nebulas and Starscapes in Fantasia + Source Code!
Oct 27, 2010
Yes! I just released support for new type of filters in Fantasia that I called Creations. The first, Nebula Creation, allows me do to starry background images like this (source code below):
Update: shortly after releasing the source code I noticed the nebula image was fixed (only the opacity mask was varying), fixed it and uploaded again.
Or this:
If you’d like to try for yourself, open Fantasia now (http://fantasia.nokola.com) and go to Creations (after Effects).
The first one is done by creating a nebula with no stars (set to zero), then Tint, then add stars. The second one is just the Nebula generator I find both very usable for space shooter games
The Creation filters work with the selection brush, and you can easily sprinkle some stars on an image:
Original:
Starry night:
The starry night version looks much more interesting…just waiting for few comets to pop up! Original image is from here: http://www.flickr.com/photos/dagoaty/4360363431/
I also made a small sample that has just the Nebula generator: http://nokola.com/nebula
I used lots of various sources on perlin noise (like Ken Perlin’s homepage and multiple algorithms for noise), until I got to the current version. It’s optimized to use integer numbers (fixed point calculations) throughout.
A little bit on the algorithm: the important part of the logic is drawing a low-frequency noise (freq = 2) on screen by masking it’s opacity with exponentially filtered high frequency noise (freq = 7). Thus, the low frequency noise becomes a smooth nebula, and the high frequency noise tells “if there’s nebula on screen or not”. In the source code there are a lot of internal parameters to play with.
Hope you like it! Please comment!