This is getting a little off topic since there is no use of Papervision. This is something we were messing with over at Woven.
Author Archive for Admin
Just wanted to write a quick post with some things we are messing with at Woven Interactive. Be sure to follow the steps outlined in the example.
FLARToolkit has opened the doors for creating some amazing things.
Feel free to share your ideas / thoughts here.
DOWNLOAD AND PRINT THIS FIRST!
Example requires a webcam.
When we first saw the GE Smart Grid website all we could think was WOW. Great 3D and messaging. Seeing the Augmented Reality section that mixed the FLARToolkit and Papervision really created something unique.
We found a few examples of people playing with it online but no real amounts of source code. Also did not know the HIRO file format was. It turns out you don't need a *.hiro file, you can swap it out with a *.pat file. There is even an online ARToolKit Maker Generator that is quick and easy to use.
Onto the source code:
This is a modified example taken from the provided example source code (The hello world of the FLARToolKit):
-
package net.saqoosha.flartoolkit.example {
-
-
import org.papervision3d.materials.BitmapFileMaterial;
-
import org.papervision3d.objects.DisplayObject3D;
-
import flash.events.Event;
-
import flash.events.MouseEvent;
-
import org.papervision3d.core.proto.DisplayObjectContainer3D;
-
import org.papervision3d.objects.primitives.Sphere;
-
-
import org.papervision3d.lights.PointLight3D;
-
import org.papervision3d.materials.WireframeMaterial;
-
import org.papervision3d.materials.shadematerials.FlatShadeMaterial;
-
import org.papervision3d.materials.utils.MaterialsList;
-
import org.papervision3d.objects.primitives.Cube;
-
import org.papervision3d.objects.primitives.Plane;
-
-
-
[SWF(width=700,height=400,frameRate=30,backgroundColor=0x0)]
-
-
public class SimpleCube extends PV3DARApp {
-
-
private static const PATTERN_FILE:String = "resources/marker16.pat";
-
private static const CAMERA_FILE:String = "resources/camera_para.dat";
-
-
protected var plane:Plane;
-
protected var objectsContainer:DisplayObject3D;
-
protected var cube:Cube;
-
protected var sphere:Sphere
-
protected var wovenCube:Cube;
-
protected var imageMat:BitmapFileMaterial;
-
protected var fmat:FlatShadeMaterial;
-
protected var wmat:WireframeMaterial;
-
-
public function SimpleCube()
-
{
-
addEventListener(Event.INIT, onInit);
-
init(CAMERA_FILE, PATTERN_FILE);
-
}
-
-
private function onInit(e:Event):void
-
{
-
removeEventListener(Event.INIT, onInit);
-
-
//Create light source for shade material
-
var light:PointLight3D = new PointLight3D();
-
light.x = 1000;
-
light.y = 1000;
-
light.z = -1000;
-
-
//Create Materials
-
imageMat = new BitmapFileMaterial("resources/woven-logo.jpg", false);
-
fmat = new FlatShadeMaterial(light, 0xFFFFFF, 0x0);
-
wmat = new WireframeMaterial(0xff0000);
-
wmat.doubleSided = true;
-
-
//Create objects
-
objectsContainer = new DisplayObject3D();
-
plane = new Plane(wmat, 100, 100,1,1);
-
wovenCube = new Cube(new MaterialsList( { all: imageMat } ), 150, 150, 150);
-
cube = new Cube(new MaterialsList( { all: fmat } ), 20, 200, 20);
-
sphere = new Sphere(fmat, 20);
-
-
-
//Position elements
-
sphere.y = 200;
-
wovenCube.z += 100;
-
objectsContainer.z += 100;
-
-
//Add objects to my container
-
objectsContainer.addChild(sphere)
-
objectsContainer.addChild(wovenCube)
-
objectsContainer.addChild(cube)
-
-
//Add to base
-
_baseNode.addChild(plane);
-
_baseNode.addChild(objectsContainer);
-
-
}
-
-
override protected function _onEnterFrame(e:Event = null):void
-
{
-
super._onEnterFrame(e);
-
sphere.rotationY += 10;
-
wovenCube.rotationZ += 10;
-
}
-
-
}
-
-
}
As you can see from this line:
-
private static const PATTERN_FILE:String = "resources/marker16.pat";
We replaced the *.hiro file with a *.pat file.
To get this example to work you will have to DOWNLOAD AND PRINT THIS FIRST!
Download the full source
and / or
View the interactive example.
Learn more about the FLARToolKit
If you or your clients need any help getting started feel free to contact our Interactive Agency.
Here is an example of using a 3ds model in Flash / Papervision with zoom / rotational controls. For the reflection a second viewport was created with the model inside of it and filters applied:
-
<br />
-
viewPort2.filters = [new BlurFilter()];<br />
Source code will follow in the next few weeks when I am able to clean up the extra garbage.

Hey Everyone,
Just a quick note and apology for some recent server / upgrade issues. The transition of servers, code and WordPress updates have created a little bit of a mess.
Please feel free to air your grievances here. Especially if things appear broken or look out of place. We will do our best to fix and resolve asap. Thanks for understanding while we are in this transition period. We hope to continue supplying the best Flash / Papervision tutorials for years to come.
Charlie

Here is a quick list of Classes / Packages and programs that seem to make life just that much easier. This is a list based off of things we use daily for quick development of agency type Flash sites. This is in no way a complete list but anyone just wanting to increase their productivity can start here.
Programs:
1) FlashDevelop (PC only - or via VMWare) :/
Use this and easily literally shave days off your coding time. If you don't use this go with FlexBuilder.
2) Charles (Mac or PC)
Find the root of the real issues when you load dynamic content.
3) Smart FTP (PC only) :/
Quick uploads
Code:
Call a method / function a second later or a frame later. Also has a LoadWatcher for loadProgress
2) Tweener
Some use TweenLite I like Tweener. It always seems to yield the best results. I could be wrong but that's my opinion.
2) I was wrong - TweenLite/Max
The results speak for themselves - TweenLite/Max vs other Tween Engines
3) BulkLoader (unless you're using Gaia - see below)
The hotness for loading multiple files and having access to them across your whole project.
4) Papervision
Of course. :-D
* Added from Comments *
Frameworks:
1) Gaia
Steven Sacks has created one of the best frameworks that is to be used on agency style Flash sites. You can have an entire simple flash site up in about 5 minutes or less. (not joking). Site scaffolding, asset loading, browser navigation, page loading, SEO, a place for your transitions (code or timeline) and much more. AS2 and AS3 supported. Check it out!
Are there any programs or code bases you can't live without?
Let us know.





