AGAL2 is here

AGAL2

After a bit of a start and stop first round, the Adobe team recently stated that they were back and working on the AGAL2 specification, a feature that was previously available in an earlier beta version of the Flash player, but later dropped but a feature set that I had been eagerly awaiting.

Anyone who joined us at the last Stage3D online conference will have seen the Adobe Flash team showing off some of the great new player features, which included demonstrations of AGAL2 in action, amongst other features. Today, I’m really excited to see that the new beta player is available for download and the AGAL2 features will be available publicly in the next iteration, which is scheduled for public release next month. Meanwhile, we can download the latest beta player from Adobe labs:

 

What’s new in AGAL2?

AGAL2 offers a set of additional features that can be used to improve the visual fidelity of rendering output in your Stage3D projects. This means that Flash graphics are about to got a lot sexier. Features such as MRT help to increase the speed of rendering by referencing multiple render to target textures from within a single shader pass, we have additional features and memory space. So what can you expect to be playing with? Here is a quick overview of some of the new features:

  • Multiple Render Texture (MRT)
  • Anisotropic filters
  • Conditional forward jump
  • Increases in register space
  • Floating point textures (RGBA_HALF_FLOAT)
  • Partial derivatives (ddx, ddy)
  • Fragment depth (od)
  • Texture anti-aliasing

 

Multiple Render Targets (MRT)

MRT is a feature that will allow a shader to access a number of addressable render targets. This is useful when considering the concepts used in deferred rendering. Deferred rendering is a technique in which multiple images are rendered sequentially and then those images are composited back into a final result. The memory space used during this process is often referred to as the GBuffer and will contain channels such as; albedo, light, normals, depth etc. There are a number of advantages to this technique, perhaps most notably, the ability to render lights to an independent light map, which is then combined with the scene accordingly.

deferred-shading

 

Anisotropic Filtering

Anisotropic filtering is used to improve the artifacts that are caused by viewing a surface at an oblique angle. The image below illustrates the difference in output quality where the texture on the right is being anisotropically filtered.

anisotropic-compare

To make use of this feature is very simple. A new sampler parameter is now available that can be placed within a tex operation as such:

tex ft0, v0, fs0 <2d,anisotropic8x,miplinear,wrap,dxt1>

The anisotropic sampler parameters can be any of the following:

  • anisotropic2x
  • anisotropic4x
  • anisotropic8x
  • anisotropic16x

 

Conditional Forward Jump

If you are familiar with an if statement, you are already well equipped to dealing with conditional jumps on the GPU if you’ve used that with an else statement, then you’re really ready to roll. Prior to this, AGAL required various hacks to achieve similar functionality with branching that required checks against register data. The conditional flow controls of AGAL2 allow for execution of shader code upon a particular condition. These operations are:

  • IFE – (if equal)
  • INE – (if not equal)
  • IFG – (if greater than)
  • IFL – (if less than)
  • ELS – (else)
  • EIF – (end if)

Collectively they serve to provide developers with more granular control over the flow of their shader programs but I must add a quick note to say they should be used judiciously. Using conditional statements inherently means that you will be using more operations, which can impact the performance of your shader code. That being said, conditionals are great when used to simplify workflow and their advantages often outweigh the negative performance hit. It’s probably wise to see what works best and monitor execution speed of your shaders. There is always Adobe Scout or Intel GPA etc for such tasks 😉

 

Increased Register Space

In the previous AGAL spec, we had access to the usual set of registers. Vertex and fragment registers were made available, allowing us to intermediately store resources and make them available to the programmable graphic pipeline. Whilst this is exactly the same with AGAL2, the amount of memory that each shader can access has been increased. Here is a chart that shows a comparison between the numbers of available registers.

AGAL Resisters

We can see from the table that we have access to well over double the number of registers on most registers. Possibly the two most notable would be the number of tokens that can be used, which directly translates to the overall size of your shader programs, and the VC register. My guess is that the large increase of the VC register is balanced like this for one important reason, bone animation. Bone animations are used for manipulating vertices, the technique is also known as skinning, and requires that either matrices or quaternions to be uploaded to the GPU via the VC register. The original AGAL spec was quite limited in this regard but the increase means that more than double the number of bones can be uploaded, offering the ability to produce more detailed animations.

 

Half Time Conclusion

Well, that’s half way! We can see that Adobe are really bringing exciting and much awaited set of features and whilst many of them are nothing new to the 3D community, it’s important to realize that the emphasis for Adobe is on platform reach. Adobe are seemingly striving to provide cross platform GPU support to as many users as possible by offering subsets of features that target as many GPU chipsets as possible. In this regard, it makes complete sense that the Flash Player team are trying to ensure that Stage3D doesn’t need to fall back on its software rendering mode and the result of that is a good overall experience to the end-users.

 

Next Time

Next time I will cover the remaining features and provide you with code examples. Be sure to check back or follow my Twitter account for more updates. 🙂

Gary Paluk
@plugin_io

 

Posted in adobe, AGAL2 Tagged with: , , , , , , , ,
6 comments on “AGAL2 is here
  1. Great post to highlight the latest news on Stage3D, Gary! 🙂 These are exciting times for Flash and AIR Developers!

    Great to see Adobe giving us a handful of new GPU toys to play with and come up with amazing shaders and higher-quality content that can compete with triple-A games.

    Now I only wish I had more time to delve and experiment into these new features!

  2. Jeff Ward says:

    “cross platform GPU support to as many users as possible” – well, AGAL2 (standard profile) is currently only available for desktop.

    Just to check, I tried to request it on (arguably) the currently most capable tablet – an iPad AIR, and as expected, I got Error #3702: Context3D not available

    I understand the reason for this, but it does limit the power of the statement “cross-platform” when you have to qualify it as desktop/browser.

    Still, it’s exciting to see development on the Flash Platform!

    • Helier Eric says:

      I agree with Jeff.
      It made me very happy to see new features introduced about Stage3D/AGAL, but a bit disapointed to hear nothing about mobile support.
      Even a “will come in a next release before the end of the year” would be sufficient, but definitely required to allow us to choose AIR as a strategic crossplatform tool.
      2 or 3 years in the past i’d say trust Adobe it will come soon. Actually i would not take the risk to say so…

  3. Cheng Liao says:

    Great introduction to AGAL2. And AGAL2 should be able to take Flash games into next generation!
    To make this introduction more exact, I’d like to remove the Anisotropic filters and Texture anti-aliasing from AGAL2 feature set(or standard profile features). Texture anti-aliasing is the feature introduced in Flash 13 and available in all profiles. Anisotropic filters is also available in all profiles, though it’s introduced in Flash 14. The rest features are only available in the standard profile, so they belong to the AGAL2 features(or standard profile features).
    To use these features easily, I suggest get the latest AGALMiniAssembler from https://github.com/adobe-flash/graphicscorelib.

3 Pings/Trackbacks for "AGAL2 is here"
  1. […] New Stage3D “Standard” Profile [AGAL2!] […]

Leave a Reply

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

*