Deep Under the Sky

Deep Under the Sky

Deep Under the Sky

I’m super happy to tell you that Colin Northway and Rich Edwards released their latest game Deep Under the Sky and I’m glad seeing it received so well. It’s so great to finally see the particle system in it’s natural habitat after all these months but best of all:

I love this game.

In general I’m not a fan of one button games but this one is a great exception. Jetting, rolling, grappling and swinging through the 80 Levels is a hell of fun. The artwork is absolutely beautiful and the score mesmerizing. More than once I lost myself in the flow, gazing right through the screen. These guys spent their time very well, and I’m glad that I had a small role in making this game.

Check it out yourself and buy it now on the


Improved Particle System for Starling

So finally here it is, the updated particle system for Starling, kindly sponsored by Colin Northway (Incredipede). It’s based on and compatible to the original.

Improved Particle System for Starling

For his upcoming game Deep Under the Sky Colin needed some additions to the previous version, especially batching of particles from the same atlas, animated textures, a particle pool, and support for unique filters. Additionally some things came up on the way.

Feature Overview:

  • particle pool
  • batching (less draw calls)
  • multi buffering (avoid stalling)
  • animated particles
  • random start frames
  • (ATF support)
  • filter support
  • optional custom sorting, code and variables
  • calculating bounds (optional)
  • spawnTime, fadeIn/fadeOut
  • emit angle alligned particle rotation
  • various performance improvements
  • some ease-of-use stuff


Starling Video extension

Update 2014-08-25: VideoTexture with StageVideo support for Windows will be released with upcoming Adobe AIR Beta.

Update 2014-10-02: 
Read more about the new VideoTexture in AIR 15:

Update 2014-07-22: Since Adobe won’t fix the bug I reported and unfortunately also dropped FLV format last month, I won’t support this extension anymore.

To cut things short: The usage is similar to the camera extension. You just have to provide the NetStream (and the optional Rectangle for clipping the Video to the Texture’s size if needed). There is no draw/upload strategy since Videos do not have methods for drawing. The bitmapData.draw() function is the only way to accomplish what we want. Like with an ordinary Video (used internally) you will control the Video with the NetStream instance. The provided play(), pause(), stop() functions are just controlling the draw/download methods.

Since Videos do not dispatch Event.VIDEO_FRAME like a Camera, the instance has to check the undocumented netStream.decodedFrames property on every frame, but will only update the BitmapData/Texture if a new frame is available.

Note: Just as the WebcamVideo I built this extension for the very rare cases you need a Video within/behind Starling. Even though there seems to be no faster approach, performance-wise this is even worse than pushing a camera image to GPU. That’s simply because a Video has to be decoded first and especially mobile devices have a hard time with that alone. As a result you’ll soon encounter frame drops and audio glitches on mobile devices, if the quality of the source is too high.

To make it more clear, here is a quote of Tinic Uro:

It’s not recommended that you mix video playback and Stage3D at the same time.

Of course this situation is even worse on mobile where mixing the two will essentially end up as a slide show. There are also technical limitations which prevent us from making this work properly on the most common mobile chipsets even if we had a dedicated code path for video.

It does not make a difference performance wise if you use BitmapDraw.draw or have something like Video.bitmapData. It would be API sugar nothing else. BitmapDraw.draw is very fast if you render in 100% scale. In the end you still need to either 1. decode in software or 2. copy back from the video card and 3. do the YUV2RGB conversion in software. That’s where 90% of the time is spent.

The only way we could ever make this reasonably fast is with a Context3DTextureFormat.YUV. And that’s simply not an option today since support for that is even more fragmented and generally broken compared to compressed texture formats.

If you want to do video stick with StageVideo. But don’t mix Stage3D and StageVideo at the same time.

So you better think twice, whether you use this extension.

Starling Video live demo


Start the demo featuring the trailer to Nina Palin’s »Sita sings the Blues« (720p, licensed under CC-0 license (“Public Domain”))

Actually I’m not sure how fast the connection of my server is. I hope it’s working out for you, since I didn’t add any buffering or controls.

If it doesn’t, you can test the code below locally or check the following link: webcam chat demo (more on that and the filters soon)


Starling WebcamVideo extension

Based on my research I’ve written this Starling extension some weeks ago. I haven’t written on my blog about it, yet, since I had an extension for the Video class in the making as well. I wanted to kill two birds with one stone and “unfortunately” lost track of time writing filters, when I created a real life demo. Thanks for your patience. ;)

As we’ve seen, pushing Camera images up to the GPU can be tricky, but under rare conditions necessary. At least two come to my mind:

  • Augmented Reality. (There is no transparency for Stage3D possible which would allow to use a StageVideo instance behind it.)
  • Real Time Image Manipulation. (Shaders Rock!)

The goal I wanted to achieve with this class is to provide Starling the fastest way possible in pure AS3, for uploading camera images. Usage is pretty simple but if you want to know more about the details, I recommend you to read my previous articles. It’s not a magic bullet, so use with care! If your project has nothing to do with the two points above, I’m pretty sure you’d be better off without this extension.


Webcam Performance with Stage3D – Part II
RectangleTextures in AIR 3.8 Beta (desktop)

As mentioned in the previous article, each side of a regular texture has to be the power of two, which is a major problem for camera images. With the latest beta release of Adobe AIR, the RectangleTexture class was introduced. Those RectangleTextures or NPOT (not power of two) textures don’t have this kind of “limitation”. But they have others: Not every device supports them. They can only contain exactly one image, so no mipmaps can be applied. You can’t upload compressed ATF-files. etc. But they are just perfect for camera images. Or aren’t they? Let’s see.


Webcam Performance with Stage3D – Part I

This article is all about performance using a webcam in Stage3D for e.g. augmented reality applications. If Stage3D is not necessary you should consider the use of StageVideo instead. Unfortunately StageVideo and Stage3D can’t be layered today and I doubt that this will change anytime soon.
edit [2013-06-14]: Today at the Flash Player roadmap online meeting, product manager Bill Howard just said, it is absolutely doable and he might get that back on the list.


Using the Camera in Stage3D Projects can be quite something. Especially when it comes to performance and if you have no experience with GPUs it might give you some headaches. The vast amount of supported resolutions and variety in CPU/GPU power makes this quite difficult, especially targeting mobile devices.

First of all, as you might know, textures have to be a power of 2 in width and height. The image of your camera most likely isn’t and I guess you rarely want it to be. Next thing is, you have to upload it. Uploading textures is a bottleneck. Once the texture is on the GPU, everything is fine, but uploading takes quite some time. You know that if you like games. Even after all those years the preloaders entering a map are still there. The continuously uploading is quite the problem.


Toggling Styles with a bookmarklet

A few weeks ago someone asked in the forums how to disable any styles with a bookmarklet. I think I came up with a pretty nice solution. Webdevs have quite some possibilities to do that, so it’s nothing that special (apart of his actual intention). Anyway I’d like to share it since …

  1. Our results are slightly different.
  2. I found myself toggling the styles of various sites in the following days.
  3. I realized that only few people know about document.styleSheets and the possibilities coming with it, which will play a major role in one of my next posts.

Just click the link below, or drag this link in your bookmarks to try it on another site: toggleStyles


Event.VIDEO_FRAME and Camera.copyToByteArray()

Today I got the amazing news that flash player 11.4 beta has been released. And when I read Thibault Imberts blog I was very glad to see that Camera.copyToByteArray() and Camera.copyToVector() are finally out. And not only that but Event.VIDEO_FRAME is back!

Finally! No need for BitmapData.draw() on a Video and fitting the stage.frameRate to your camera fps anymore!