Actionscript 3 (as3) – Real-time voxel landscape

3D, actionscript 3, BitmapData, fun, Math, perlinNoise, voxels

What can be the natural evolution of an isometric engine? Of course a voxel engine…

It was really a lot of time I had this in mind and already did some experiment, but never finalized them.
What I’ll show you now is some first implementation. Source code is already optimized but I need to finish class public methods so I’ll not post source for now.

Let me say that these screenshot really suck, but you got to see them moving (they runs very fast).

This first sample is a bitmap based map. The class wants two bitmap, one for the height map and one for the color. Of course you can use the same twice (but obviously it looks good only with grayscale images). With my brand new Intel Quad core QX9550 I easilly reach the fps limitator of 51 (ok, ok… on the screenshot is written 29 but believe me! :-D ). I am new to multi core cpu and I am really surprised to see that now the browser vs IDE situation totally changed. Now I can do 51 fps in the browser (Opera 9.23) and 30 in the IDE… mmm strange behaviour, maybe I just need some sleep.

The file is very big cause of the low compressed 2000×2000 jpeg files. No preloader (don’t even try to ask for it) so be patient please (631 Kb) ;-)

Actionscript voxel landscape (Image map)

(move mouse to fly around.Map is bitmap based so has boundaries)

This second one is to make you write some comment like: “hey man how can you be so stupid… trying to code a fast voxel engine lots of optimization etc. and then you came up with a perlin noise based sample which simply drain half of the power”… Yeah! but is cool to have infinite landscape and test my new CPU :-D

Actionscript voxel landscape (perlinNoise)

Same but with two octaves… very blobby feeling.

Actionscript voxel landscape (weird 2 octaves perlinNoise)

Expect more about this and more new things. I am preparing a lot of funny stuff.

As usual if you like this let me now via comments and if you want to keep an eye on updates subscribe to my feed



  1. Tom  •  Aug 29, 2008 @9:18 am

    Very cool!

  2. Og2t  •  Aug 29, 2008 @9:26 am

    Yeah! Are you planning to share the source? ;)

  3. Pierluigi Pesenti  •  Aug 29, 2008 @9:30 am

    @Tom: Tnx man, I just looked at your site, awesome minimal style and very pleasurable!

    @Og2t: Yes, it’s written in the post. I have to clean the code a little bit, make correct private/public stuff and some more optimization, then I’ll release the class (very easy to use).

  4. batchass  •  Aug 30, 2008 @2:37 pm

    Could you also share the fps class source?
    It is nice and clean!
    Thanks for inspiration!

  5. batchass  •  Aug 30, 2008 @2:40 pm

    oups sorry, just found it (framerater) please delete my comment!

  6. Alan Shaw  •  Aug 30, 2008 @5:18 pm

    Cool stuff! Looking forward to more, and some source to play with!

  7. Anonymous  •  Aug 31, 2008 @3:48 pm
  8. Pierluigi Pesenti  •  Aug 31, 2008 @4:15 pm

    LOL! I don’t get the point of your minimal comment.
    I never told this is the first ever voxel implementation :D

    However these are two different approaches, this is more detailed but it doesn’t seem to run in real-time @50+fps.

    However my class can achive same result (no fog and no transparent water) simply setting higher resolution (@20fps not 1/20fps)

  9. Frank Reitberger  •  Sep 8, 2008 @3:20 pm

    delicious, some tasty voxels.

  10. Yann  •  Sep 12, 2008 @4:57 pm

    Do you accept freelance work nowadays? Sorry for comment but couldn’t see your email anywhere… Thanks!

  11. Pierluigi Pesenti  •  Sep 12, 2008 @5:16 pm

    Yes I do.

    I will write the e-mail address in the info page, tnx for make me notice that.


    info [at]

  12. wonderwhy-er  •  Sep 25, 2008 @7:27 pm

    Wow. Pretty fast and smooth looking implementation. Add rotation and zoom :)

    One friend of mine played with this too though his version is not as clean and fast as yours.
    Here is his
    And my revamp of it with some additional options like other map generation and rotation

  13. Greg  •  Nov 5, 2009 @5:20 pm

    Can your voxel engine handle discontinuity in the height map? As in a sharp difference in neighboring lines of pixel.

  14. Pierluigi Pesenti  •  Nov 5, 2009 @5:31 pm

    Ehm… actually… no :-P
    However it was a choice for how it is written the performance loss could be very intense, but if you want to try it there is I think a variable or constant set to 4 somewhere, I will look and tell you the exact line soon.

    p.s.: Did I release the code of this? Can’t see the link in the post… I start thinking I am running out of (brain) memory if not :-P

  15. Greg  •  Nov 6, 2009 @5:36 am

    Nope, I don’t think you did ;) Looks cool though.
    I tried a similar thing using pure displacement map and a sharp discontinuity would show holes on the ground X(

1 Trackback

Leave a Reply

Allowed tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>