Bend modifier - part II
First of all, thanks for the great feedback I got after the first post on bending. I really appreciate it.
This time, I post an updated version of the Bend class for Papervision3D that works with every simple DisplayObject3D - that is, a DisplayObject3D that does not contain any child objects. Click here for a demo. The algorithm has been refined and the class public methods have been changed. Here's an updated use-case:
-
do3d = new SomeDisplayObject3D()...
-
bend = new Bend(do3d );
-
scene.addChild(do3d );
-
bend.bend(Bend.X, Bend.Z, 2, 0.4);
The bend() method accepts four arguments, out of which the two first are new:
- The axis of the bend
- The direction of the bend
Now: I tried to write the theory behind those axes. I really did! But then this post was becoming boring and highly incomprehensible, so I gave up.
The best thing to do is to experiment with those setting. Each argument can take one of the three values: Bend.X, Bend.Y and Bend.Z. Different primitives will need different settings for the bending to look correct, but on the other hand, playing with them can lead to quite fascinating and weird-looking shapes, so be sure to try different combinations.
If you do not have time to experiment however, I created a special method, that magically bends the object the right way:
-
bend.quickBend(2, 0.4);
The two other arguments are 'force' and 'offset'. Both are described in detail in the source code. Additionally, I also published the source of the demo here. Have fun!

June 16th, 2008 at 11:17 pm
Very nice update!! It sounds like you got my request from your first post in there..? I’ll start playing with it tonight. Thanks again!
June 16th, 2008 at 11:46 pm
So I got it up and running with the current rev (592) of pv3d. If anyone else is trying to do this, please copy and paste the following imports over the current list of imports and it will work:
import org.papervision3d.objects.DisplayObject3D;
import org.papervision3d.objects.Collada;
import org.papervision3d.objects.Cone;
import org.papervision3d.objects.Cube;
import org.papervision3d.objects.Cylinder;
import org.papervision3d.objects.Sphere;
import org.papervision3d.objects.Plane;
import org.papervision3d.core.proto.MaterialObject3D;
import org.papervision3d.core.geom.Vertex3D;
And, alas, there is still no feature to limit the Bend’s effect, so it only works on half of a plane instead of the full plane (for example). Still an outstanding class and I really appreciate your work Bartek, but I would LOVE to see a limiting parameter added :)
June 17th, 2008 at 3:43 pm
That’s awesome! Very useful.
I guess the next step now would be adding a custom source point for the bending; instead of the middle of shape, it could happen from an arbitrary coordinate. For example, it would be very useful to animate a character wagging its tail or a page flipping.
Great work!
June 17th, 2008 at 6:44 pm
Hey Bartek. You’ve got some great stuff coming out here; I’ve seen a couple shoutouts on the PV3D blog. Keep ‘em coming.
June 19th, 2008 at 12:21 am
@nate. You asked for the limit feature - you’ve got it! Chekout the latest version from SVN and take a look at the ‘constraint’ public property in the class. It can be either LEFT, RIGHT or NONE (I’ve created static fields for that) - which combined with the offset parameter will do the limiting you are looking for. I will document it soon.
Also - I compile it under the Great White branch, that is why my imports are different, but I am happy that it works for the trunk too.
@carlos I was thinking about that, but I won’t be adding this feature now. If you want to animate a dogs tail, try to combine bending with rotation.
PLUS. I have been also asked if the Bend class does work with Tweener. Well, now it does! :)
A demo and some documentation on that is coming soon.
June 21st, 2008 at 8:32 pm
hi Bartek,
I came across your blog/website a few weeks ago and I must say it is a real gem and tops on my rss list now.
a year ago I struggled with bending a plane with papervision (for a curling plane page flip effect I was after) but now with your excellent work now will this not only be much easier but bending any do3d has incredible possibilities.
thanks so much for your contributions.
Evan
June 23rd, 2008 at 12:32 am
Very nice to see it works now on any meshes.
Well done!
June 24th, 2008 at 12:04 am
[…] back on the PV3D ranch, a new modifier branch has started with this blog post and pretty cool demo - kudos to Bartek […]
June 24th, 2008 at 12:42 am
For the double sided 100 dollar bill did you just use 2 planes or did you find a different way to include a 2nd side? Or is that really just a very think cube? :)
Charlie
June 24th, 2008 at 5:06 am
[…] 使用方法 « 粒子系统实现的火焰效果 […]
June 24th, 2008 at 8:33 am
@charlie I used 2 planes, with a onesided material applied to each. The second plane is flipped 180 degrees. I found this solution on pv3d.org, but now I can’t find the link to that article.
July 14th, 2008 at 3:35 pm
[…] is what happens when you mouse over your cards (the closest hand). That is Bartek Drozdz’s bend modifier in action. I think it’s pretty eye-catching. […]
July 15th, 2008 at 11:33 pm
hey,
thats seriously awesome. i played with it and all was nice in the beginning, but now i’m not getting it to bend anymore for some strange reason. it rather looks like perspective transformation. any idea what the problem is there?
August 11th, 2008 at 9:41 pm
Great class, we have been working with it a lot lately, I have one question.
How can I get the coordinates of the end points? Can you share the formula that you are using so I can calculate them? Or can it be property that can be retrieved?
I tried looking through the source, but I didn’t quite understand the formulas being used.
Thanks
August 19th, 2008 at 5:17 pm
Thanks for sharing this. My quest to create 3D swimming fish just got saved :P