AIR 3.2, Stage3D and Minko: 100k polygons at 26fps!

AIR 3.2 beta 5 is available on Adobe Labs, but one of the most ancitipated new features is the addition of Stage3D for Android and iOS devices (iPhone and iPad). Thanks to AIR 3.2 and Stage3D, Flash developers will now be able to create 3D applications targeting mobile devices. According to Adobe’s engineer, GPU-wise performances are very close to what you would have with a native apps. And that’s really incredible (I guess we now just have to wait for the VM to catch up but thing are getting better and better…).

As a member of the private prerelease program, I have access to AIR 3.2 for Android/iOS with Stage3D enabled. So I decided to give it a try with the latest prerelease drop. And boy was I impressed! My test device is an HTC Desire HD with Android 2.2 (official HTC rom). I build a very simple mobile application with Flash Builder 4.5 and Minko (thank you Thibault for letting me post that photo!):

The framerate, memory usage and other values are tracked with monitor. And that’s right, it’s a bit more than 100 000 polygons at 26 frames per second! Here is the code:

public class Teapot extends Sprite
  private var _viewport		: Viewport	= new Viewport();
  private var _scene		: StyleGroup	= null;
  private var _shader		: IShader	= new CelShadingShader();
  private var _lightMatrix	: Matrix4x4	= new Matrix4x4();
  public function Teapot()

    // simple scene: camera and a teapot with normals
    _scene = new Group(
      new Camera(new Vector4(0, 0, -12), new Vector4(0, 0, 0)),
      new NormalMeshModifier(new TeapotMesh(40))

    // use the cel shading effect by default
    _viewport.defaultEffect = new SinglePassRenderingEffect(_shader);
    // grey background
    _viewport.backgroundColor = 0x666666;

    // setup the stage
    stage.frameRate = 30.;
    stage.addChild(, ["numTriangles"]));
    stage.addEventListener(Event.ENTER_FRAME, enterFrameHandler);

  private function enterFrameHandler(event : Event) : void
    // rotate the light
    _lightMatrix.appendRotation(0.01, ConstVector4.Y_AXIS);
      "light direction",

    // render

You can find the full source code on my GitHub.

That’s only a few lines of code, and yet it displays a Utah teapot with cel shading and a rotating light. An important thing to remember is that this cel shading effect is coded using ActionScript shaders. AS shaders is a feature of Minko: you program the GPU with ActionScript code and Minko’s JIT compiler turns it into AGAL bytecode at runtime. And the ActionScript to AGAL shader compiler runs just fine on mobile devices. Even better: Minko 2 will feature a new and even more optimized compiler so it will be very easy and very efficient to program mobile GPUs with ActionScript code!

Considering my phone is not supposed to perform as well as the Samsung Galaxy SII or the iPad 2, I can just imagine what you can do on those! But I’ll have an iPad 2 tomorrow and I’ll try to see how BlackSun performs on it, so just be patient :)

AIR 3.2 will be available “very soon” and so will be Minko 2. In the meantime, you can start playing with Minko 1 and get ready to rock on mobile devices! As usual, if you have questions/suggestions, please post them in the comments or on Aerys Answers.

17 thoughts on “AIR 3.2, Stage3D and Minko: 100k polygons at 26fps!

    1. alchymi

      Bon je me répond à moi même j’avais pas lu la suite de l’article ..

      As a member of the private prerelease program, I have access to AIR 3.2 for Android/iOS with Stage3D enabled. So I decided to give it a try with the latest prerelease drop.

      Les boules ^^

  1. temp

    Sounds good.
    I’ve tried ND2D on my iPad.

    Cloud sprite test
    PC: 25 000 sprites
    iPAD: 19 !!!
    Everytest is slow like hell..

    What i’m doing wrong?

    1. Promethe Post author

      It’s hard to tell. I don’t know how ND2D works.
      But the iPad (1 and 2) seems to have difficulties when you try to use more than 200 draw calls per frame. Which should be enough for a game if culling is done properly.


  2. Lotus

    Hello ~
    I’ve been trying this source in flash C5.5 with of course the update of AIR 3.2…
    But this i cannot get this teapot to work. I get the following errors :, Line 77 1180: Call to a possibly undefined method lessThan., Line 46 1180: Call to a possibly undefined method getNamedParameter.

    I really dont understand why i get this. I would be really great-full if anybody have a fix for that.


      1. Lotus

        Oh thank you -
        So this swc is a part of Minko 2 ?
        Everything is working well now, i’m also really curious to try the shader lab soon ^^
        Really great work.


        1. Promethe Post author

          That swc IS minko. But an intermediate unreleased version of Minko 2.0.
          It features only a small subset of the new features.


Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>