Archive for April, 2007

Sisters of Psyop

Saturday, April 21st, 2007 by Anna

Those among you who followed the work of NYC based post house Psyop over the past years might be interested in the fact that they have two sister companies: One is called Blacklist, the other one Mass Market - both create loads of great visual FX movies. Have a look!

psyop

Flash: How to add Video texture in Papervision 3D

Sunday, April 15th, 2007 by Luis

I have received loads of requests asking how to diaplay a FLV as a texture in Papervision 3D using AS3.

The concept is very basic, you need to snapshot the video object where the video is running using BitmapData.draw(), and then set the result in the texture, and the rest is done by the 3D engine. ( See demo here)

papervideo

Notice in the code below a small hack by Chris Chen to be able to draw a media source in AS3 bypassing security errors.

Code Updated for latest Flash player and PV3D GreatWhite:

Actionscript:
  1. package com.lessrain.projects.luis.pv3dWhite.video3d
  2. {
  3.     import flash.display.BitmapData;
  4.     import flash.display.Sprite;
  5.     import flash.events.AsyncErrorEvent;
  6.     import flash.events.Event;
  7.     import flash.geom.Point;
  8.     import flash.geom.Rectangle;
  9.     import flash.media.Video;
  10.     import flash.net.NetConnection;
  11.     import flash.net.NetStream;
  12.     import flash.system.Security;
  13.  
  14.     import org.papervision3d.cameras.Camera3D;
  15.     import org.papervision3d.materials.BitmapMaterial;
  16.     import org.papervision3d.objects.DisplayObject3D;
  17.     import org.papervision3d.objects.primitives.Plane;
  18.     import org.papervision3d.render.BasicRenderEngine;
  19.     import org.papervision3d.scenes.Scene3D;
  20.     import org.papervision3d.view.Viewport3D;   
  21.  
  22.     /**
  23.      * @author Luis Martinez, Less Rain (luis@lessrain.com)
  24.      */
  25.     public class Video3D
  26.     {
  27.         private var _target : Sprite;
  28.         private var _container : Sprite;
  29.         private var _viewport : Viewport3D;
  30.         private var _renderer : BasicRenderEngine;
  31.         private var _scene3D : Scene3D;
  32.         private var _camera : Camera3D;
  33.         private var _rootNode : DisplayObject3D;
  34.         private var _connection : NetConnection;
  35.         private var _stream : NetStream;
  36.         private var _video : Video;
  37.         private var _videoWidth : Number = 320;
  38.         private var _videoHeight : Number = 240;
  39.         private var _videoTexture : BitmapData;
  40.         private var _planeTexture1 : BitmapData;
  41.         private var _planeTexture2 : BitmapData;
  42.         private var _srcRect1 : Rectangle;
  43.         private var _srcRect2 : Rectangle;
  44.         private var _basePoint : Point = new Point(0, 0);
  45.  
  46.         public function Video3D()
  47.         {
  48.             Security.loadPolicyFile("http://www.yourdomain.com/cross-domain.xml");
  49.         }
  50.  
  51.         public function initialize() : void
  52.         {
  53.             _srcRect1 = new Rectangle(0, 0, _videoWidth>> 1, _videoHeight);
  54.             _srcRect2 = new Rectangle(_videoWidth>> 1, 0, _videoWidth>> 1, _videoHeight);
  55.             _videoTexture = new BitmapData(_videoWidth, _videoHeight);
  56.             _planeTexture1 = new BitmapData(_videoWidth>> 1, _videoHeight);
  57.             _planeTexture2 = new BitmapData(_videoWidth>> 1, _videoHeight);
  58.            
  59.             initialize3D();
  60.             loadVideo();
  61.             createPlanes();
  62.            
  63.             _container.addEventListener(Event.ENTER_FRAME, loop3D);
  64.         }
  65.  
  66.         private function initialize3D() : void
  67.         {
  68.             _container = new Sprite();
  69.             _target.addChild(_container);
  70.             _viewport = new Viewport3D(990, 600, false, false);
  71.             _container.addChild(_viewport);
  72.             _renderer = new BasicRenderEngine();
  73.             _scene3D = new Scene3D();
  74.             _camera = new Camera3D();
  75.             _camera.zoom = 8;
  76.             _camera.focus = 200;
  77.             _rootNode = new DisplayObject3D();
  78.             _scene3D.addChild(_rootNode);
  79.         }
  80.  
  81.         private function loadVideo() : void
  82.         {
  83.  
  84.             var customClient : Object = new Object();
  85.  
  86.             customClient["onCuePoint"] = cuePointHandler;
  87.             customClient["onMetaData"] = metaDataHandler;
  88.            
  89.             _connection = new NetConnection();
  90.             _connection.connect(null);
  91.  
  92.             _stream = new NetStream(_connection);
  93.             _stream.checkPolicyFile = true;
  94.             _stream.addEventListener(AsyncErrorEvent.ASYNC_ERROR, asyncErrorHandler);
  95.             _stream.client = customClient;
  96.             _video = new Video(_videoWidth, _videoHeight);
  97.             _video.attachNetStream(_stream);
  98.        
  99.             _stream.play('http://www.blog.lessrain.com/wp-content/upload/papervideo/myvideo.flv');
  100.         }
  101.  
  102.         private function cuePointHandler(infoObject_ : Object) : void
  103.         {
  104.         }
  105.  
  106.         private function metaDataHandler(infoObject_ : Object) : void
  107.         {
  108.         }
  109.  
  110.         private function asyncErrorHandler(event : AsyncErrorEvent) : void
  111.         {
  112.         }
  113.  
  114.         private function createPlanes() : void
  115.         {
  116.  
  117.             var material1 : BitmapMaterial = new BitmapMaterial(_planeTexture1);
  118.             material1.oneSide = false;
  119.             var plane1 : DisplayObject3D = _rootNode.addChild(new Plane(material1, _videoWidth>> 1, _videoHeight, 4, 4), "plane1");
  120.             plane1.x = -_videoWidth>> 2;
  121.             var material2 : BitmapMaterial = new BitmapMaterial(_planeTexture2);
  122.             material2.oneSide = false;
  123.             var plane2 : DisplayObject3D = _rootNode.addChild(new Plane(material2, _videoWidth>> 1, _videoHeight, 4, 4), "plane2");
  124.             plane2.z = _videoWidth>> 2;
  125.             plane2.rotationY = -90;
  126.         }
  127.  
  128.         private function loop3D(event_ : Event) : void
  129.         {
  130.    
  131.             _rootNode.rotationY += ((-_container.mouseX * 0.5) - _rootNode.rotationY) / 10;
  132.             _rootNode.rotationX += ((-_container.mouseY * 0.5) - _rootNode.rotationX) / 10;
  133.             _videoTexture.draw(_video);
  134.             _planeTexture1.copyPixels(_videoTexture, _srcRect1, _basePoint);
  135.             _planeTexture2.copyPixels(_videoTexture, _srcRect2, _basePoint);
  136.             _renderer.renderScene(_scene3D, _camera, _viewport);
  137.         }
  138.  
  139.         public function get target() : Sprite
  140.         {
  141.             return _target;
  142.         }
  143.  
  144.         public function set target(target_ : Sprite) : void
  145.         {
  146.             _target = target_;
  147.         }
  148.     }
  149. }


Jobs in Tokyo / Tokyo Art Beat

Monday, April 2nd, 2007 by Carsten Schneider

If you're looking for a job in the creative industry in Tokyo - or indeed if you have a position to offer - I'd like to point you to the job section of Tokyo Art Beat.

If you haven't heard of TAB yet, the site gives an excellent overview over Tokyo's art scene, covering all art events and venues in Japanese and English. The job section is small but the jobs on offer are good, and we've received great applications through TAB so far.