Archive for the ‘VECTOR’ Category

Friday, May 22nd, 2009

Flash 10 will be ready for mainstream hopefully by the end of this year, or early ’10 when the penetration numbers will be up in or around the 90% range via zeh fernando based on previous trajectories.  

With that, Flash 10 has many great new things such as the Vector structure that allows a collection of a certain type, which results in a faster collection because of the known type.  So anywhere where Arrays are used, that is a possible candidate for a performance increase within some code because you are asking the virtual machine to do less work on each loop (not having to dynamically find out the type).

ByteArray (Thibault Imbert) has demonstrated that for the JPEG encoding in corelib it is up to 2.5 times faster using Vectors than Arrays.  Your mileage may vary heavily but it is almost a guaranteed speed boost due to less work.  This obviously has great possibilities for speeding up code that uses lots of arrays.  

Due to the performance boost the Vector does have some constraints in the typical give and take of coder flexibility with compiler and virtual machine overhead.  Vectors are more explicit and strongly typed which is why they are fast, but this is also limiting.

In addition to the data type restriction, the Vector class has other restrictions that distinguish it from the Array class:

  • A Vector is a dense array. Unlike an Array, which may have values in indices 0 and 7 even if there are no values in positions 1 through 6, a Vector must have a value (or null) in each index.
  • A Vector can optionally be fixed-length, meaning the number of elements it contains can’t change.
  • Access to a Vector’s elements is bounds-checked. You can never read a value from an index greater than the final element (length - 1). You can never set a value with an index more than one beyond the current final index (in other words, you can only set a value at an existing index or at index [length]).

 [ Vector docs  ]

ByteArray not only used Vectors heavily but did other optimizations that are always good to do, even though optimization is evil when you are working with precious client side resources ensuring an optimized base starting point can be a good thing.

So what did I do ?

  • I used bitwise operators as much as possible.
  • I replaced all Arrays with fixed length Vectors.
  • I used pre-incrementation rather than post-incrementation (thanks Joa for this one ;)).
  • I casted to int all my Vector indices access.
  • Other minor stuff you always do to optimize your code 

Other sources as well for even more optimization or shall I say efficient AS3:

Saturday, December 13th, 2008

This is pretty impressive.  This is Moonlight for mono (a silverlight clone in for multiplatform) running inside of Ogre3D (a 3d renderer) as a material.

Argiris Kirtzidi (one of the developers behind Managed OGRE) modified Moonlight to run inside the Ogre3D engine. You can render Moonlight applications or XAML files inside Ogre3D.

Some details in no particular order:

-Moonlight uses cairo for the graphics. I developed a new backend for cairo that fully utilizes the GPU (through Ogre’s RenderSystem) for rendering. This is completely independent from Moonbeam and can be used standalone.

-Moonlight’s core is a native C++ engine and is not dependent in Mono. It is flexible enough to be scripted by anything, javascript, managed code, native code, etc. I’ve got it working on both Mono and the .NET framework and I plan on embedding and trying out Lua for more lightweight stuff.

-If you opt for using managed code, it should be possible, in theory, to utilize the silverlight controls, develop a silverlight widget using visual studio and have it run through moonbeam with full debugging support.

-Getting it to work on Windows was no small task as the moonlight team is completely focused on linux, and there doesn’t seem to be much consideration about cross-platform-ness. I think this is reasonable, though, since moonlight is a young project and their specific goal is to implement silverlight for *nix systems. The downside is that it reduces its flexibility, e.g. in order to inject keyboard/mouse events I will have to create and pass to it GDK events or make heavy patches to it.
Hopefully, there will be more push in the future to get the *nix dependencies abstracted away from the core moonlight engine.

Monday, January 14th, 2008

Just recently through the holidays Degrafa has made some great strides as a very cool SVG pathing and designers toolkit for Flex. I have to say some recent Flex apps have really looked good like Picnik and Buzzword but this kit looks to clean up the lack of design and default style-itis that has plagued most common Flex Apps.

This so far looking like a pretty strong kit for bringing the designer pipeline into Flex to provide some really nice looking web styled apps. It has a direct crossover to Silverlight and Path objects that are largely just a series of data created in Expression or exported from Illustrator into XAML. The one benefit of Flex/Flash is it compiles to a very small SWF where with Silverlight you have to package the XAML in a zip and use the downloader object to extract it out. These XAML files and Paths can get massive as I am sure the ones for Degrafa will for Flex but the compile option is nice as it is compressed heavily.

All about Degrafa

Yes the launch includes shiny buttons…

Sphere Sample (right click for source)

Also, it appears it is a way to bridge the pathing and pipeline for flash or Silverlight. At one of the contributors blogs they mention this:

We have lot of interesting features planned for the coming releases. There is also a converter app that will be made available for converting the juicy Degrafa graphics to XAML.

Degrafa has gone live.


Monday, November 5th, 2007

Flash and Silverlight allow developers to make amazing tools, they allow creative expression and they also are usually a bad user experience many times.

Lots of that is changing as more applications are made and frameworks like Flex and Silverlight progress. Much of the needed performance is now available for Flash/Flex in AS3 and the AVM2 virtual machine that runs it, making full applications much faster for all actions that might have been a drag in AS2 and vector based application’s of the past. Some great tools were made with this still that were usable like gModeler a flash based UML modeling tool but the performance boost will make these applications even more usable for mainstream.

Some great examples of user friendly apps where the flash or the silverlight element doesn’t blind the developer from usability. These applications might really have a market for general users of applications from advanced depending on feature set as long as they are usable.

buzzword (Flash/Flex/AS3)

Is a word processor that is really well done. This is made with Flex and everything from validation to the toolset is very usable and clean. I use Google Docs and haven’t looked back for about a year but this application is a nice change to web editors for documents at the current state. It included all the usual basic functionality and great new zoom, revision history and sharing tools that web office tools like word processors has come to expect. Be sure to try this one.

scrapblog (Flash/Flex/AS3)
scapblog is a bloggy/presentation that is a great template editor and the tools are broad and expected from users including great integration with the web for photos and video at major sites such as photobucket, flickr, etc.

Google SearchMash (Flex/Flash/AS3)

This is a Flex 2 (actionscript 3) application that is very fast and usable in vector.

Sample Textured 3d Vista demo(Silverlight 1.0)

This demo showcases the speed of Silverlight and a usable OS like interface that performs well. It showcases Silverlight but also has great usability in expected user actions and results.

tafiti (Silverlight 1.0 demo)

Tafiti is a search tool that uses SIlverlight and live search to represent search results in a rich way. They did a pretty good job with usability and especially considering the Silverlight 1.0 lack of good input controls. Little bit laggy.

The point is solution developers should use technology but most importantly make it functional and usable to what users expect. RIAs will succeed very well as long as you can select text, hit back buttons, deep linking, use menu systems, integrate services, have all the features of apps not in vector engines like Flash or Silverlight and to make it mainstream friendly they need to have a low bar of entry and just work. RIAs have an advantage right now as office apps move to the web and photo apps as well, many of these apps above would appeal to general computer users in addition to advanced users.

Tuesday, September 11th, 2007

Flash Performance and HD (H.264) Video Progress

Fast performance is needed for good video combined with interactivity especially. Quickly comparing AS2 to AS3 shows that AS3 and the AVM2 virtual machine in Flash9 is much faster. If you are combining Flash and video especially when it is time to go HD, you will need performance.

Compare AS2 to AS3 rendering: AS2 & AS3 Note the as2 item only has 10000 pixel operations, the as3 item has 50,000 and is considerably more usable, in fact the AS2 version isn’t usable since it is slow. [source] This is a good test because it checks the movement of every pixel on the screen which leads me to video performance.

Flash HD in the FLV format is pretty nice looking today in Flash9 with AS3. But to keep up there are more formats and a move to support H.264/MPEG-4 AVC I am sure for online TV/Movie market.

The reason to bring up performance and video is because the video battle on the web is heating up even more between Adobe and Microsoft with Flash Video and Silverlight Video. The recent released info regarding HD on Flash is to combat Silverlight HD video that is looking pretty good.

Silverlight Performance and HD Video VC-1

View this Halo 3 video in Silverlight HD:

View it->

Recently Silverlight came out last week officially on Wednesday, really the 1.0 release is just a video and javascript release but when you view the videos below you will see that they have a short coup de tat on Flash video at the moment in terms of HD quality video.

Silverlight also has been pushing TV on the internet. See these samples that are actual TV on web pages already using Silverlight.

  1. Home Shopping Network Online
  2. ET Emmy’s coverage
  3. They also have WWE and baseball already using Silverlight video.
  4. Netflix online video uses Silverlight

Flash video is cool and you can do great fun things like (flash 8) and high definition FLV video in flash9 with AS3 and on occasion AS2 if it is just video with full screen flash but when you are talking TV and movie quality, it is still up for grabs but both are looking good especially Silverlight and that Halo 3 video.

Flash video is updating to H.264 [source]

Tinic Uro reports the beta player of flash that has HD now. Currently the FLV format is the web leader (you tube, Google video) but is not as good quality as Silverlight until they update to H.264 at least in terms of standards video. This is probably 6 months off?

Video literally changed in the internet in the last two weeks with the Flash announcements and Silverlight launching. I am surprised at Silverlight’s adoption rate and partnerships so far with the 1.0 offering which lacks many programming tools, but I see why on the video front why they did it. When 1.1 comes out it has all the programmer toys, and it will attract a lot of attention I think. It is all about performance and HD video right now.

Yes yes… Quicktime has done HD/H.264 video for a while but Quicktime is just a video format really, it will be able to be used in the new flash video as well as other formats but it doesn’t have the interactive platform behind it like Flash and Silverlight have.

The difference is the choice of format and standards. Silverlight with VC-1 and Flash going to H.264 codec. They are largely competing standards that are both “HD”.

The good news is we have competition to bring really high quality video to the web, the mashups with HD video in interactive games, demos, advertising etc will be very fun.

Thursday, August 23rd, 2007

Thibault Imbert from ByteArray released the first PDF Creator for AS3 / Flash 9 called AlivePDF.

The new BinarySocket and ByteArray handling adds essentially no limit to the imagination of what is implemented in AS3. Non programmers might not understand the immense power that brings to this language and platform in AS3. Essentially it allows creating and reading binary to manipulate any file type.

Monday, July 30th, 2007

shirotokoro has created something interesting in the view of a pipeline for getting assets from 3d into the new Flash 3D engines with a Geom Class Exporter for 3ds max for PV3D, Sandy and Away3D.

One of the difficulties is the DAE/COLLADA and ASE imports dynamically at runtime in Flash 3d Engines sometimes takes some work to clean up the 3d objects in COLLADA xml or the ASE or 3ds if you are Sandy. But this takes that step out of the process and exports 3d models straight to flash 3d engine object scenes.

This is great for models that don’t’ need to be dynamically imported/parsed (which takes lots of time usually to parse the DAE in flash). I am not sure how detailed or elaborate the models can get as I haven’t had a chance to play with it yet but it is an interesting idea and development but the cat samples he has are fairly complex for a flash 3d engine and they look great. I think this can be used elsewhere preparing objects for 3d in flash as precompiled movieclips already. Maybe even a turbosquid like market for flash 3d. This could be fun.

from shirotokoro via pv3d list:

AS3 Geom Class Exporter is a 3DS Max designed script that allows you to directly export 3D models to AS3 classes.

he benefit is that you don’t need anymore to load and parse a texte file (ase, obj, 3ds).
You just have to import the class and to create an instance, like you do with usual objects like plan, sphere and box classes.

This script is compatible with the following AS3-3D engines :

Sandy 3.0
Papervision 1.5

Installation :

Download zip file and unzip in any folder.
In 3DS Max, tools tab, open the maxscript panel and click the “execute script” button.
Select the script. It is now displayed in the available scripts list.
Select it, a new AS3 panel “AS3 geom Exporter” appears.

Options :

- Package : the exported class package
- ClassName : the class name
- Engine : the 3D engine you want to use
- Scale : scale the 3D object
- Swap face normal : with some 3D models, the faces export is swapped, you can fix this by selecting this box.

Here are rendering examples of an object in the following 3D engines :

Download demo sources and 3ds max script


Thanks shirotokoro !

Tuesday, July 17th, 2007

mr doob has posted a first away3d verses papervision3D test for the same model and found pv3d to be faster than away3D. Who wants to take the source and test it on Sandy?

Disclaimer: Test can vary on types of content and different systems or browsers to it is not a definitive test just one test, more will be coming and the faster it makes engines the better for adding more content to each project.

Papervision3D (src): 14FPS, Memory: ~8,5Mbytes
Away3D (src): 10FPS, Memory: OPS!
Away3D (CORRECT_Z_ORDER) (src): 5FPS, Memory: OPS!

So far there are a few good flash 3d engines But it will all come down to performance for the best.

The top three are the only ones viable for full screen and projects that can cross into the commercial realm, other pixel level systems like scanline z-buffers in flash are really just tech showcases right now.  The fast and dirty Painter’s Algorithm of Papervision and drawing things the fastest wins out when dealing with software rendering and processor based graphics.  When and if 3d acceleration is added, that will change the game immensly.

Saturday, July 7th, 2007

Who’s got the textures and cool chrome shiny 3d objects in Flash? There have been lots of materials work recently from papervision list developers and away3d developers (away3d is a branch of Papervision3D) and recently it is heating up a bit.

Early on on the papervision3D excitement, flash possibilities in 3d with AS3 specifically, much of that was due to 3d in flash but also the ability to texture and have bump mapping, toon rendering/cell shading and other neat effects like baked lighting, faked real-time lighting, video and movieclips on flash 3d objects and animated textures.

But when it comes to environmental mapping and true 3d reflection that might be simply stretching Flash to a limit that might require hardware acceleration but that isn’t stopping some.

I am not sure if environmental mapping will every be possible on a large scale without hardware acceleration. Pushing the limits could help influence Adobe to the market direction. But then again I never thought I would see the level of 3d in flash that we have and maybe in 2-3 years with multi-core processors it will be possible.

Here’s a snapshot of the current materials and environmental mapping (fake and real attempts).

UnitZeroOne first environment mapping /bump mapping:

Some toon renderings from UnitZeroOne

Recent work by mr doob




Weird 2

Recent work by actionscript architect

Perlin noise algorithm to animate texture real-time into water effect

More environmental mapping effects by the away3d materials developer Fabrice. Fabrice and the away3d developers are really taking off with the papervision3d core. I am seeing lots of engine limits tested and some great work at away3d.

Bumpy Meteor

Flat Lighting on bitmapMaterial

Chrome Ball (dont’ zoom in too far :) )

Did your processor melt yet?

I think that for games and flash effects faking it or real environmental mapping will have to be judged by what is needed for your purpose. I think that Flash player on software rendering can only go so far. So if you have real-time environmental reflections and surroundings it doesn’t always make your gameplay better and it won’t make your demo better if it means removing assets in other areas to make up for the performance drain of software rendering and the pressures it puts on the processor or browser plug-in.

You can still make really killer effects with baked animations, fake environmental mapping, faked dynamic real-time lighting and other effects. Flash, nor silverlight, will not be able to match hardware rendered shaders, per pixel lighting and physics anytime soon. But people are making good progress on this. I think it would be great if hardware acceleration were added to both Silverlight and Flash, with that, a brand new massive game market online, and it will be game on!

Thursday, June 7th, 2007

Here’s some of the best commercial Papervision3d projects so far
(all commercial papervision I have seen so far has made theFWA):

1)  The Brahma Bus interactive project
       by Russian firm PARK Studios.

Customize your own VW Bus, received theFWA recognition.

2) Eye Project
Takayuki Fukatsu aka fladdict

This is a killer use of pixel color mapping to video overall color.  It has papervision in the archives where it uses some more really well done pixel manipulation effects, received theFWA recognition.

3) The Net Eye interface (based on pv3d sample PaperCloud)
      by Neteye

Nice interface based on a pv3d sample project, received theFWA recognition.

*** The authors of papervision3D also have some of the coolest demos with it as well listed here.

Carlo Ulloa (based on pv3d sample Focus – by far the best)
      by Carlo Ulloa

Papervision3d homepage Shark Demo (wait for it, wait for it…)

Very First Papervision3D Star Wars Game by John Grden.

Also the original shader demos by Ralph Hauwert were killer.

About Vector/Web 3d

Papervision3d created by Carlos Ulloa Matesanz, Ralph Hauwert, and last but not least John Grden has really hit a development and design nerve, along with AS3 finally being ready for primetime. People are really excited about projects like this and it just goes back to my point that in the Vector Wars (Adobe vs Microsoft (haxe making a little noise in dev circles as well)) whoever rolls out cross platform 3d harware rendering in their plug in they will pwn.

Whos the Next Leader of 3d on the Web?

Director has been abandoned for new released until 2008 at least for any 3d updates (if we ever see another version).  But Flash could implement OpenGL (which would lead to it maybe being open one day) and Silverlight would implement DirectX but woudl probably stop at implementing OpenGL.  Flash *could* own with hardware rendering but it opens it up to many more plugins which lead to Director being maxed out at 50% market saturation. 

Anyways, it probably won’t happen but today we have some nice 3d engines in Flash that are fast enough in AS3 with its new shiny VM and there have been some nice commercial successes of the wise early adopters of this technology. Papervision3D, Away 3d (possible merging of code), and Sandy have all helped to add to the buzz around AS3.

UPDATE: Check out this Mech Demo that is making the rounds.  The demo has working hit detection and projectiles from the mech as well as animation on the 3d model.