UnitZeroOne

Avatar

A blog written by Ralph Hauwert, freelance front-end developer, specialized in rich internet applications, games and visualisation.

Flash 8 Example : “3d” BumpMapping using Filters. (source included)

Another oldskool effect! This technique is called bumpmapping and produces lightened heightmapped and textured images. I’m very happy about how this one looks, but even more on how I got to this. I needed to generate a static bumpmap for another thing I’m working on, and got kind of distracted doing it. I thought it would be a cool thing to do in Flash 8.5, and maybe build myself a little Flex 2 interface along the way.

While coding this in 8.5, it started out as a very mathematically correct (and thus non optimized) version of the basic 2d BumpMapping algorithm. Slowly I noticed that I could maybe do it per pixel, and fast enough to run frame by frame. While optimizing it to run faster, (Miko also put in some effort here) I came to the conclusion that the optimized routine looked amazingly much like a Convolution Filter creating displacement lookups. And what do you know; it is. So I ended up being able to creatie this 8 version of the effect The algorithm itself is very well documented, so I won’t go into that.

The 8.5 per-pixel version takes about 50% CPU (I’m still struggling with some perfomance issues I have with beta 2, how can it be that one (bitshifting) array lookup is slower then 4 getpixels?). Although it is to be expected that that can be reduced, it will never reacht he 5% load this thing gives on my CPU, producing the exact same result. Filters are sooo much fun.

The example shows 2 different combinations of lightmaps, bumpmaps and texture maps (UnitZeroOne and V for Vendetta). It’s the most basic implementation of what the thing could look like. Imagine using animated bump and light maps….

Here’s the example.
[UPDATE]
I’ve taken the sources offline until a reach my workstation again, since I made an error while exporting the project out of FDT. Sorry. Will post them again as soon as possible. Thank you Jens for the tip.
[UPDATE2]
And the sources are available, this time correct.

Preview picture of the now pimped & bumpmapped uzo icon :
Preview picture of a bumpmapped unitzeroone logo

(You will need the Flash 8 plugin!)

Digg, StumbleUpon, Slash and others: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • DZone
  • StumbleUpon
  • Slashdot
  • Technorati
  • blogmarks
  • BlogMemes
  • Ma.gnolia

Related posts :

11 Comments, Comment or Ping

  1. Ciao,

    it looks really cool!
    What about something for Flash Lite?

    Alessandro

  2. All the classes are intrinsic. How can I get into the implementation?

  3. nice one!

  4. Gah, nice job! I had been thinking about tackling this one using the displacement map, but ultimately was too lazy to sit down and do it. Turned out very nice :)

  5. Yeah great job man!

  6. Tom

    Just awesome. Now, if you can port that over to AJAX, I’ll be SERIOUSLY impressed! ;)

  7. That looks amazing. Good job.

  8. Dan

    Looks great. Boards of Canada! :)

  9. Hey, may I include your bump mapping filter in my imageprocessing library (with credits flying out to you of course)?

    Sorry I can not find any contact information on your site.

  10. You have built a good website

  11. ofir

    I’ts awsome!!! unfortunately I can’t open the zip file.
    it says that the zip folder is incorrect…
    ):
    althow it’s amazing. a year wouldn’t be enough for me to create anything like it…

Reply to “Flash 8 Example : “3d” BumpMapping using Filters. (source included)”

Search

Projects & Work

A selection of current work

Advertising