New Portfolio in the Making

Marc Pelland PortfolioI was working on some stuff for a couple friends last night, and some other stuff for work when I decided that I wanted a little break to work on something for myself. So I got myself a beer and sat down at my laptop. For a long time now I have been planning on doing something interesting to my portfolio. I had thought maybe something with papervision and maybe something with a different approach to dynamic content. So that is where I began.

When I first created my portfolio, I did it quickly in HTML just to have something online. I made sure that the syntax was valid just in case I decided to create something to parse it with. Well that was my first step for the new creation. I used E4X to grab and parse the correct div within my current HTML portfolio. From there I just built out a little data model to grab whatever I might need from the parsed HTML structure.

Now I needed to do something with it. Why not Papervision, I have a couple projects under my belt now and just happened to update my local copy because I am using it on another project right now. So I just started playing around with the interaction and ways of displaying content.

After a couple hours I was pleased and went back to my other work. I picked it up today after work for an hour or so and would like to say I am very happy with the direction that it is taking. Let me know what you think so far.

click here to see the latest built

Motion Tracking and Papervision

A couple of days ago I posted my first attempt at motion tracking in AS3 using a webcam and promised that I would play a little bit more with it. Well, I got a little bit anxious and before refining the tracking code I decided to put it to use.

You may have seen the video of head tracking using the Nintendo Wii. That video inspired me to try my hand at the same concept using Flash, Papervision 3d, and my newly discovered love for trying to get motion tracking / facial recognition into Flash.

Motion Tracking and Papervision

As such, I have created this example which is my first step in creating some sort of tracking interaction with a 3d scene. if you would care to see a little bit more detail about what is going on, hit X to see the video and W to see the framerate. Stay tuned for more updates as I update the tracking code. Once again, I will post the source when it is a little further along.

** please note that you require a webcam to take advantage of the motion tracking, if you do not have a camera the scene’s camera is simply controlled by the mouse.

FITC – Papervision Workshop / Kickoff

I am here in Toronto and glad to be here! I left a blizzard in Calgary to come to sunny Toronto and attend the Flash in the Can conference. Yesterday, I went to a Papervision 3d workshop run by Ralph Hauwert (www.unitzeroone.com) who showed us just how much can be done with 3d on the internet and he was kind enough to share some knowledge and code with the group.

I can’t say that I was blown away by what I saw and learned because it was a very low-level session but I believe that I am taking away a good base to start on my own projects with Papervision. I recommend similar workshops to anyone who doesn’t know much about Papervision and would like to see what it is about and get a good understanding of what it is and how to use it.

Following the full day workshop, I attended a little function in Kensington Market with a presenter from Graffiti Research Lab (graffitiresearchlab.com) that showed some of what they are all about and some of their latest works. It was quite inspiring to see what they have been up to and their methods.

To top off the night, the FITC kickoff party at the Burroughs was a lot of fun. The venue had a unique style that I am not used to seeing in Calgary. I had a good time talking with people from around the industry and meeting as many people as possible. It also gave me a chance to catch up with some old friends and co-workers that I don’t get to see since I moved to Calgary.

I am now sitting here on the official Day 1 of the conference waiting to hear what Colin Moock (www.moock.org) has to say about Actionscript 4.

Papervision Actionscript 2 BitmapFileMaterial

I have kept it no secret that I would really like to become much more familiar with Papervision. This means playing around with it. While I would ultimately like to be able to use AS3, I decided that I would like to learn a little bit about PV3d in a more familiar language.

Upon decided to try a project in AS2, I instantly discovered that there are many short-comings when comparing the capabilities the AS2 version to the AS3 version. One thing that I felt I needed to do was load external images as materials for objects. I searched and I searched and didn’t really find much to support my need. I did manage to find a class called LoadArrayMaterials written by JLM at Justinfront DOT net. This was very helpful, but I thought that I might like to load one image at a time.

I decided to write the class myself using the guidance of JLM’s classfile. The result, a quick class that does just what I want !

/***************************************************************************
* BitmapFileMaterial
*
* uses the functionality from the built in BitmapMaterial
* in PV3D to allow the user to assign an external image
* to a material in as2
*
* @author: Marc Pelland
* @date: April 13, 2008
*
* ***************************************************************************
* Example:
*     var myMaterial:BitmapFileMaterial = new BitmapFileMaterial();
*     myMaterial.loadImage(__applicationData.pages.page[i].image.text);
*     myMaterial.onLoadInit = function( material ) {
*         material.oneSide = false;    // double sided
*         material.smooth = true;        // smoothing
*     }
***************************************************************************
* credit to JLM at Justinfront DOT net for LoadArrayMaterials class
***************************************************************************/

import org.papervision3d.materials.BitmapMaterial;
import com.dynamicflash.utils.Delegate;
import flash.geom.Rectangle;
import flash.display.BitmapData;

/***************************************************************************
* The BitmapFileMaterial class creates a texture from an external file
*
*/
class com.marcpelland.as2.papervision.materials.BitmapFileMaterial  {

// store the material info
private var __bitmapMaterial:BitmapMaterial;
public function get bitmapMaterial():BitmapMaterial {
return __bitmapMaterial;
}

private var __materialHolder_mc:MovieClip;    // holder for the material
private var __loadListener_obj:Object;        // load listener
private var __loader_mcl:MovieClipLoader;    // movie clip loader
private var __path:String;                    // file path

// set a separate load init function
private var __onLoadInit:Function;
public function set onLoadInit(ARG_func:Function):Void {
__onLoadInit = ARG_func;
}

/***************************************************************************
* CONSTRUCTOR
****************************************************************************/

function BitmapFileMaterial() {
init();
}

/***************************************************************************
* PUBLIC FUNCTIONS
****************************************************************************/

/***************************************************************************
* load image function
*
* @param ARG_filePath - path to the image file
*
* creates a clip holder, moves it off screen and loads
* the image into the holder
*/
public function loadImage(ARG_filePath:String):Void {

// updates bitmap material ( designed to not overwrite material already assigned )
__materialHolder_mc = _root.createEmptyMovieClip( 'materialHolder__' + _root.getNextHighestDepth(), _root.getNextHighestDepth());

// place off screen
__materialHolder_mc._x = -5000;

// load the image into the holder
__loader_mcl.loadClip( ARG_filePath, __materialHolder_mc );

}

/***************************************************************************
* PRIVATE FUNCTIONS
****************************************************************************/

/***************************************************************************
* init function
*
* initialize the loader
*/
private function init():Void {

// set up the loader
__loader_mcl = new MovieClipLoader();

// set up the listener
__loadListener_obj = new Object();

// add the load int functionality
__loadListener_obj.onLoadInit = Delegate.create(this, loadInit);
__loader_mcl.addListener(__loadListener_obj);

}

/***************************************************************************
* loadInit function
*
* the image has been loaded and all is ready to move on
*/
private function loadInit():Void {

// get the material into a BitmapMaterial
__bitmapMaterial =  writeMaterial();

// run the custom load init command
__onLoadInit( __bitmapMaterial );

}

/***************************************************************************
* write material function
*
* create a bitmap and copy the data from the movieclip
* to the bitmap, return the bitmap
*/
private function writeMaterial():BitmapMaterial {

// draw movie on bitmap
var bitmap = new BitmapData(__materialHolder_mc._width, __materialHolder_mc._height, false, 0x000000);
bitmap.draw(__materialHolder_mc);

var rectangle:Rectangle = new Rectangle(0 , 0, __materialHolder_mc._width, __materialHolder_mc._height );
bitmap.copyPixels( bitmap, rectangle, rectangle );

// assign material
var material_bm:BitmapMaterial = new BitmapMaterial(bitmap);

// remove the temp clip
__materialHolder_mc.removeMovieClip();

return material_bm;
}

}

Flash In The Can – Toronto

Flash in the CanFlash in the Can Toronto 2008 is quickly approaching, and I am getting very anxious to go. I used to attend the conference every year but missed it last year since I now live in Calgary. Critical Mass is nice enough to send me to the conference this year in hopes that i pick up a couple tips and tricks to show off when I get back. So I get to go back to Toronto!

If you are considering going to the conference, I highly recommend it if not just for inspiration. Being in the presence of the industry leaders is usually enough to get my mind going a mile a minute. Another incentive is that the great folks at FITC appear to be giving a couple last minute ticket discounts. I came across one such discount on moockblog.

While at the conference I will be attending the Papervision 3d workshop which I hope gives me the final push and confidence to start really getting into pv3d. I hope to take in a lot of the technical presentations that are being offered and I will be posting my notes and work throughout the conference.

Flash in the Can