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.

nebula1

Or this:

nebula2

If you’d like to try for yourself, open Fantasia now (http://fantasia.nokola.com) and go to Creations (after Effects).

image

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 Smile I find both very usable for space shooter games Smile

The Creation filters work with the selection brush, and you can easily sprinkle some stars on an image:

Original:

starBefore

Starry night:

starAfter

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 

Download source code

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!

    

New Directional Rainbow Brush; Smear Effect; EasyPainter Out of Beta and Becomes Fantasia!

Jul 25, 2010

Yes! A lot of announcements today:

The new Fantasia Painter is here: http://fantasia.nokola.com

  1. New Rainbow brush makes ultra cool smooth color transitions, based on stroke direction
  2. EasyPainter includes all Fantasia brushes and is now named Fantasia!
  3. Fantasia is out of Beta! There is new, enhanced Undo functionality, improved interface.
  4. Smear procedural brush effect makes for reallistic paint “feel” when drawing

Details below:

Rainbow Brush

The rainbow brush changes color based on stroke direction. It cycles through the color wheel.

Here’s a sample:

rainbow

Try making strokes multiple strokes from left-to-right, then from top-to-down, then from right-to-left to see how it feels :)

Fantasia Lite + EasyPainter = Love (= Fantasia Painter)

EasyPainter has all brushes, is out of beta and has an undo stack that is limited to 400 MB and captures undo data every second, if there is a change.

This allows even a mid-stroke undo capturing – a must have for nice experience with the new brushes.

I had this brush improvement in mind probably for the last 5-6 months. It’s nice to finally see it done.

Also, there is a small, but significant UI improvement – some extra margins are removes and a little bit of space is added between some controls. This makes the whole program easier to read. The background behind the image is a little darker too, to “give out the color” some more.

Smear Effect

All of the History procedural brushes (Sketch, Furs, Rainbow), now include “Smear mode”, which looks like this:

smear

Notice how the “Smear on” paint has some darker regions, and generally it looks and behaves like real paint. The “Smear off” paint is smooth, and generally looks more “sketchy”. I believe both painting modes have their use.

The smear is easily controlled from within Fantasia:

image

Technical details: The Smear effect is produced by varying the opacity slightly (e.g. from 243 to 255), and then drawing on black background. It’s not exactly random – I’m using a computation (truncation) “issue” with pre-multiplied alpha. When you draw low-opacity (< 20) object in Silverlight multiple times (e.g. 25 times), the alpha sometimes “magically transfers” making the image with less than 255 opacity. In short, the image can get corrupted due to rounding errors. I’m using this corruption to achieve the Smear effect. In a “perfect world” (where all computations are double and alphas are not premultiplied), you can achieve the same effect by lowering the destination alpha by 2 or so every time you draw a pixel with opacity < 10.

Last but not least: here’s a rabbit made by Burcu with Fantasia. Burcu is one of my new colleagues.

 

 rabbit

That’s all! Needless to say, I’m happy with Fantasia now.

Hope you like it too! Please comment!

nokola.com | Terms | Log in

Recent

About the author

Happy & enjoying life. Software enthusiast.
The opinions I express here and on nokola.com are mine and not my employeer's (Microsoft).
This is the official blog of nokola.com. You can find Silverlight samples, coding stuff, and hopefully other interesting things here.