"Bend" modifier as vertex program..........

I’ve been playing around with the bend modifier in Max. I want to write a vertex program to take a plane (displaced already by some random amount) and wrap it into a cylinder. I cannot quite work out how to do this as my maths isn’t very good.

Picture explains all!

I don’t have the math for it, but what you’re looking for is found
under the topic of mesh deformation.

Three types of mesh deformations are taper, twist, and bend.
They share common properties, so you usually find them together

If you can find this paper, it would be an interesting read:

Nonlinear global deformations
Barr,Global and local deformations of solid primitives,
Computer Graphics 18(3), pp 21–30, (proc. SIGGRAPH’84)

If the cylinder is along the origin it’s simple. The displacement is the cylinder vertex position x,y (optionally normalized) times the height field for that vertex. If you don’t have a height field then displacement will be y - base height.

All in all it’s pretty simple, although I may not have sed the same axes you need, your diagram isn’t labeled.

Well, the way i’ve done it currently is to generate a cylinder mesh with the same dimensions as the notional plane - then moved the vertices along the vector towards the central axis of the cylinder by their displacement. This works but what I want to do is have all of my program reason about the space on the plane (which is easier than reasoning about the cylinder) and then just use a vertex program to wrap it into a cylinder. This is for an industrial imaging application.

Then my control can be either (1) a heightfield representation of the data or (2) a more realistic representation of the object we are imaging, which has cylindrical geometry.

Anyway, thanks for the replies.


You said you are using Max? Just install the SDK. The code for most of the modifiers is in the SDK. Just open up the bend project and see what max does.


Ahh. Of course - I didn’t realise all of the source code for the current modifiers was included with the sdk!

Thanks for the tip.