Navigation


RSS : Articles / Comments


Papervision 3D Modifiers (Bend & Twist)

3:49 PM, Posted by Jim Foley, 5 Comments

Modifiers!!! If you're familiar with 3ds max then you just might be familiar with the modifier stack. Basically, modifiers are transform effects. Andy Zupko and Bartek Drozdz have begun (what will hopefully expand even more) implementing modifiers within Papervision.

Bartek Drozdz kicked off modifiers by building the Bend modifier. Andy Zupko then followed up with a Twist modifier. They are wonderful little tools. Now to figure out a way to implement them into my web projects. >-)

Bend & Twist Modifier

example: Modifiers
source: Bend & Twist Modifier Example
requirements: Bend Modifier Class / Twist Modifier Class

//import the Bend and Twist Modifiers
import com.everydayflash.pv3d.modifiers.Bend;
import com.everydayflash.pv3d.modifiers.Twist;

//declare a Bend and Twist variable along with an object to apply the modifiers to
private var bend:Bend;
private var twist:Twist;

private var plane:Plane;
private var plane2:Plane;

//next you will need to instantiate your planes
//after that, instantiate your modifiers and pass the plane you wish to apply the modifier as a parameter
bend = new Bend(plane);
twist = new Twist(plane2);

//then, inside your enterframe handler render the modifier effect
bend.bend(Bend.X, Bend.Z, mouseX/stage.width * 2, .5);
twist.twist(mouseX * (1/3), new Number3D(0, 1, 0), new Number3D(0, 0, 0));

Please note that the sample files are meant to be generated with Flex. If you don't have Flex you can remove the [SWF] metadata and then apply the .as file as a document class to a new fla and publish. The Modifiers are required (duh!) as well. Be sure to download those and add them to your library.

Andy Zupko's Blog
Bartek Drozdz's Blog

5 Comments

Gordon @ July 30, 2008 6:44 AM

Hi, the example isn't working! (Firefox)

Jim Foley @ July 30, 2008 3:46 PM

I've noticed that Firefox has been having trouble viewing straight up .swf url's. View this example in IE. Not a big deal but I'd need to wrap the swf in an html file to make it viewable in firefox.

Anonymous @ August 14, 2008 9:08 AM

hi, i cant see any of your examples, always "bad request"....
Bad Request (Invalid Hostname)

can you help me please?

masuno

Matt Pelham @ September 4, 2008 7:27 AM

Hey there, any way of stacking bends on an plane? I'm trying to make an origami application and just want to test the strength of the script.

Thanks

Jim Foley @ September 8, 2008 9:00 AM

Thats probably a questions for Bartek Drozdz (the creator of the Bend Modifier). Since this post, he has come out with "AS3DMod". Which is a modifier stack class. You might look into that. It is a longer term solution.

Here is the link: http://www.everydayflash.com/blog/index.php/2008/09/03/as3dmod/