Flash 9 Example : 3d Landscapes (Voxel Engine)

This is something I’ve been wanting to put online for a long, long time. In fact; this is almost the exact same version as I had during the Flex 2 beta’s; it’s been that long (almost a year now!!!! damn). I’ve been wanting to put alot of work in this, but basically, I don’t have the time, and don’t really see enough time to work on it. Besides, I’ve joined the FC64 team, and as soon as I get some real time, myself and Martin Wood hopefully get some progress on doing SID emulation… (it’s commodore, it’s sound, it’s AS3, it’s oldskool; what do you want more for a hobby project ;-) ). Next to that, I’m turning in a Flex 2 fanboy, and finally recently started loving Flex 2 data services more and more too…busy, busy, busy. Anyway, let’s get back to this thing.

When I first got my hands on AS3, the most obvious thing I could do was doing al these ‘seemingly processor intensive’ effects, like you’ve seen coming by here earlier, or stuff I showed at presentations. Voxels where one of the first things I started to do, and had a fun time doing them. Just never got to finish this…..

So, what’s this ? The technical incorrect name for the effect is a Voxel engine. The history of more high quality voxel engines probably started with ‘Comanche Maximum Overkill’, a pc game which in it’s time had some amazing 3d visuals. Later on the game “Outcast” used a heavily ‘pimped’ voxel engine to produce some amazing graphics for the year 1999. This year the legendary Amiga demo group “The Black Lotus” released a demo called “Ocean Machine”, showing of some real, real hardcore voxel work, running amazing graphics on an Amiga with no 3d graphics acceleration, and a CPU running at 50Mhz. Have a look at the youtube video here. So, the power of voxels is established.

Although one might call this demo a Voxel Engine, it isn’t entirely, since a real voxel engine would represent volume in 3d space, while this type of engine usually has a limited freedom of vision and motion because of it’s inherent 2d nature. Where as a voxel should represent volume in a 3d space, this type of engine represents 2d in a semi 3d engine; confused yet ? Actually, the maximum amount of freedom this type of engines is very restricted; but it gives something we still need; raw speed. Although the algorithm is relatively heavy, it can be optimized pretty easy; implemenations of Voxel engines have been done on mobile devices, calculators and of course, the good old c64.

This engine on itself does the generation of a 2d image based on a perlin noise image it uses for a heightmap (that what actually represents the height), and textures an image based on those heights (and doesn’t really do such a good job at the moment). Then it goes to the drawing phase, where it draws a part of the map based on a virtual position of a viewer and it’s view angle and field of view, and draws columns very much similar in a way to what a raycasting engine would do. Of course the master of raycasting in Flash is Andre Michelle, so go and have a look there.

This demo should have had a lot more, but for now it already has some pretty nice tricks; LOD (level-of-detail), implemented in 3 different ways, for speed, although buggy, there’s a lot of clipping going on, and that what is clipped doesn’t always seem to connect with the rest. Bilinear texture filtering, and ofcourse a procedural texure generator. I’ll get back at doing the real work on it, one day…..one day…..one day…..
For now it’s more a proof of concept, although this concept really didn’t need the proof, it just needed execution.

See the engine in action, make sure you have Flash 9 player.

This entry was posted in Examples, Flash, Technology. Bookmark the permalink.

5 Responses to Flash 9 Example : 3d Landscapes (Voxel Engine)

  1. felix says:

    sweet! I wanna bomb stuff!

  2. mr.doob says:

    Great! Mix it with my rotozoomer (plus deformation) and we got a demo!! ;)

  3. Great stuff! I hope to be able to play Comanche in Flash someday. Really enjoyed that game!

    Though it also kinda shows how far behind calculation speeds in Flash still are. I mean, my 386 sx 33 was probably slower than my cell phone, but produced far better graphics than the lastest Flash on a new computer.

  4. Jayden Scott says:

    we always redo our landscape every 2 or 3 months to adapt to the changing weather.,`’

  5. landscaping can give a great look to the garden lawn that is why i a change in landscape each year ,`”

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Notify me of followup comments via e-mail. You can also subscribe without commenting.