Binary Space Partitioning trees are the new trend to cure the lack of Z-Buffer when building 3D applications for the Flash Platform. Thus, building a fast and robust BSP system is one of the key for a successful 3D API targeting Flash. I won't discuss BSP theory here because it's very easy to find good documentation. I'll rather let you play with a little experiment and discuss what it actually features...
What It Does...
- load a *.3DS file and use it as a mesh
- load a *.PNG texture and use it as a material
- display the mesh using a BSP tree
The vertical slider enables you to play with what I called the BSP precision. This value represents the thickness of the partition planes used to build the BSP tree: the lower the precision, the better the final rendering. When the precision is higher, the BSP is less deep and a lot faster to render. But if the precision is too high, some artifacts occur and the rendering is corrupted. The idea is to find the best rendering quality/number of artifacts ratio.
When checked , the "Optimized BSP" checkbox enables the build BSP where each partition plane will be chosen carefully. This very choice is based on the number of polygons that would have to be cut if that plane was ever used as a partition plane. This way, the final BSP tree features a lot less polygons and is faster to walk through/render.
And the "Wireframe" checkbox speaks for itself I guess... Anyway, wireframe rendering makes it possible to see how the BSP tree actually divides more or less polygons depending on the settings you chose.
And The Good News Is...
Keep an eye on the Triangles Per Second counter (TPS, on the top-left corner of the screen) as you play with the precision slider/optimization checkbox. Changing those values of the BSP tree has a huge impact on the amount of rendered polygons (and the overall performances of course!).
AIR 2.0 brings a lot of new features. Among them is the new ServerSocket class. The Socket class exists since Flash 9 and enabled a lot of new client/server applications. But it has always been limited to client side sockets as long as AIR (and the Flash Platform as a whole for that matter) is concerned. Therefor, this new server socket feature makes it possible to build actual server software using AIR!
Rich of this new and incredible ability, Christophe Coenraets posted a small but yet very powerful code snippet to build an HTTP web server using AIR 2.0!
The following video demonstrates a new "voice gesture" library targeting the Flash Platform. As you might have guessed, those "voice gestures" are pretty much like "mouse gestures" but they are activated by voice only. I guess it uses some kind of voice learning/recognition algorithm. I can't stress enough how trhilled I am to see this kind of new and powerful software coming to Flash. This enables a whole new kind of usages and applications...
A new milestone version of the Flex SDK has just been released and is available on:
Update: corrected a few glitches in the bounding sphere creation routine.
Optimization is always important. But when it comes to 3D for the Flash Platform, it's an everyday battle. The first ideas that come to mind are to avoid:
- redrawing the same regions : each pixel value must be set once and only once
- rendering invisible objects : objects that are out of sight still take a lot of CPU horsepower
While Flash takes care of the first one in its very renderer, the second one is not handled. But that is something we can easily address!
The method is called "frustum culling". The big picture is that every mesh is approximated using a bounding volume (typically a sphere or a box). If the bounding volume is visible, the corresponding mesh is rendered. The two following pictures show the frustum culling caught in action: