Recently a client asked me to do something which involved a lot of 3D cubes. I did some tests with cubes in the past and I knew the number of cubes you can render in Flash are relatively limited. Lets say you want 10×10x10 cubes = 1000 cubes =6000 sides = 12000 triangles, which is near or already over the limit. So I decided to take a different approach.
When you use an isometric perspective, the cubes are all the same. So instead of rendering each cube every frame, you can render only one cube and use that cube as a particle to render a full scene. This way you can easily extend the limit of +-1000 cubes to 20000 or more cubes.
Motivated by the very cool 3D pixel editor Q-BLOCK by Okuyama Kazuya, but mostly because it was great fun to make, I decided to take it one step further and started to build a simple 3D pixel engine.
![]()
Use the arrow keys to move the character, drag to rotate the scene.
» View 3D Pixel Engine
At this point, the Pixel3DObjects have x, y, z, rotationX, rotationY, rotationZ properties + they support very basic animation (gotoAndStop). As input it uses transparent bitmapdata (I use pngs) Where the horizontal “sprites” are the depth layers, and the vertical “sprites” the animation frames (see img below).
![]()
But a 3D engine wouldn’t be complete without a possibility to import external generated 3D objects, so I also made a Collada parser witch converts a standard 3D mesh to a 3D pixel object:
![]()
» View Collada Elephant
For a good result I had to raytrace the mesh from different angles and regularly check for duplicated cubes. But for big or complicated objects it takes a while to generate all the needed data. So the elephant is actually pre-rendered and just uses the output data from the raytrace object.
I include the source code (with the two examples) but its not what you call user friendly and most features are incomplete or buggy at this point. So you are warned.
Source code: Pixel3D_source












August 31st, 2009 at 2:43 pm
Hmm, isn’t this essentially a Voxel engine?
No matter how it’s called, it’s pretty cool and can be used for some very nice artistic effects.
August 31st, 2009 at 4:21 pm
I’m pretty amazed by this, it hurts my eyes when I rotate the thing (the perspective gets all ortographically-mangled) but I still am amazed, as always with your experiments.
Also, what did you build for the client? Anything you want show us?
August 31st, 2009 at 6:09 pm
Lego heaven
Very nice, there’s definately an online game idea there…
August 31st, 2009 at 6:28 pm
That’s pretty damn sweet. Nice work!
I’m afraid I don’t follow what you mean by: “When you use an isometric perspective, the cubes are all the same.”
Is that that they are all the same angle towards the viewpoint (and hence same light / shading etc)?
August 31st, 2009 at 7:15 pm
I agree with peter, you should pitch lego to do a microsite for them.
That thing is really nice.
Great work.
September 1st, 2009 at 7:52 am
[...] with the way Flash renders 3D, Flash freelancer Kris Temmerman decided to build his very own 3D pixel engine. Do 3D isometrics get any cuter than this?!Smooth your video!This little tip from FlashGamer.com [...]
September 1st, 2009 at 12:53 pm
Thanks for the comments
@Gaspy: yes, its some kind of a voxel engine
@Niels: Sorry, I cant show you that, it isn’t even online at this point (and it ain’t that special
)
@Colm: With isometric perspective, you don’t have viewpoints (or they are infinite)
So you don’t have distortion of the angles and they are all the same, like you say.
Ill think about that Lego pitch
Thanks.
September 1st, 2009 at 2:30 pm
[...] en forme, Neuroproductions, qui vient de s’essayer remarquablement bien à un moteur de pixels en relief en flash. Dans [...]
September 3rd, 2009 at 11:57 am
Absolutely amazing!!!!
September 3rd, 2009 at 12:58 pm
Hey man, cool stuff
September 3rd, 2009 at 2:40 pm
[...] More info at 3D Pixel Fun | Neuro Productions. [...]
September 26th, 2009 at 7:08 am
That is pretty cool, I’ve been watching developement on Voxel engines, specificly Voxelstien, but they seem to be at a stand still… I have experimented with some Voxel simulation, or simulating 3d pixels in Freebasic and currently using GameMaker’s layering system to simulate a 3d pixel side scroller, found here -> http://64digits.com/users/index.php?userid=Scott_AW&cmd=comments&id=266264
September 28th, 2009 at 5:23 pm
[...] un peu de travail c’est tout à fiat faisable comme le propose les équipe de Neuro et leur 3D Pixel Fun : Animation en 3D Pixel [...]
October 24th, 2009 at 11:07 pm
Awesome!! currently I´m making my first experiments with 3d on flash using draw triangles this sample helps to know what can be done without complex APIs, currently I´m trying to figure how to apply lights and shadows, I´´ll check your sample to get some ideas, thanks for posting the code.