Bend modifier for Papervision3D
UPDATE Sept 9th, 2008. The Bend modifier is now part of AS3Dmod library. Use that one instead of the class linked below.
Bending objects is one of the classic features of any 3D package. I thought it would be nice to be able to bend stuff in Papervision3D too.
First, I had to spend a couple of days trying to understand the concept of bending. It is fairly obvious when you see it, but when it comes to express bending with mathematical formulas, it is not. Plus, I am not very strong in math, and that doesn't help :)
Eventually I grasped the concept: bending means distributing all the vertices of an object around a point in space. The closer the point is from the object, the stronger the bend. I will prepare a separate post explaining this theory soon. For now, just play with the demo.
Currently the Bend class only accepts Planes, but I am working on a version that will be able to bend anything else. The source for the Bend class is here. It is a very basic version and the algorithm is not yet optimized, but it should give everyone who's interested a fairly good idea on how it is done. You can also grab the class and use it with your planes created in Papervision3D. Here's a basic use case:
-
plane = new Plane(someMaterial, 200, 200, 20, 20);
-
bend = new Bend(plane);
-
scene.addChild(plane);
-
bend.bend(Bend.X, Bend.Z, 1, 0.5);
Check the source file for detailed info about the arguments.
UPDATE June 16th 2008. Check the next post for a newer version of Bend class (demo included).
In general this kind of transformations are called modifiers and can be organized in stacks. This means that one modifier can be applied to an object, and then another one can be applied to the result of this transformation. For an interesting list of possible modifiers check here (examples are from 3dsMAX).
Modifiers stack is a powerful tool in 3dsMAX, it would definitely be good to have something like this in Papervision3D, don't you think?


Well, another great job. Good stuff.
Very cool.
Love it!
I wish I came across this a month or so ago. I ended up writing something really simple that used a simple acceleration/ease to step through all the vertecies and raise them incrementally along the z axis.
Your class takes it up a step and uses the proper math to get a really circular curve. GREAT JOB!!!!
[...] Bartek thought it would be nice to be able to bend stuff in Papervision3D too. Read his post and download the source [...]
It appears your Bend class does not work with the latest pv3d revision (the newly merged Great White and Effects branches). For starters, the lines:
import org.papervision3d.objects.primitives.Plane;
import org.papervision3d.core.geom.renderables.Vertex3D;
should now be:
import org.papervision3d.objects.Plane;
import org.papervision3d.core.geom.Vertex3D;
Even after changing these, I’m still not getting the class to work right, but I’m looking into it. Maybe I’m not even using the class right? Although it seems straight forward enough. I couldn’t check since I didn’t see the source for the $100 demo.
The demo looks great, nice work. Hopefully I can get it running soon :)
@nate thanks! I did not checkout the latest revision, but I will do that and update this.
Great work, congrats!
[...] modifier for Papervision3D Bartek Drozdz from Everyday Flash has posted an interesting Bend class that bends planes along their X and Y axis. Very useful for a number of cases, including a PV3D [...]
very cool effect! thanx for the sources!
Great ! Thanks for share !
So I got it all up and running in the current pv3d rev. It really is a great class! I’m attempting to use it to create the illusion that you are “peaking at a Texas Hold’em card”. It seems like there is a 3rd parameter needed to do this properly. For example, let’s say I want the force to be 1.5, but I only want this to effect the top half of the player card. I could split the playing card into two separate planes, that appear to be one, and then apply a 1.5 force with the offset = 0. But this would be way less efficient. Any chance you could add this? ::wishful thinking::
@nate Great to hear that! I see what you are looking for with the card – I was thinkking about something like ‘limit’ parameter, which I guess would be what you need. I will add that.
For the moment I focused on optimizing the math in the class and make that so that it works with any 3D Object. I’ve already done some good progress, and I will post the updated sources pretty soon.
hi Bartek, greetings from Warsaw, that’s pretty zajebisty stuff! nice work, thanx
[...] Drozdz posted a demo the other day of a Bend Modifier. The fact that no modifiers exist in pv3d is a crime – so I decided I would start off an official [...]
Andy,
Thats deeply cool.
~a~
Twist and Bend nice work!:)
dobra slonko, podoba mi sie bardzo ;)
thats really amazing! can’t wait to play arround with it
Pretty cool experiment. I suppose that it is a beginning of a whole new block of cool things for PV3D :)
wooooooooooooooooooooooooooooooooooow
Very nice.
[...] recorded first by arollin on 2008-07-24→ Bend modifier for Papervision3D [...]
Hey Bro, good job!
I don’t know if you already did that, but let me show.
I did some modification in your code to turn it compative with some tween classes.
Now I can do, using Tweener like a example:
bend = new Bend( plane, Bend.X, Bend.Y, 0, 0.5 );
Tweener.addTween( bend, { force:1, offset:1, delay:1, time:3 } );
the modified source you get here: http://orlleite.googlepages.com/Bender.zip
Thx!
@Orlando Leite Thanks mate! I will update the Bend class soon. I know that there are some issues with tweening in there – itwill be solved. I also plan to add some new functionallities.
[...] Read his post and download the source. [...]
[...] Version 2: Create 1 cube with a depth of 0. Then you just apply a material to the front and back. OK OK OK so this is not really a Plane… but I like this approach because it allows me to more easily use things like Bend Modifier. [...]
Good Job, Thanks for share.
great job!
is there any chance to reduce the code so it could fit in the banner (cca. 50KB)? it shouldnt be interactive.
@igregurec the Bend class itself should be pretty lightweight. The files size comes from the Pv3D classes. Be sure to “omit trace” when exporting – that cuts pv3d by 20-30kb.
[...] Visit site [...]
Could you please post some curling page example so we can find real use of bender. Thx in anycase.
@Alex curling – I still have to work on that, but in the meantime you should take a look at this:
http://www.everydayflash.com/blog/index.php/2008/11/03/paper-simulation-as3dmod/
This takes bending to the next level.
[...] Version 2: Create one cube with a depth of 0. Then you just apply a material to the front and back. OK OK OK so this is not really a Plane… but I like this approach because it allows me to more easily use things like Bend Modifier. [...]
[>>>Great Job>>>] Papervision 3D is wonderful. I didn’t saw this type of feature in actionscript….. I want to do some R&D in Papervision 3D. I downloaded the files, but i am handling so many problem, when i published the fla file…………………. So please provide me the source file(fla & class file) for Bend the plane object with 3D rotation.[sudipisdas@gmail.com] :)
@Sudip All of my examples on this blog are built with the Flex SDK which doesn’t use FLA files. If you want to play with Papervision3D (do it, it is really fun!) the best start is to switch from the Flash IDE to an Actionscript editor. If you haven’t used any, the best choice for the beginning is FlashDevelop – it is free and offers a quite decent functionality. Here’s some more details and links:
http://www.everydayflash.com/blog/index.php/2008/07/01/flash-on-free-software-flashdevelop-flex-sdk/
[...] et deux trois fonctionnalités parallèle que j’avais vu il y a quelques temps : – Plier un billet avec Papervision3D et AS3dMod – Approche de AS3dMod, vraiment [...]
My individual pv3d site. visit and comment please
Very nice demo. And pretty helpful as well.
I’m struggling with on little thing.
I just don’t get the purpose of the bendPhase.
I’m also not pretty sure about bend.force.
Anybode any hints, links or explanations for that?
Thanks in advance and sorry for the bad english.
Cheers, Dan
cool
Could you advice how to bend just only part of the plane? Is there any way to set which part I want to modify? Or I have to allway modify whole the plane dor example…
thanks for all ideas ….
Great Unity/Flash/PV blog: http://www.everydayflash.com/blog/index.php/2008/06/11/bending-modifier-papervision3d/