Away3D: Christmas Greetings!

Posted by rob on December 24th, 2009

Happy holidays eveyone! Here’s to an exciting 2010.

Away Media: The Tomorrow Mural

Posted by rob on December 16th, 2009

The Tomorrow Mural is a collaborative online art piece that allows anyone to contribute by uploading an image and/or message for their vision of the future. Commissioned by Intel, the site has various ways to interact with the content submissions as the database grows.

As you begin, spacey bleeps and widdles float out of your speakers, as if you’re about to enter some sort of online isolation tank. Once in, the emphasis is placed as much on casual browsing as contributing to the content - you can sort and search messages using many different categories including, colour, popularity, geo-location, submission time etc. Each set of search results are presented in a 3D interface that allows messages to be browsed individually at your leisure.

The concept was developed by MRM Worldwide, with Away Media providing Flash development and 3D expertise. Launched around the end of August, contributions have been flooding in from all over the world for the last few months, with the overall outlook being surprisingly positive! Certainly, i would recommend a browse to anyone who required a few minutes of contemplative relaxation amidst the typically hectic buildup to Christmas ;)

Fast sorting in AS3

Posted by rob on December 8th, 2009

U

A blog article recently caught my eye over at http://www.simppa.fi on z-sorting that i simply couldn’t resist to pick up on. Simo is someone that has great claims to geek-worship - being one of the awesome team that make up evoflash and having a hand in their latest Severity Of Grey demo, while also progressing with some amazing 3D and particle demos in recent blog posts.

The latest post is about sorting in AS3, and specifically, z-sorting objects that are being drawn in a 3D scene. Having done a fair amount of research on the topic myself while putting together Away3D Lite, I was very interested in seeing an adapted Insertion Sort method that had essentially been laid down gauntlet-style as ‘The fastest way to z-sort and handle objects in AS3′. How could i resist? :)

A sorting algorithm in its most basic form is a function for sorting a list of objects by ordering them in the ascending or descending order of a specified property. When dealing with 3D in Flash, sorting can become one of the most processor intensive operations because it isn’t done by default. Flash happens to have its own sorting functions for Arrays and Vectors, but by and large these aren’t that fast, so coding something faster in AS3 is a realistic proposition. The question is, which algorithm do you use?

If you feel like you’ve missed the sorting-algo boat then fear not! Wikipedia will give you a good grounding in various methods for sorting lists. The Insertion Sort method mentioned above is one with a simple premise - start with your unsorted list, create a new empty list, iterate through your unsorted list copying each item to its correct sorted position in your new list using an iterative compare on items already placed in the new list.

In standard use insertion sort is a fairly unimpressive algorithm. But combined with a little coding magic, Simo has transformed it into something that appears to beat all others. The success of his approach is based on two simple assertions:

1) Linked lists are faster than vectors when inserting values

2) In most cases in a 3D engine, sorting is performed on a list that is close to already being sorted

I’m a little skeptical about the second point, because the modified Insertion Sort method is heavily influenced by how unsorted a list is to start with. I would agree that if the order of 3D objects in a view are saved on each frame then it could be considered that from one frame to the next, the order of objects doesn’t change dramatically. However, this should be considered the most trivial case when rendering. Times when this is not the case include when objects are moving in the scene, when objects are being added or deleted from the scene, or when objects are moving in and out of view. For an unsorted list, standard Insertion Sort has one of the slowest performance records of any sorting algorithm, with a worst case of n2 iterations.

With the stage now set, I offer a potential challenger to the modified Insertion Sort method! It is the method that Away3D Lite uses as its default sorting algorithm, and is know as Radix Sorting. The biggest advantage with this algorithm is its consistent performance and minimal iterative approach. In all cases, whether sorting a completely sorted or completely unsorted list, the number of iterations required is constant at 2n.

Radix Sorting works by taking advantage of the binary nature of numbers stored in a computer program. These numbers can be easily quantised (split into smaller numbers representing the bytes that makeup the value of the original number), and this quantisation allows numbers to be sorted incredibly efficiently. Rather that compare absolute values of numbers, objects in a list are stored in ‘buckets’ that represent a single value of the quantised state of a number. Once all numbers have been placed in their respective bucket, the result can be read out in the correctly sorted order for that quantisation by simply emptying the buckets in sequence.

In general use, Radix Sorting quantises numbers into 8-bit bytes. This means that each iteration sorts the objects into their 8-bit bucket positions for that byte (starting with the byte representing 0×00 - 0xFF, then the byte representing 0×00FF - 0xFFFF, then 0×00FFFF - 0xFFFFFF etc.). Because we are sorting 8-bit numbers, 256 buckets are required for each iteration, to provide a bucket for each possible value. With each byte, only one iteration is required to completely sort the objects into their buckets, and read them out in the correct order. So the quoted number above for 2n iterations will allow you to completely sort 16-bit numbers. For 3D in Flash, this appears sufficiently accurate as long as the inverse of z is used for the sorting value.

One of the disadvantages of Radix Sorting is that it only sorts using integers. Because we currently have no byte access to floating point numbers in AS3 (boo Adobe!), z values have to be type-converted to integers on every frame, which is a little annoying as it sucks some of the power out of the algorithm. But despite this, the results are still very impressive, as this example shows (using the same source structure as Simo’s original demonstration for comparison).

Here are the results i get when directly comparing the two sorting mechanisms - in each case the list in question is 100000 items long.

  • Simo Insertion Sort (on sorted list) - 4 ms
  • Radix Sort (on sorted list) - 16 ms
  • Simo Insertion Sort (on extremely unsorted list) - ????
  • Radix Sort (on extremely unsorted list) -16 ms

The default for the ZSortTest demo is to create an already sorted list, which gives an Insertion Sort result of 4ms. Simo doesn’t bother to test an unsorted list in his post, and i think i may know why…. Flash Player times out before you get a result! ;) His suggestion here is that you use a different sort method when you know a set of objects will be extremely unsorted, but this also implies that in the cases where you are using the algorithm on almost sorted lists, you will still not hit the 4ms benchmark seen here.

Radix Sort on the other hand doesn’t give two hoots what the starting sort nature of the list is, so it is the more consistent sort mechanism, and possibly the most consistent of any.

Picking up on an earlier point on linked lists, I had a crack at improving the Radix Sort score by using linked lists rather than vectors, but bizarrely came out with a slower benchmark score of around 20 ms. This may have something to do with the difference in access speed between bucket vectors containing integers and bucket vectors containing objects. You can try it for yourself with the source code - both types are present and it is a simple matter to comment out one type and uncomment the other.

Regardless, all of these methods come out far faster than the closest native sorting method in Flash - the Vector.sortOn() method - which managed a woeful 54 ms in the same test.

Away3D Lite: 1000 animated 3D sprites

Posted by rob on October 27th, 2009

Get ready for Mariogeddon!

Away3D Lite has seen two important additions in its 1.0.2 dot release: MovieMaterial and Sprite3D. The former is a direct port of the standard library counterpart - the latter a slightly more advanced version of the Sprite2D class that accepts a material rather than a bitmap as it’s primary skinning technique.

Combined, these additions allow new and interesting setups like the one demoed above! Here we have 1000 Marios created using Sprite3D objects, fed from a single MovieMaterial. The material uses a second (hidden) view to render the actual Mario object. It would be virtually impossible to do this effect any other way, as the mario model has around 500 faces, multiplying up to a whopping 500,000 faces if each were an actual 3D object.

Some controls on the demo allow you to navigate around - click and drag to spin the cube, use Up & Down cursor keys to zoom in & out, and if you get bored with the slightly regimented nature, press the Spacebar to animate!

Another feature of the new Sprite3D object used here is an optional positioning technique which helps with simulating perspective. As the Sprite3D object is just a simple quad in 3D space, it needs to be constantly rotated to face the camera in order to appear face-on. In standard billboarding, the orientation is made to appear uniform at any position in the view (ie. as if the sprite’s bitmap has just been scaled). With the Sprite3D object in Away3D Lite, we can use a trick that counters this uniform look to appear more natural at wider angles, called “viewpoint orienting”. Check out this article which explains what i’m on about much better than i can here.

Further additions in 1.0.2 are the introduction of quads to a face object (which reduces sorting costs), the brand new AwayStats panel (with more than a nod to DoobStats ;) ), and the welcome return of the View Source menu item! Right click anywhere in the demo to open the menu, or access the source files directly from here. Of course, compiling requires the very latest update from the Away3dLite svn repository.

Stay tuned for a more official Away3D Lite release (v1.1.0), coming soon…

Away3D Lite: banishing the darkness

Posted by rob on September 11th, 2009

Two major releases in two months must mean only one thing… all clients are on holiday! :D

Away3D Lite is the latest release to come out of Away-central, and is something a bit different. It is a complete break from the development line of previous releases, and there are two very good reasons for this - size and speed.

Put simply, Away3D Lite is the fastest and smallest fully featured 3d engine in Flash to date.

Written from the ground up in Flash 10, the native 3D feature of the new player are used to full effect. Speeds up to 4 times that of the standard Away3D library are possible, and all this at a fraction of the filesize - weighing in at a little under 25K

So why bother with Away3D Lite at all? Native 3D effects in Flash does away with the need for an engine, right?

Well, no. what Away3D Lite offers is a framework that fills in the gaps left out by the player, but at minimal expense to you in terms of filesize and speed. So you can instantly load and display 3DS, Collada, MD2 and MQO files, choose from a range of sorting and rendering options, enable 3d mouse events, enable viewport clipping, create primitive objects, etc. Plus one of the best things about Lite is it’s similarity to the main Away3D engine. If you’ve used Away3D before, you’ll already be able to use Away3D Lite!

So enough talk, here are some demos. The sources for all of these are available from the svn or the downloads section of away3d.com, along with v1.0 of the engine source.

ExSphereSpeedTest

ExMQO

For a full list of supported features, go to the official announcement over at away3d.com. There is also a complete set of documentation files available from a new livedocs folder here.

Finally, if anyone has a working copy of Flash Builder 4, I would be forever grateful if you could help me do the usual publish source option to allow it to be accessible in the browser for the above demos. Unfortunately Adobe’s idea of a beta product license is one that runs out before the final commercial version is released. Nice.

Enjoy the new release!

Away Media: Doritos ID3

Posted by rob on September 6th, 2009

Doritos have recently launched an online campaign called ID3, which revolves around a prize draw that participants can enter by playing and completing the flash game at http://id3.doritos.co.uk/. All packets of doritos have a code printed on them allowing you to gain access to the game. You can also get a free passcode by going to http://id3.doritos.co.uk/codeclaim.php, although using one of these will only allow you to play the game, not enter the draw.

The site was another collaboration between  Rehab Studio and Away Media, with Upset TV, providing the excellent live action sequences that plunge you straight into an undercover gangster bust-style scenario, complete with dodgy east-end accents and evil secretive bosses. :D

Away Media’s role within the project was to develop two 3d minigames that had to seamlessly integrate with the main cinematic sequences. Away3d was used to great effect, taking advantage of some of the advanced shading options, and relying on frustum culling to make possible the use of the large gameplay areas. The 3d physics library Jiglib was used for collision detection.

The draw is to remain open until the end of September, so there is still time to enter! As an added bonus, there is a easter egg to be found inside the warehouse minigame. When you encounter the forklift truck, press the keys ‘up, up, down, down, left, right, left, right, b, a, enter’ to unlock drive mode…

The site was recently included in Board’s top 5 picks of the month for August 2009 following it’s FWA site of the day award on the 11th August.

Away3d: 2.4 & 3.4 released!

Posted by rob on August 7th, 2009

The Away3d 2.4 & 3.4 update has been recently released on the Away3d.com site, with a completely revamped examples section, for both Flash 9 & Flash 10 versions. To grab your copy, head over to the svn or go straight to the downloads section of Away3d.com for a zip download of sources and examples.

many new features have been added to this release, including:

  • Vector graphics and fonts support.
  • Typed-checked loader support.
  • Geometry modifiers for exploding, welding, mirroring…
  • Depth material for creating depth masks.
  • Normalmap and Bumpmap generators from geometry.
  • Light pre-baking on textures.

plus the usual stability improvements and a ton of bugfixes. Documentation will soon be updated at away3d.com/livedocs

Special thanx must go to Guojian Wu of wu-media.com for his excellent new as3 library swfvector, which allows you to convert any shape outline or textfield in a swf into as3 data. This is used to great effect in the new release, easily enabling the drawing of textfields and shapes in 3d

The examples interspersing this post can be accessed by clicking on their images - each comes with it’s own source which can be downloaded by selecting “View Source” in the right-click menu. Or you can download these and other examples (both .as files and .fla files) by going to away3d.com/downloads. The Basic_Swf example also uses the excellent as3dmod library (which you can download from here) for producing the bend effect. Now you can twist and deform vector graphics in 3d, thanx to as3dmod, swfvector and Away3d 2.4 /3.4 :D

Enjoy the new release!

Away Media: Toyota Verso minisite

Posted by rob on July 28th, 2009

Toyota have recently launched the English version of their minisite for the new Verso. Based around a series of minigames, the Verso minisite was built as a collaboration between Rehab Studio and Away Media for the Brussels branch of the media agency Saatchi & Saatchi.

Away Media were responsible for the development of the minigames, which included some 3d elements that were created using Away3d. Each game integrates with the rest of the site using video shorts that play after completing one of the game tasks. Games developed by Away Media include the Luggage game, Personal storage, Driving dynamics and Harmony.

The entire site is built to be localised and has already been translated into French & Dutch for the Belgian version which can be found here.

Presentation notes: TFO3D in Flash

Posted by rob on July 24th, 2009

As the new release of Away3d approaches, it’s time to clear out the old and bring in the new! This year’s presentation starter has run it’s useful course, so it seems only fair to make it available after having a good run at FITC Amsterdam, Multi-Mania, FlashBrighton, FlashCamp Birmingham and the LFPUG.

Over the first half of this year, we’ve had some exciting additions to engine that made it into the presentation (some of which never got seen as I would inevitably run out of time!). Needless to say a new presentation will be forthcoming later this year, although exactly when remains to be seen.

The full presentation complete with all links can be accessed online here, or you can view the source of the slides and download a zip (warning! 73 megs) of all demos from here. Use your cursor keys to navigate between slides.

Thanx goes out to everyone on the Away3D Team for assisting with the demos, and of course, continuing to produce some of the most fascinating Flash 3d content on the planet! You guys rock :D

Away Media: Morgan Stanley Matrix microsite

Posted by rob on June 8th, 2009

The financial institution Morgan Stanley have recently released information on a new online product called the Morgan Stanley Matrix. This required an eye-catching microsite for the product launch, which was built as a collaboration between Away Media and Morgan Stanley.

The site takes an immersive approach to a 3d environment, navigating between areas by flying through space in a similar manner to the site for the well known digital agency Nitrogroup.

The project was built using Awaybuilder, one of the more recent features of the Away3d engine. The Awaybuilder framework allows a seamless workflow between 3d modeling packages and Flash, enabling menus and site areas within a 3d space to be positioned and updated with ease. As a result, camera movements can be executed with pinpoint accuracy, allowing for some very nice effects - particularly with textfields.

The 3d menu text uses vector based shapes to render, another recent feature addition to Away3d. The crisp text outlines it allows are quite an improvement from text as bitmap textures. Frustum culling is used to keep framerates high even though the entire 3d scene contains many elements, thanks to the early-outs it allows for objects outside the viewing frustum.


© 2008 infinite turtles
Designed by Lorelei for Web Hosting | Coded by Cheap Web Hosting and Web Site Hosting