Paint it RED - A Molehill 3D Port

Paint it RED - A Molehill 3D Port

In the wasteland that was early Flash 3D, developers had only a handful of polygons to create their interactives, and the idea of true dynamic lighting was a pipe dream. Working against limitations like that taught you to be flexible and creative in how you built your apps to achieve certain effects, but for some commercial projects it was just a bridge too far. One of our favorite experiments that fits pretty squarely into this category was an interactive 3D camera customizer for RED Digital Cameras. While it was ambitious, the awful frame rate from Flash hamstrung it from the beginning. Now that hardware acceleration is almost here (the anticipated release data for Flash player 11 with hardware support is Q2 of 2011, for what that's worth), we figured it was time to start revisiting some of those projects and see if they've entered the realm of possibility. Here's a sample of what we found.

The RED One video camera is a sick piece of hardware that we'd been drooling over for a long time. The idea behind the RED is that it's a fully customizable core digital camera, and then you add as many accessories as you want to add different capabilities (lenses, rails, monitors, drives, jetpacks, Gatling guns, tiny dinosaur arms, etc.). Our Papervision proof of concept was a tool for adding these features in real-time and then interacting with the rig in 3D to get a sense of what it looked and felt like. After a few months, we finished over the Holiday break in 2009. Because this was a high end site, we felt that we had to jam pack as much detail as we could into our models, so the poly count was pretty high (well, for Papervision) at around 9,000 for a basic rig of the base camera and 6 accessories.

After squeezing out all of the performance that we could, we still wanted to incorporate some dynamic lighting effects into the piece. For Papervision though, the built-in texture lighting didn't do much more than render weird lines around all the models and darken their textures. So instead, we dynamically textured the lens of the model and synced a timeline lens flare with the camera model's rotation as it moved past the user. Then we rotated the flare movieclip within the texture to compensate for any lateral rotation of the camera model, so the flare wouldn't appear to rotate side-to-side as the camera moved in 3D space. After all this, we had dynamic lighting on the camera lens that looked pretty good, and it didn't cost us much performance-wise except a little elbow-grease ahead of time. This wasn't very portable to other objects though, and since the rest of the lighting had to be baked onto the textures this wasn't enough to push it over the top.

We had accomplished some limited dynamic lighting, but the performance was still awful with just a handful of accessories attached, and that was the bigger of the two requirements we needed to meet. Finally, with heavy hearts, we grudgingly decided to shelve the project there and move on. But like elephants, we never forgot it.

When Molehill was announced and the dust had settled, we did an analysis of Flash 3D options and picked Away 3D as our direction for implementation, based on it being a consistently solid, open-source product with a huge user-base behind it. Their Molehill-enabled alpha version called Broomstick has been pretty easy to get up and running and the examples it comes with are a good starting point for basic interaction. Here are some tutorials for getting setup in our favorite IDEs:

Since we started porting over old projects we've been blown away by the performance we're seeing, though as with ongoing development on any alpha project there have been stumbling blocks. When code bases change so rapidly or some functionality that you wanted to use isn't incorporated yet into the Flash player it can definitely be frustrating. But when you see an app that was running at 4fps and 60% CPU now running at 60fps and 0% CPU, the code refactoring is a lot less painful and you get a bit more patient :)

Anyways, here is the same model brought into Flash player 11 (not all of the interactivity is back in from the initial proof of concept though).

Molehill RED Cam Demo

To view it you'll need to download Flash Player Incubator, preferably to a browser you don't use often as it puts a version number at the bottom of all Flash embeds. Also, FYI: there's a quirk with uninstalling Incubator on 64-bit architectures sometimes, so if that happens just use the regular flash player uninstaller and it'll do the trick.

Also, here's a YouTube comparison of the two. The performance levels that are included are higher than they run normally because Camtasia was open, but yeah, they're pretty incredible for the new 3D classes. For Flash 3D guys that have felt squeezed in the past by limited resources and high expectations, Molehill is shaping up to be one hell of a good time.