Z-Buffer Implementation In Flash Alchemy

One way to perform perspectively correct texture mapping is via an actual calculation of the z-value at every pixel of the triangle to be rendered. That made me wonder if someone has implemented a simultaneous texture mapping and z-buffer in Flash using Alchemy. It seems that no one has done that yet so I decided to put together a demo (to code it as fast as possible I used PTPOLY1.CPP for the triangle rendering).

The demo shows 100 random (intersecting) triangles textured with a Lena image and is rendering at about 30FPS on my Windows 7/Intel Xeon 5160.

Grab the source code!

Leave a comment.

Google Analytics integration offered by Wordpress Google Analytics Plugin