This site is now just an archive over the rise and fall of Flash. The domain is available for sale
Login | Register
Flash Player 10 feature: 3D support

Flash Player 10 feature: 3D support

Everybody is talking about 3D in Flash but it has had it's limitations. Flash Player 10 will contain several features that will add to Flash's 3D support, including hardware accelerated 3D texture transforms and extensions to the 2D drawing API.

"We are basically expanding the 2D APIs that we have and developers will now be able to transform, reposition and rotate those 2D objects in 3D space. This is not meant to try to replace or even replicate the 3D capabilities that are available in the 3D Open Source libraries like Papervision, Sandy or Away3D which you know offer very immersive 3D worlds, advanced lighting capabilities and 3D model import. This is just kind of simple 3D postcards in space kind of capabilities. Sort of like coverflow or 3D on the iPhone, it's 3D for the rest of us that makes it really easy for people with 2D knowledge to do some 3D transformation".

The AS3 code for this looks like this:

function rotateMovieClip(e:Event):void{
    myMovieClip.rotationX += 5;
    myMovieClip.rotationY += 4;
    myMovieClip.rotationZ += 3;
stage.addEventListener(Event.ENTER_FRAME, rotateMovieClip);

Here we're taking a 2D object that can be any Flash display object (such as video, movieclips, sprites, text and so on) and rotate it freely along the three axes The rotationZ property is really the same as rotation is today, but when coupled with the other two it gets a new meaning. The object is still 2D but it gives a nice illusion of 3D. This is however also the same as hardware perspective scaling of bitmaps, one of the operations used in the Open Source 3D engines, so once added, this should increase the playback speed of these and coupled with Pixel bender it should make it possible to create richer 3D environments than formerly possible.

Attendees at the recent FITC conference in Toronto got to see an example of this when Ralph Hauwert showed off Papervision with some really amazing effects running on an early version of the Flash Player 10 beta. Adobe has given various people from the community projects early access to the beta and the results have been amazing. Expect the results of this to surface in demos later today and in the weeks to come.

Tom: "We wanted to create simple to use interactive 3D that doesn't add anything to the SWF filesize, but at the same time we really want to support 3D based actionscript and 3D libraries. We think they're just amazingly cool and they really do serve a different audience. We really want to support both going forward and I think we've added some features that should be really helpful between Pixel Bender and the drawing API enhancements. Just seeing the demo [at FITC] where Papervision was running so much faster in Flash Player 10, using a variety of the features. "

"We also do have additional APIs for working with the 3D object as a matrix transformation, camera controls so that you can change the perspective a fair amount. There will also be 3D methods that will allow you to do better animation using your 2D knowledge and expanding that to 3D. When you see this in action, you can see that it's very fluid animation. We are really pleased with how high performance the 3D effects are. The thing I'm really excited about though is how easy this is to work with."




Justin explains "The way I created this was that I laid out the cellphones with Actionscript in a circle. I then took each of the phones and rotated them 90 degrees so they were all vertical, and I then told it's parent, the carousel to point at the screen and all of a sudden you have a three dimensional object. I can control that whole thing by just rotating the carousel around the Y axis. They don't need to know how each of the phones are positioned in 3D space. That just actually comes as part of inheriting the 3D representation from it's parent." Click here to see this demo (video).

The GPU is used for more than these 3D transforms as well. Both blitting to the screen and compositing raster content are done using the hardware in the users Graphics card, sort of extending what have been done with Flash Player 9 for scaling. If the right hardware is not available, the Player will fall back to software rendering using the CPU. The developer won't know if hardware acceleration is available on the clients machine but the goal really is to free up the CPU to allow the developer to do more. There will also be two new settings for WMODE, it will be WMODE_DIRECT and WMODE_CPU. Direct will allow you do the blitting and hardware scaling for full screen like we have in the browser, but because we are using the graphics cards to do that blitting, things like transparency and doing HTML overlays don't work because the whole compositing process isn't part of the "breakout" to the GPU, so that's why they are implemented there.

We also have APIs that will allow you to pass in polygons to the drawing API to get them drawn to the screen. When we talked about giving the community based 3D projects lower level access to Flash's rendering model, this is really what we're talking about - though the drawing API. I think

We've also made changes to our filling structure, so right now our Fills are Even/Odd so if you were to create something like a star-shape, you'd see the middle of it with the hollow, all the points would be colored in. That will still be an option for the Drawing API, but we're also offering a Non-zero fill order which means that everything inside the shape, including that middle, will be filled. This is something probably anyone working with the drawing API have run into. You will also have the possibility to do Pixel Bender based fills, so you can do all sorts of gradient styles, generative fills that can expand as you change the object.


Click here to visit Adobe Labs to download and play with the new Player. Click here to see Lee Brimelow explain how to use this feature. This article is part of an interview with Justin Everett-Church (Flash Player product manager) and Tom Barclay (senior product marketing manager) from the Adobe Platform Business Unit.


Get new stories first

Click to follow us on Twitter!



No comments for this page.

Submit a comment

Only registered members can comment. Click here to login or here to register