My first post was about the 3D Flash library I’m currently working on : DirectFlex. As I said, it is not a simple 3D engine but a full 3D API like DirectX or OpenGL. As Flash 10 is likely to be available when the first public version of DirectFlex will be released, I decided to rewrite the API’s core to take advantage of the new 3D mathematics classes and the hardware acceleration features. This is actually the third time that DirectFlex is entirely rewritten from scratch… but time after time the quality of the work and the performances have improved a lot.
DirectFlex and the good old Flash 9 …
DirectFlex’ developpement started more than a year ago and it was designed to be used in Flash 9. It’s first “correct” rendering was a wireframe spinning cube. One year later, it’s last Flash 9 version was able to draw up to 3 000 polygons at 20 frames per second.
Here is a screenshot of a flat-shaded 3D model loaded and displayed with DirectFlex. This mesh was actually extracted from Counter Strike 1.6 and is the 3D model of the GIGN skin. With 3000 polygons you can draw this very 3D mesh up to 7 times.
As you can see on the screenshot, the framerate is about 23 frames per second. It’s not much, but it is enough to be perfectly smooth inside the Flash player. I could do some ActionScript magic to get a 30 frames per second framerate but that would require a lot more CPU. The most important thing is to get a smooth display without draining to much CPU, and that’s exactly what we have here.
Here are two extra screenshots :
Please keep in my mind that those screenshots come from the “old” Flash 9 version of DirectFlex. A lot of changes have been made since. However, those screenshots are a good apetizer… and there is a lot more to come with the new Flash 10 version. As you might have understand, my main objective is to make sure the “basic stuff” runs as fast as possible. Then some fancy effects will be added…
So what’s new with Flash 10 (doctor) ?
Well the drawing API is a bit faster, and DirectFlex can now draw something like 5 000 polygons at 20 frames per second at least without any hardware acceleration. In fact, hardware acceleration in Flash 10 is still tricky and I didn’t manage to enable it for now. Flash 10 is still in beta and is a work in progress. Performances are not stable yet and it is pretty hard to make a good guess about the final release capabilities.
Still, I’ve been running some tests and Flash 10 seams to be capable to compute up to 50 000 vertices. As you can make at least 16 000 polygons with those 50 000 vertices, it is indeed very frustrating to be able to draw “only” 5 000 of them in the end. Now that Flash 10 has a powerful 3D mathematics API, the drawing API seams to be the real bottleneck but I guess hardware acceleration will make it (a lot) faster.