3DS MAX: 3ds Max Forum 3ds Max Tutorials

Splines - Geometry

COW Forums : Autodesk 3ds Max

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
Yan Ligoth
Splines - Geometry
on Jul 13, 2009 at 4:50:28 pm

I'm modeling headphones, thus creating a spline for a cord, and a geometry for the earpiece. I need to connect the end of the cord to the earpiece. But so you can modify the spline as is (vertex...), and have the geometry always be attached. I've tried linking but that does not help when you change the spline.

Return to posts index

Tiago Ribeiro
Re: Splines - Geometry
on Jul 13, 2009 at 5:52:31 pm

Hi there,

i think you have two alternate approaches to that problem, so you should try both of them in order to choose.

first, you could try applying a SplineSelect modifier to the spline, in order to access your spline vertexes from world-level. this means you can select an individual vertex in the spline, and link it to any other object in the scene (in this case, the earpiece), or even paremeter-wire it somehow.

the second approach, which i think you will appreciate more, is to apply the Spline IK Control to the chord spline.
once you do this, you can click "create helpers" in the modifier paremeters, so you will have a dummy created and linked at each of the vertexes, so if you control any dummy, you will control it's associated vertex.
I think you will find this an elegant solution, as it turns your spline into a hierarchially controlled system, with one tip of your chord becoming the father of the hierarchy. so you just have to link this fathers' dummy to your earpiece, and then you can modify your spline by simply moving or animating any other dummy, without even having to access the splines' sub-primitives (vertexes, segments..)

if i explained myself correctly, and you got it right, you should understand that both of the approaches are simply alternatives to having your sub-primitives controlled at world-level, on world coordinates, and with access to the other scene objects, so you can link them, wire them, or do whatever you would do with any other object.
so basically, if you want to work with splines, these two modifiers are worth checking out =)

Return to posts index

Yan Ligoth
Re: Splines - Geometry
on Jul 14, 2009 at 5:41:07 pm

Nice, the one with helpers is very great! Though I didn't understood the first, but the second one was amazing!

I've got another question here, can you set some kind of length to the cord? So if you move the vertex up, it will at some point drag the rest of linking with it, instead of having unlimited length?

Return to posts index

Tiago Ribeiro
Re: Splines - Geometry
on Jul 14, 2009 at 10:11:07 pm

once again, i'll give you two different approaches, you'll have to try them both to decide, although i think i can guess which one you are going to choose..

i don't know if theese are the best way, because i have never done that, so both theese techniques do not apply specifically on doing what you ask, although what you ask is a "side effect" of using them =)

i propose you apply an inverse kinematic solver to your spline system, because it guarantees that your spline maintains it's length..
inverse kinematics are especially used to animate articulated joints and some hierarchial systems, such as your spline with its Spline IK Control (IK stands for inverse kinematics)
as for general inverse kinematics, i suggest you search about it on the web to gen a basic understanding of what it does, because it's a really really usefull technique for animation
the first tip i give you is to regularly make backups of your scene when working with IKs, because you can easy bust things out and kind of blow things into pieces =) so first of all, do your experiments copys of your work, before you spoil the parts that were working ok, and that gave you hours and hours of hair-rubbing...

on to the solution, first you should give a try on a history-dependent solver, which you can find in the Animation menu -> IK Solvers -> HD Solver
to apply it, first select the parent helper on your system, go on to that menu i just told you about, and after clicking "HD Solver" you will see a dashed line streching from your selected helper to the mouse point.
go on to the helper that is at the opposite tip of the spline, and select it.
you have created a hd ik solver containing all the helpers between the first one you selected (the parent node) and the last one (the leaf node)
you can see that the dummys have metamorphed into bone-like helpers, and if you select and move them, you will understand the effect.
moving the tip helpers keeps your spline with its initial length as you will see, although this approach is somewhat more advanced than the second one i'm going to tell you about.
it you move the helpers located through the middle of the spline you will find that they do not exactly maintain the length of the cord, although they seem usefull if you want to animate a stretchy look.

after you play around a bit with this, i suggest you try another approach, using history-independent IK
do exactly the same thing, but this time, choose "HI Solver" from the IK solvers menu.
you have created a simple history-independent ik solver. this solver is much more simpler than the other, but in order to get an optimally working system, you still have some work to do.
anyway you can try it out, just like you tried with the HD solver, so you can move any helper, and realize that moving the helpers on both ends of the spline, the cord length keeps the same. but the movement is all somewhat contrained..and if you move the helpers in the middle of the cord, it stretches.

there is a long way to go into understanding inverse kinematic systems, and each one build up its own techniques, basically out of all guides and tutorials one reads.

first, i advise you to start a new, clean scene with only the basic material for understanding this IK setup. only after that you should replicate this setup in your own scene.

so i'll give you my basic outline:
1 - create a spline with 4 vertices. apply the spline ik control modifier, and create the helpers. when you create the spline, i will assume vertex/node number 1 to be the first, number 2 the second, etc..
2 - create a HI ik solver for each pair of dummys, starting at the parent. this means that if you have 4 dummys, start creating a solver between 1 and 2, then between 2 and 3, and then between 3 and 4. when you'r done, you will have the 3 ik solver goals (those blue "plus"-shaped things), for dummys 2, 3 and 4.
3 - create a new dummy on each of thesse ik goals, making them bigger than the spline-control dummys. to create a dummy, use the create toolbar on the right, navigate to the tab "helpers", and find the button labeled "Dummy"
4 - align each dummy with its correspondent ik goal. select a dummy, click alt+a, and select its corresponding IK goal. a dialog will, pop up, be sure to select all X,Y,Z checkboxes for both position and orientation.
5 - link each IK goal to its corresponding dummy. after this you can control the ik chain using these big dummys, instead of directly using the ik goals, like if you had encapsulated the iks inside these bigger dummys. but the real reasong for going into all this trouble is on step 6.
6 - this is the tricky part. start by linking the big dummy on ik goal number 4 (the leaf node), with the ik goal number 3. this is, starting on the tip of the ik chain, link each big dummy with the ik goal that's on the node before it. i hope you get the idea.. do you need a visual representation?

try it out..
if you manage to do it, you will try moving theese dummys, and will immediatly feel the power of an ik system =) if you move any dummy, it's childs will follow, and the cord will keep it's original length.
be aware that using ik solvers without proper contrainment (angle limitators and stuff like that) can cause some wierd behaviour, so carefully plan the movement of your cord in order not to see if bend in the opposite direction for 2 or 3 frame, and then instantly going back to it's position. play around and you'll see what i'm talking about, and i guess you'll also figure out how to work things around.
if you get lost, try again from scrap, and if you really get to the point where you just don't know what you're doing, just tell me where you got stuck =)

good luck.
and welcome to the world of IK =)

Return to posts index

Yan Ligoth
Re: Splines - Geometry
on Jul 15, 2009 at 2:00:58 pm

Hah! Nice, looks finny in some way, but it's working.
Now a little bit more on that, just because I'm now so interested in that )) Can you change how much the movement of those big dummy's effects the whole chain? Like if you moving the dummy a 10 in z, the whole spline will change a little, can you specify how dramatically the change would be? How much it will change the spline? You know like if I want to make the spline a "some-what" a straight line I'll have to move the dummy miles away.

And about the whole system, can you make it more cord-like looking? Because when you skip the step 6, it's like where the vertexes are - in real life those places are glowed to the table. But when you link them (do step 6), the whole cord becomes a stick until you go way over it's limit. Because they're parented they move at the same time. I want it to be more real (both of the above). So when you move up one dummy, nothing goes with it until it goes too far and that's where the deformation begins. Basically place a cord on the table take it in the middle and drag it up. This is how it should look.

Thanks for so much reply ))

Return to posts index

Tiago Ribeiro
Re: Splines - Geometry
on Jul 15, 2009 at 3:10:04 pm

i think the approaches i explained do not contemplate what you now ask, about controlling the weight of each ik node.. ik are not really supposed to be used for cords, although it can be possible, depending on what you wish to atchieve.
i didn't understand that you wished to pick the cord in the middle and lift it from the table, my fault, because i have a cartoonish point of view, so i was imagining the cord being animated as if it were alive =) in that case i think ik would do the job. in your case i think you should be looking at physical rope simulations, you can use reactor for that, i think it's quite simple, i've used it some time ago, basically check out the tutorials/help included in 3dsmax about reactor rope..
if you have never used reactor be sure to play around with it for a while, understand the concepts of rigid bodies, as for your case, you will need rigid bodies and rope.
after you understand how those things work, the guideline i can give you is:

both the earpiece and the jack plug will be ridig bodies. as i guess you plan to keyframe their animation, you should set both as unyielding in reactor properties rollout.
both will be added to a rigid body collection (RB Collection), as you will soon find out.
you will apply the reactor rope modifier to your spline, and add it to a rope collection (RP Collection)
then you will use the constrains in the modifier rollout to attach the spline's vertexes in each point to the corresponding rigid body (one to the earpiece, the other to the jack plug)
if you plan to use some kind of mesh as a hand or finger pushing the cord up, this mesh will also have to be an unyielding rigid body, in order to interact with the rope. if the mesh is animated, it should be a deformable mesh.
after that you can keyframe-animate the hand, and as is passes through the cord, it will interact, pulling it up, or to wherever you push the hand.
note that you should use reactor preview window to preview the results, and then you have a "create animation" button to "bake" the animation on to your objects, only then will you see the results applied in your viewports and renders.

you should go all over the basic reactor tutorials until you understand all i just told you =) those tutorials will explain it much better than me, and to be honest, i don't think it would make much sense to be explaining it to you, as it is all already documented. that stuff about IK is not exactly documented, so of course, i wrote it down for you.

good luck on that. reactor can get kind of fun, and at the same time, kind of frustrating (sometimes the objects don't collide, the rope breaks, or gets all twisted around, those kind of physical simulation problems =) so be sure to give it enough time, so you'll find out that you should be blaming yourself for the problems, and not the software =)

Return to posts index

Yan Ligoth
Re: Splines - Geometry
on Jul 15, 2009 at 4:11:25 pm

Ok well thank you so much, don't think I need to go so complex in something I don't know for this project. But maybe in the future I'll learn it.

Thanks, Yan

Return to posts index

Tiago Ribeiro
Re: Splines - Geometry
on Jul 15, 2009 at 7:49:29 pm

ok, no problem, and of course, you'r right in not getting yourself lost in something you don't need
if you keep the ik setup for this, then just try setting things up more accordingly to what you need
remember that the linking was what caused some dummys to move along with others, so if you see that there are links you deslike, unlink them.
the advantage of the links was basically to keep the length of the cord, but if you want a more manual control, you can tweak up what i told you, and just carefully assure yourself you don't let the cord get to big

good luck on your work,

Return to posts index

Yan Ligoth
Re: Splines - Geometry
on Jul 16, 2009 at 10:21:42 am

I actually ended up using the IK control all alone, and manually used dummies as vertexes to animate the shape. 'Couse basically all I needed is to have that headset flow in the air, and it was for commercial and you kinda see the headset for a second, so can't really see any problem with length.

Thanks for support,

Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2018 CreativeCOW.net All Rights Reserved