Using a Viewport as a Mask
package { import flash.display.Bitmap; import flash.events.Event; import org.papervision3d.materials.ColorMaterial; import org.papervision3d.objects.primitives.Plane; import org.papervision3d.view.BasicView; [SWF(width="640", height="480", backgroundColor="#000000", frameRate="60")] public class ViewportAsMask extends BasicView { [Embed(source="assets/rover.jpg")] private var roverAsset:Class; private var rover:Bitmap; private var plane:Plane; public function ViewportAsMask() { rover = new roverAsset() as Bitmap; rover.mask = viewport; addChild(rover); var colorMaterial:ColorMaterial = new ColorMaterial(0xffffff); plane = new Plane(colorMaterial); plane.z = -500; scene.addChild(plane); startRendering(); } override protected function onRenderTick(event:Event=null):void { plane.moveForward(500); plane.rotationY = -viewport.containerSprite.mouseX / 320 * 90; plane.moveBackward(500); renderer.renderScene(scene, camera, viewport); } } }
4 Comments to Using a Viewport as a Mask
Is there an easy way to use masks inside of a 3D Scene? Like using a plane as mask? I’d like to use FLARToolKit and the marker shape should become a window.. like in the example of “General Electrics’ Smart Grid” and I don’t know how to do it
I’m trying to achieve that too, Marcus. I’m remembering an AR demo with some tanks driving out of a hole in the wall.
April 26, 2009
Hey guys, Saqoosha posted a simple example on how to make a hole on his blog:
http://saqoosha.net/en/2009/01/08/1676/
Thanks Marcus!
That’s so funny, I was googeling for the exact same thing as you guys. Scary to stumble upon some other people that are all experimenting with FLAR toolkit, in a non related article.
Gotta love the internet!
Cheers!
Leave a comment
Search
Recent Posts
- MorphController - Mighty Morphing Papervision3D
- End dump
- Test if a plane is within the view of the camera (aka testing if culled)
- Materials Reference
- Perlin Blob
- Dynamic Text on a Plane
- Maya Texture Baking
- Creating a Custom VectorVision Font
- Workshop video and example dump
- 3D Math Book Recommendation
- Heading to New York. brb ;)
- Launching Flex4.org
- Flex 4 Layouts and Groups
- Flex 4 States
- How to click on stuff in Papervision3D - Viewport, ViewportLayers, InteractiveScene3DEvent, Mouse3D, and MovieMaterial Buttons
Recent Comments
- alexxcz on MorphController - Mighty Morphing Papervision3D
- andre venancio on 3D Math Book Recommendation
- DS on Dynamic Text on a Plane
- John Lindquist on Maya Texture Baking
- Itai on Maya Texture Baking
- Javier on End dump
- samBrown on End dump
- tf on archive
- Pan on requests
- Martin Lindelöf on requests


March 14, 2009