Fluid Solver + Workers + AGAL = Awesomeness

Fluid Solver + Workers + AGAL = Awesomeness

The fluid solver used in the following post is based on Eugene Zatepyakin’s fluid solver, which you can read more about here. Eugene’s version is pretty damn impressive! his Alchemy version while running with 8000-9000 particles performs really well, sitting at about 50% frame budget in scout on my computer. Ever since first seeing the demo about a year ago I’ve wondered how far it could be pushed if it took advantage of Stage3D for the rending and Workers for the processing. Last weekend I had a bit of free time, so I decided to test just that. The following example uses Eugene’s as3 fluid solver, however I’ve moved the processing out of the main swf and into a worker, which processes the fluid solving and passes back a Number Vector formatted x,y,z,w,x,y,z,w… etc… which is then pass directly into a vertex shader (well actually a number of vertex shaders, as each shader can only control 125 particles, due to the limited number of Vertex Constants). The result is 10,000 interact particles runing at 60fps. peteshand / agal-fluid-solver-demoNo description or homepage.73Download as zip Mobile version...
Re: Further Adventures in AGAL

Re: Further Adventures in AGAL

Last Week over at videometry.blogspot.com.au there was a post on AGAL and how to create an animation of a field of barley waving in the sea breeze. The post it self is informative and has lots of useful links. However after profiling it in Scout it’s obvious that there are a number of issues with the execution. While it still runs close to 60 fps, the cpu budget sits around the 89% mark, with periodic jumps to 229% every second or so for Garbage Collection. The author admits it’s not the most optimized demo and points out that the reading of the Perlin noise data is a big contributor in killing the performance. But seeing as this was meant to be a post on “Adventures in AGAL” I found it somewhat disconcerting how bad the the performance is (although don’t get me wrong, I love to see people posting about AGAL!). So I figured I’d give it a go, however with a focus on performance. First I opted to go with Away3D rather than Starling. While Starling is awesome, I’ve found over the last few years that I can squeeze a bit of performance out of Away3D and you have the obvious benefit of the extra dimension. My approach is simple. * Create a texture atlas with a number of blades of grass that vary in shape and colour. (Combining all the different blades of grass into one bitmap within a single texture atlas is extremely important because it will allow you to draw everything in one draw call). * Create a row of planes, with a x offset and randomly assign one of the grass blades from the texture atlas. *...
Away3d AGAL Vertex animation (Part 2)

Away3d AGAL Vertex animation (Part 2)

In part 1 of this post (Which can be viewed here) I discussed various approaches to creating a AGAL vertex shader within the away3d framework. I successfully created a custom material and pass that achieved basic vertex animation, however the issue was that I wanted to apply this effect to standard materials. So I investigated using an away3d effect method instead. As outlined in my previous post the issue I was facing with using an effect method is that the custom AGAL was being inserted at the wrong location in respect to the complete material vertex AGAL. So my hack to get around this was to add the following variable to ShadingMethodBase public var preTransfer:Boolean = false; As you can see the default value is false, however if it is set to true the ShaderCompiler will insert the AGAL before the matrix transfer AGAL. Once I had my AGAL being placed in the right location it was just a matter of writing the AGAL to match the material and material params that I was using. The result can be viewed below. (environment map / normals AGAL still needs work) While I’m happy with the result, this is by no means a real solution. As i’m sure my preTransfer hack is far from the best way to insert the AGAL in the correct location, and my custom effect method only works with a material that has an environment and normal map applied to it, as soon as you use a material without these you’ll get a runtime error. Source code can be download...
Away3d AGAL Vertex animation

Away3d AGAL Vertex animation

Ok, so I’m on a mission to create some sweet ass AGAL powered vertex animation that will integrate with the Away3d library. I’ve started a conversation on the away3d forum, but thought I’d create a blog post to help people understand exactly what I’m trying to achieve. http://away3d.com/forum/viewthread/4641/ One thing to note is that I’m not trying to create a static vertex animation, the whole point of this is to come up with a dynamic vertex animations via AGAL. Also worth noting that while the same effect can be create by calculating vertex position in AS3 with the CPU and then uploading to the GPU, this is not the desired approach, as the upload process is quite costly. I’m not sure the best way to approach this. So my first thought was to create a custom material and pass, and then bake the vertex animation AGAL into the custom passes getVertexCode method. This actually worked out exactly as planned (see below) You can download the source files for this here So this is cool, but the issue arises when trying to combine this effect with some of the more complex materials that are built into away3d. For example I’d like to apply this effect to a standard TextureMaterial with a normalMethod and EnvMapMethod… Sp my next thought was to create a custom method and try to apply the AGAL with this. The issue with this approach is that the AGAL is inserted in the incorrect location. for example if I use a ColorMaterial and set Debug.active = true, I can see the output AGAL looks like this: mov vt0, va0 m44 op, vt0,...
Showreel 2012

Showreel 2012

This video features projects produced by Peter J Shand during 2012 and were created in collaboration with RESN, Circul8 and Imagination. The projects all use Flash 11 stage3d technology, enabling full 1080p 60fps rendering. A big thank you goes to the many contributors of the Away3d and Starling frameworks. EDF Light Games (RESN – Wellington) The EDF Light Games serves up a series of 7 Olympic sports events brought to life on desktop, touchscreen and as an iPad app. The Games were created with Flash 11’s stage3d technology and utilized the away3d library. Wrapped In Merino (Circul8 – Sydney) Wrapped in Merino connected people with wool globally, asking them to collaboratively design a giant virtual scarf. Again the site was built with Flash 11’s stage3d technology and utilized the away3d library. Users were prompted to upload a photo, take a snap with their webcam or select a photo from facebook. They could then customize their portion of the scarf. The site was integrated with facebook, twitter and pinterest, allowing the users to share their creation & encourage friends to join in. GE Innovation (Imagination – Sydney) 12 touch screen applications, along with 4 additional supporting applications were developed for the GE Saudi Arabia Innovation Center. Adobe air was used to package the applications and the Away3D and Starling frameworks were used extensively throughout the applications to produce full 1080p 60 frames per second...
Away3D Liquid Ball

Away3D Liquid Ball

As part of one of my last projects I needed to create this interactive oil blob (as seen here, 58 seconds in). Thought I’d do a quick post showing it off and sharing the source for anyone who is interested. The environment map is of Manly Beach (Sydney) and was photographed by myself, so feel free to use without restriction. source can be downloaded from...