Deviation Actions

Donitz's avatar

3d block

By Donitz
6 Favourites
Yay, more 3d stuff. There's really tons of potential in this type of modelling. It is somewhat hard to see but there are several floors inside each building behind the transparent windows.

The idea is simple, just stack enough flat images on top of eachother and you'll be able to create 3d models with as much detail as there are pixels. I already used this technique in the game Deadly Investigation.

I'd love to make a human body with organs and skeleton and all that in this way, but drawing the images would take forever and I don't have nearly enough skill (or an MRI machine).
Image details
Image size
400x400px 50.66 KB
© 2010 - 2021 Donitz
anonymous's avatar
Join the community to add your comment. Already a deviant? Log In
BeNerdish's avatar
So... these are voxels, aren't they?

Nice work, wonder how it's done in code?
Donitz's avatar
If I understood the wiki on voxels correctly I think you could consider this volume rendering. Most real voxel graphics is rendered using raycasting.

The code is only about 46 lines long. This is the rendering section.

engine.rotation += 0.01;
engine.renderBitmapData.fillRect(engine.renderBitmapData.rect, 0);
for (var i:int = 0; i < cityBlocks.length; i++) {
var transformMatrix:Matrix = new Matrix();
transformMatrix.translate(-engine.resolution.x * 0.5, -engine.resolution.y * 0.5);
transformMatrix.scale(2 + i * 0.02, 2 + i * 0.02);
transformMatrix.translate(engine.flashResolution.x * 0.5 - i * 0.5 + 20, engine.flashResolution.y * 0.5 - i * 2 + 30);
engine.renderBitmapData.draw(engine.bitmapData[i], transformMatrix, null, BlendMode.NORMAL, null, false);

where engine.bitmapData[i] is each slice of the city as bitmapData.
wonderwhy-ER's avatar
Nice :) I actually wondered how much would this weight. Is it drawn in vector?

I also wonder if it is possible to do dynamic graphics like that. Like there is also Z and each object is array of layers by Z :) Should work fine I guess :) And then you can make some GTA1/2 like game in flash :)
Donitz's avatar
It is still drawn in the same method as the electric field cube. With the exception that I drew the final result on a single bitmapData rather than stacking them on top of eachother. There was a significant performence boost using that method, so I implemented it in the cube as well.

Adding other objects to the scene shouldn't be too hard. In GTA 1 and 2 (and in take no prisoners) the people were just rendered as flat sprites in a 3d world. You would just need to sort the objects according to Z order and render them on top of the correct image layer.
wonderwhy-ER's avatar
Yes I know that they were rendered flat. What I mean that with this technique it is possible to render them not flat and move in layers.
BTW after seeing your stuff I would like to make my 3D tree in this technique. Looks like fun :D You just used Flash 3D to stack and rotate them?
Donitz's avatar
I used the transform matrix to move each slice of the landscape just a tiny bit away from the direction that camera would be looking at. I also used matrix.scale to scale up the higher slices to give it a sense of perspective, and matrix.rotate to simply rotate each slice in their new position.
wonderwhy-ER's avatar
So no 3D transforms at all :)
Reminds me of Zappan work [link]
anonymous's avatar
Join the community to add your comment. Already a deviant? Log In