Use Away 3D man …

… or at least give it a try!

Working on Aviary I had the plesure to meet Alexander and Fabrice, the creator and one of the actual maintainers of Away 3D engine.

As you might known, we are using Away 3D for Hummingbird, and I had the plesure (yes, another :P) to give a look at the code an work in touch with the developers. I have to admit that Away 3D is really good!

I’m far to be the best person to suggest one framework over the others, but what I can do is tell you why I think Away 3D is (at least) worth a try, even if you are already working with Papervision 3D or the other engines. The first thing to know is that both the projects comes from the same branch – they have been splitted a few years ago (maybe just an year but I’m not sure) and then they followed two different paths. During my quick and basic experience with Away 3D I see that it has a real clean and powerful API (you have animation for instance or really good materials), good documentation and tutorials (see Fabrice‘s blog for a bunch of them!), more precise a quick rendering. And part of the new Papervision 3D 2.0 code is inspired by that library.

The various libraries outta there are for different purposes, and probably are taking (or will take) different directions (ie: see Alternativa 3D for instance, which seems well suited for games). But trying many of them instead focusing only on the most famous one is a really good thing – many users comes from PV3D for instance and are really happy about Away!

Don’t take my assumptions as gold: this is what I think after just a bit of playing 😉

Papervision3D component for Flash CS3

John Grden just released an amazing component for Flash CS3 for manage papervision3d on Flash IDE.

– Design-time render and editing in Flash IDE
– 3 Material types supported – BitmapFileMaterial, BitmaAssetMaterial and MovieAssetMaterial
– Creates MovieScene3D and Free or Target camera
– Manages resizing / centering of Papervision3D scene [optional]
– Dynamic masking to constrain the viewable render area to the bounds of the component [optional]
– Full API and access to Scene, Camera, Collada objects to code around
– Automatically loads materials via Collada file [when materials list is not given]
– New Custom Panel for modifying rotation, camera zoom, camera focus, camera Z at design-time

Download component here
See the presentation video

Papervision3D at google code: http://code.google.com/p/papervision3d/

Panoramic 360 with Papervision3d

Just before leaving for holidays I did a little test using papervision3d again, but then I forgot to post the result here…

Being able to parse 3dmax collada files and apply texture to its 3d objects I thought that with is probably the best and easiest way to create simple image panoramic viewer.

I first downloaded a trial of 3d Studio Max,  then I created a simple sphere (see the image) and attached an image as texture.
You can see here a screenshot of the resulting 3d object:

The next step is to download and install collada export for 3dsmax from Feeling Software and export the 3ds scene as collada file.

Now in flash create a new fla file with the same image used in the 3ds max file in library. Then just tell papervision to load the .dae file and associate the library image to the sphere object. You don’t have to worry about anything else 🙂

Here the script I used in the as:

package
{
import flash.display.*;
import flash.events.*;
import flash.geom.*;
import flash.ui.*;
import org.papervision3d.scenes.*;
import org.papervision3d.objects.*;
import org.papervision3d.cameras.*;
import org.papervision3d.materials.*;
import org.papervision3d.events.*;
public class main extends Sprite
{
private var container:Sprite;
private var scene:Scene3D;
private var camera:FreeCamera3D;
private var rootNode:DisplayObject3D;
private var DaeMaterials:Object;
private var center:Point;
private var rotating:Boolean;
private static var MAX_X_ROTATION:int = 12;
private var keyRight :Boolean = false;
private var keyLeft :Boolean = false;
private var keyForward :Boolean = false;
private var keyReverse :Boolean = false;
public function main()
{
center = new Point(0,0);
this.addEventListener( Event.ENTER_FRAME, loop3D );
this.addEventListener( MouseEvent.MOUSE_DOWN, mouseDownHandler);
this.addEventListener( MouseEvent.MOUSE_UP, mouseUpHandler);
init3D();
}
private function mouseDownHandler(evt:MouseEvent):void
{
center.x = container.mouseX;
center.y = container.mouseY;
rotating = true;
}
private function mouseUpHandler(evt:MouseEvent):void
{
rotating = false;
}
private function init3D():void
{
this.container = new Sprite();
addChild( this.container );
this.container.x = stage.stageWidth/2;
this.container.y = stage.stageHeight/2;
this.scene = new Scene3D( this.container );
camera = new FreeCamera3D();
camera.x = 0
camera.z = 0
camera.zoom = 1;
camera.focus = 200;
DaeMaterials = new Object();
var bmpMaterial:BitmapAssetMaterial = new BitmapAssetMaterial( "greece.jpg" );
//var testMaterial:WireframeMaterial = new WireframeMaterial(0x000000, 100);
//testMaterial.doubleSided = true;
bmpMaterial.doubleSided = true;
DaeMaterials.mymaterial = bmpMaterial;
rootNode = scene.addChild( new DisplayObject3D( "rootNode" ) );
rootNode.addCollada( "sphere.dae", new MaterialsList( DaeMaterials ) );
}
private function loop3D( event :Event ):void
{
var sphere:DisplayObject3D = this.rootNode.getChildByName( "Sphere01" );
if(sphere){
if(rotating){
camera.rotationY += (container.mouseX - center.x)/25
camera.rotationX -= (container.mouseY - center.y)/25
if(camera.rotationX > main.MAX_X_ROTATION) camera.rotationX = main.MAX_X_ROTATION
if(camera.rotationX < -main.MAX_X_ROTATION) camera.rotationX = -main.MAX_X_ROTATION } } this.scene.renderCamera( camera ); } } }

SoundMixer with Papervision3d & ImageProcessing

Recently I’ve joined the papervision3d mailing list and started to make some little test with 3ds max exported files just to see how it works and its performances.
There are various demos around the net about papervision and all of them are really impressive. Unfortunately my skills with 3D studio max are less than zero and so I could test only with basic objects..

BTW, after I’ve discovered also this great library (ImageProcessing) I decided to make a test with both the libraries together to create some effects to be used in a SoundMixer movie.

Here the result of my experiment: Main.html

Once the music starts click on the stage with mouse to change the visualization effect.
There are 6 different effects.
For the papervision objects I used these .dae files: cube.dae, plane.dae and sphere.dae ( download them )