PDA

View Full Version : Path Deform = the theory behind it!


loocas
09-22-2006, 08:26 PM
Hi there dudes, I've written a new tutorial on Path Deform and the theory behind it in czech in a local Max forum and I took some time to fully translate it and publis it here, I hope you'll like ;)Oks, here comes...

I've written this short mini-tutorial regarding Path Deform modifier with which a lot of people have troubles working. How to work with it? How does it work in general? Why does it do what it does? You'll read about these issues below. I'll add, that everything here is shown on Max 8, however since Path Deform hasn't evolved much since it was introduced to Max, you can very easily apply this method to any version of Max. Besides, try to read between the lines, this tutorial ISN'T about Path Deform as is, but instead should show you how Max works internally in general and therefor you will be able to apply this knowledge to any kind of a similar problem you might ever face inside Max. Btw: don't ask for a different version that Max 8 of the file I'll provide you with, as I won't be doing it.

Right, so, Path Deform (hereafter PD for short, I'm lazy typing it over and over again :) ), how does it work? PD is tightly related to internal, local, orientation of objects it works with, the modified one and the path it's gonna deform the object along. As already said, it's interconected with the local orientation of objects, but in two ways actually, the first) on an object-to-object basis and the second) objects oriented in a scene.

-------------------------------------------------------------------------------------------------------------------------------

Fig.01: Here you see a scene I prepared specially for this demonstration. In the begining I'll note that even thou it certainly doesn't look like it, it's not a simple scenario for the PD modifier, you definitely have to solve above mentioned orientational problems, further more the spline is enclosed and even worse, the modified object was created in the TOP view but the path curve was created in the FRONT view, which really is a normal case in general practice, therefore it'll suite even better for this tutorial.

http://tutorials.duber.cz/path_deform/path_deform_tut_01.png

-------------------------------------------------------------------------------------------------------------------------------

Fig.02: The first thing you have to take into consideration while manipulating with any kind of a shape in Max is that a spline in 3d space has to have a begining and an end somewhere. In Max this is solved through Knots (which is just a specified name for spline vertices). The one and only knot displayed with a little rectangle, as opposed to an asterisk, is a knot number one, the one where it all begins and ends and if you take a look at you modify window in the modifier panel you'll see under the selection rollout its number, which is always "1".

What's in it for us? Well, since PD (respectively any kind of a modifier working with splines) will take such a knot as the first and default one and it will alwyas try to orient that to the modified object's pivot! That's why it's important to undertake certain actions especially in this case where the pivot of the modified object is offset to the first knot, well, it will most certainly apply to most situations you'll face while parametrical deforming, but most importantly it's very important that you'll realize such a rule so that whenever you'll come to doing such things with splines in the future you'll be able to recognize this issue and quickly resolve it before you take any further actions.

http://tutorials.duber.cz/path_deform/path_deform_tut_02.png

-------------------------------------------------------------------------------------------------------------------------------

Fig.03: On the picture below you can see that I've refined my shape using the REFINE in the Editable Spline with an additional introduction of another knot to the shape. Further more, I've aligned the knot's position to the modified object's pivot position, which is where I want all the deformation to begin. It was aligned along the X axis since I was working from the FRONT view, but you'll have to always apply this to your case anyways.

http://tutorials.duber.cz/path_deform/path_deform_tut_03.png

-------------------------------------------------------------------------------------------------------------------------------

Fig.04: Now it is time to reorient the spline. It's important that you'll have to change the knots' id's so that the one I've created is the very first one in the shape, due to the fact that the first knot will have to be aligned to the modified object's pivot for further manipulation. There's a function for this in Editable Spline called MAKE FIRST, but I'll show you some other ways to do that just in case and also because I promised some more than just a PD tutorial ;) I'll use a few MAXScript's functions for such a thing. Take a look at the following screen:

http://tutorials.duber.cz/path_deform/path_deform_tut_04.png

Simply, select the knot you want to be the first in the spline, take a look at the selection statistics in Editable Spline's Selection rollout so that you can read the currently selected knot's ID and also it'll display on which shape it lays, then open up the MAXScript Listener (F11) and type in the following two clausules:

setFirstKnot $ 1 2
upadateShape $

Will explain:

setFirstKnot - a function that will set the selected knot the first in the shape
there are three parameters, ($) line, (1) spline and (2) index of the know you wish to set as first
updateShape - a function that will instantly update the shape in the viewports, it's
not needed, but it's better for immediate visual feedback, since without this you'd have to touch the spline in some way in order to redraw it int the viewport.

-------------------------------------------------------------------------------------------------------------------------------

Fig.05: So, then comes the alignment of the first knot of the spline (along with the spline withoud deforming it in any way) to the modified object's pivot. I've chosen a more figurative way through an additional point helper, however save some time and use snapping directly without such stuff. I've created an additional helper and aligned it to where the object's pivot is, then I turned on snapping and used VERTEX and PIVOT modes for it. Then it's just a matter of simply grabbing the spline by it's first knot (you can use Show Vertex Ticks under the Display panel or a MAXScript command $.vertexTicks = true) to better see where the knot is.

http://tutorials.duber.cz/path_deform/path_deform_tut_05.png

-------------------------------------------------------------------------------------------------------------------------------

Fig.06: Oks, move the spline over onto the pivot.

http://tutorials.duber.cz/path_deform/path_deform_tut_06.png

loocas
09-22-2006, 08:27 PM
Fig.07: As a side note, which is related to PD, but only scratches the surface. How to find out how many copies will be needed in order for the object to wrap completely around the shape, preferrably without any holes? Easy, without any trial&errors, we will use much smarter way. In MAXscript Listener type in the following code: curveLength $, I don't think I have to explain what the $ sign represents. However, it's a tutorial, so for those of you who aren't familiar with MAXScript literals, it stands for a current selection (either as a single object or as an array of objects), I use it so that I don't have to type in the full name of the object I wanna access in MAXScript all over and over again. Oks, the command will output, in my case, a value of "414.35" generic units.

http://tutorials.duber.cz/path_deform/path_deform_tut_07.png

-------------------------------------------------------------------------------------------------------------------------------

Fig.08: All it's needed to be done now is to take some measurements of the object I'll be copying for PD.


http://tutorials.duber.cz/path_deform/path_deform_tut_08.png

Also, very primitive math will tell me how many of the copies I'll have to make, so after I mirror this little bit on the pictures above, I'll only need another eight copies. One side note, due to how modifier instancing works in Max, it is more suitable in this case to make copies of the object, not instances, so that you can attach all the copies to the original object.

-------------------------------------------------------------------------------------------------------------------------------

Fig.09: I don't think I have to comment on copying...

http://tutorials.duber.cz/path_deform/path_deform_tut_09.png

-------------------------------------------------------------------------------------------------------------------------------

Fig.10: Here comes the alignment of the local orientation of the spline to the object I wanna modyfy using PD. Notice that both of the objects have completely different local orientation

http://tutorials.duber.cz/path_deform/path_deform_tut_10.png

-------------------------------------------------------------------------------------------------------------------------------

Fig.11: Well, there's nothing easier that aligning only the orientation of the spline to the geometry's orientation.

http://tutorials.duber.cz/path_deform/path_deform_tut_11.png

-------------------------------------------------------------------------------------------------------------------------------

Fig.12: What do we do with the spline now, since it's correctly aligned to the object, we can just start rotating it around since that'd result in messing the alignment once again. Well, since sub-object's orientation doesn't affect the actual object's orientation, you'll switch to the spline sub-object, select the whole spline and rotate it till it's correctly aligned with the way I want to deform the object.

http://tutorials.duber.cz/path_deform/path_deform_tut_12.png

loocas
09-22-2006, 08:28 PM
Fig.13: Then, it comes to the most important modification, you have to run a Reset XForm utility on the spline, so that it will, sorta, bake all the orientation info onto the object itself.

http://tutorials.duber.cz/path_deform/path_deform_tut_13.png

-------------------------------------------------------------------------------------------------------------------------------

Fig.14: Now we're getting somewhere! You can see on the image below that both of the objects have exactly the same local orientation to each other.

http://tutorials.duber.cz/path_deform/path_deform_tut_14.png

-------------------------------------------------------------------------------------------------------------------------------

Fig.15: Now it's time to apply the Path Deform modyfier on the object you wanna deform and choose the right orientation axis, in my case it was the X axis. I think there's nothing else to talk about here:

http://tutorials.duber.cz/path_deform/path_deform_tut_15.png

-------------------------------------------------------------------------------------------------------------------------------

Fig.16: Notes:

notice that there's a little bit of stretching to the modified object, it's due to the fact that after dividing the spline length by the object's length I didn't get an integer number, but instead a float that results in a little hole between the beginnig of the object and the end (after deforming it), so I had to stretch it a little in order the both ends to meet by approx. 0.05 precent.

I was able to approach this issue procedurally, so that I could prepare the final result for sub-ding and rendering without actually collapsing the whole stack, so that I can later access certain parts of the whole process and tweak if I needed to.

http://tutorials.duber.cz/path_deform/path_deform_tut_16.png

-------------------------------------------------------------------------------------------------------------------------------

Max 8 Scene | 390KB (http://tutorials.duber.cz/path_deform/path_deform_tut_Max8_001.max)

Oks, that's all folks for today... :thumbsup:

Questions, comments, cirts, whatever... here, in this thread.

I hope you've enjoyed this tut and when I have some spare time again and if there's enough demand for it, I'll do some more of these ;)

cheers...

cyfer
09-23-2006, 04:21 PM
loocas


could you please do that in a pdf format ?
i don't mean this one , but any next tut you do , you see alot of valuable information get lost
just because of the image hosting sites , or some problems with hosts , servers ... and stuff

making it as a pdf saves it for good

oh , i almost forgot ..... very good tut. , it adds to me alot .. thanks

OMS
09-24-2006, 12:13 PM
thanks alot man ,

really , it very nice , and as you tell us ,
not important to ask what the different between this and the version of max ,
but very nice if we know how it work , :thumbsup:

loocas
10-03-2006, 08:20 PM
Thanks guys, I'm glad you liked it ;)

cyfer: if I find some spare time, I might convert it to a PDF and host it on my site for later reference. Thanks for the tip ;)

M-TICO
10-23-2006, 06:19 PM
thanks bro .!!

loocas
10-23-2006, 09:44 PM
thanks bro .!!

No worries! :thumbsup:

CGTalk Moderation
10-23-2006, 09:44 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.