Skip to main content

Anchoring One Surface to Another in Maya 5

Submitted by wavescorx on
Forum

For the next part of my project I have to somehow limit or anchor one surface's movement to the surface of another. This is going to be hard to explain, but imagine a sort of vehicle manuevering through unlevel terrain. In my post I'll call the "vehicle" A and the "terrain" B.

So I'd like to be able to just grab the manipulator for A and where ever I move it,the thing will only move across the surface of B, and rotate accordingly so it always faces out the same way and never sinks into the surface of B. Sort of like a boat in choppy waters or bugs crawling all over a tree.

Both A and B are true sub-divided surfaces. A is also the base for blend shapes targets. I'm using Maya 5.0 on Mac OS X. I've never had to do anything like this before, so I apologize if it's elementary. Any thoughts on the best way to do this would be a huge help!

-Travis

Submitted by Aven on Thu, 05/02/04 - 12:21 AM Permalink

Well, this is always a fun one to do. Unfortunately there is no quick way you can do it. All ways will require a bit of effort. The way I would do it is by using the Curve Follow technique.

When you are making terrain, try to make the surface using NURBS. Unless you really need odd shaped terrian, NURBS will be a lot easier and quicker to work with. This tutorial has the terrain as a NURBS surface. If you want to use a polygon based surface, you will need to download the Bonus Tools 5 from www.alias.com They are needed so that you can detach a polyginal edge as a curve.

Let us begin.

1. Start by making a NURBS plane. Give it the dimensions and settings you want. Then using the Sculpt Surfaces Tool (Edit NURBS > Sculpt Surfaces Tool), start painting in your uneveness. Use Push, Pull and Flood Smooth to achieve this. Be fairly rough to give it a more natural feel.

[img]http://home.netspeed.com.au/mlanham/tutes/cf_01.jpg[/img]

2. Make your vehicle. I know that it will be hard to make a car that looks better than mine, but give it a try anyway :p Make sure that the vehicle's Pivot Point is at the bottom of it, otherwise the car will sink through the ground. The placement of the car isn't important at all. Just stick it wherever.

[img]http://home.netspeed.com.au/mlanham/tutes/cf_02.jpg[/img]

3. Now. Go into Component Mode and select one of the terrain's Isoparms. This will be path that the car will drive along. With the Isoparm selected, go to Edit Curves > Duplicate Surface Curves. This will make a duplicate that Isoparm as a Curve and attach it to the NURBS mesh. When you edit the NURBS mesh, the Curve will sick to that Isoparm exactly.

[img]http://home.netspeed.com.au/mlanham/tutes/cf_03.jpg[/img][img]http://ho…]

4. Select the Curve and the Shift+Select the car. Go to Animate > Motion Paths > Attach To Motion Path. If you go to the Option Box, you can change the start and end times for the movement. Otherwise it will just use the first and last frame of your current scene as reference. They can be changed later on as well. When you do this, the car should jump straight to the start of the curve. If the start of the curve is the wrong way around (ie, the car will be going the wrong way), then you just have to reverse the curve's direction. This is done by selecting the curve and going to Edit Curves > Reverse Curve Direction. The car should now flip around and go the right way.

[img]http://home.netspeed.com.au/mlanham/tutes/cf_06.jpg[/img]

5. Chances are that your car will not be facing the right direction, and it will be flipped all over the place. Ie, the front of the car will be facing down and the roof will be the front. Open up the Attribute Editor and select the Motion Path tab. Just play around with the Front Axis and Up Axis options. You may also need to check the Invert check boxes.

[img]http://home.netspeed.com.au/mlanham/tutes/cf_07.jpg[/img]

6. You now have a car that moves smoothly along a curve. There are a few things that can now be done to that animation to make it look a little better now.
. The curve doesn't have to straight, it can be crooked as you like. Just edit your NURBS surface and the curve will update (see pic below).
. The Timing for the Motion Path will be very smooth and even. You can change this so that the car will accelerate or slow down at different times. To do this, move the Time Slider to a frame in the animation. In the Channel Box, type in a value in the U Value Box, and key it (Right ClickHold on the box and select Key Selected).
. The car's base will be travelling parallel to the origin. If your terrain has bumps, then it will look odd and flat. You can go in and manually key the car so that it will roll correctly. Just make sure that the Rotate Tool's setting is on Local or Object and not world. This is where you will have to spend a bit of time to get it to look good.

[img]http://home.netspeed.com.au/mlanham/tutes/cf_08.jpg[/img]

I hope that this helps you out a little. It was writen up as soon as I saw your question, so if it is poorly written, just let me know. Good luck.

Sorry, I would have had this up sooner, but Sumea was wigging out on me.

Submitted by wavescorx on Fri, 06/02/04 - 6:32 PM Permalink

My God, Aven! You didn't have to go to so much trouble! That's going to be a huge help in one of two similar problems. In the other I was hoping to be able to move the "vehicle" (very nice car, by the way!), virtually anywhere over the terrain, not necessarily over a single curve on the surface...in fact, in this case (especially since this one HAS to be a sub-d terrain), I'm not even so sure I could get a curve on the surface to act as the path and still have the surface look the way I want it to. Any ideas on this one? Thanks again for the well instructed tutorial, Aven...it's much appreciated!

-Travis

Submitted by wavescorx on Fri, 06/02/04 - 6:42 PM Permalink

One more piece of info--in this case, the sub-d terrain is also attached to a skeleton, so it will move all around as well. The "vehicle" would be bound to the skeleton as well or maybe parented to the terrain. At any rate, I just wanted to add that in case it changes the way you would attack the problem.

Submitted by Aven on Fri, 06/02/04 - 10:04 PM Permalink

Sweet merciful crap, you're getting yourself in the deep end :p

I will actually need you to tell me what it is you need to do. Not similarities. That is if you are allowed to. Sketched would also help. By the sounds of it though, you want to try to make an insect crawl over someone's skin?

When you say 'all over the terrain', can it still be done using a singular spline? Is it only on object, or will there be multiple objects? If it is a singular object that can follow one continuous path, then a say keep with the Motion Path method. It can be modified as such.

1. Make your SubD surface. In my case I am just using a low poly cage, but you get the idea. Using the EP Curve Tool, create your path. I made a spiral just as an example. Select the Curve and then Shift+Select the SubD mesh.

[img]http://home.netspeed.com.au/mlanham/tutes/cw_01.jpg[/img]

2. Go to Deform > Create Wrap. Play around with the settings in the Channel Box. Keep in mind that the Max distance is in Maya Units.

3. Now when the mesh deforms, the curve will follow it.

WARNING!!! There is one major flaw with doing it this way. The way a Wrap deformer works, is by taking the transform values from a vert on the parent mesh, and feeding it through to the transform value of the closest vert(s) (or CVs in this case) on the child mesh. This is basically skinning with out using bones. The problem is that you do not have a lot of control over how the verts will control the CVs. No ability to paint weights (that I know of at least). This means that you will have to try to make the Curve have a CV near every vert that the curve will pass through. Otherwise when you deform the base mesh, the curve will not deform well. This will require a fair bit of planning and work to make sure that the curve is well made and follows the mesh properly.

[img]http://home.netspeed.com.au/mlanham/tutes/cw_02.jpg[/img]
I only used four CVs per rotation on the Curve, yet there are eight verts in each rotation on the mesh.

[img]http://home.netspeed.com.au/mlanham/tutes/cw_03.jpg[/img]
The CVs that are near the verts deform really well, but...

[img]http://home.netspeed.com.au/mlanham/tutes/cw_04.jpg[/img]
If you move a vert that has no CV near it, then it wont do anything. Just be careful of that.

You can now just go ahead and apply the Motion path as normal.

If the surface doesn't actually deform as such, and is only bound to a skeleton, you will be able to just parent the Curve straight to the Skeleton and be done with it. Parenting wont work if you have to have the curve go over a flexing joint though. If you require more than a couple of objects to be moving over the surface, you may want to have a look at Particle Flows. I have never really done much with Particles in Maya though, so I am not the person to ask.

Submitted by wavescorx on Tue, 10/02/04 - 5:50 PM Permalink

Thanks Aven! I tried out ALL your advice and I found out key framing it is absolutely the best method...I don't know why I was so afraid to just do that in the first place. I was just worried that my "vehicle" surface would sink into the "terrain," but it really doesn't. Furthermore, by keyframing, I get a more hand-crafted feel...it doesn't look as "impossibly smooth" as it does when you first set up on a curve (of course this can be adjusted later, but I get effect more quickly and with more flexibility by keyframing).

So thanks for all your help, it was very necessary in figuring out the right method for me. As always, I can't tell you how much I appreciate it. By the way, I had a buddy download Bonus Tools for me, I'll be installing it soon--thanks for the tip!

Submitted by Aven on Tue, 10/02/04 - 7:08 PM Permalink

That's the problem. All animation deformers are nice and quick and easy, but you don't have a lot of control. Keyframing gives you that. No easy fix-ups unfortunately :/

It is good to hear that you have found out a way to achieve what it is you wanted to do. If it works, then there is nothing wrong with it :) Good Luck.

I have to admit that I have NEVER used Bonus Tools. There is only one tool that I find to be really useful, and that is the Count Tris HUD Display. I will have ti install it for the current competition :)

Posted by wavescorx on
Forum

For the next part of my project I have to somehow limit or anchor one surface's movement to the surface of another. This is going to be hard to explain, but imagine a sort of vehicle manuevering through unlevel terrain. In my post I'll call the "vehicle" A and the "terrain" B.

So I'd like to be able to just grab the manipulator for A and where ever I move it,the thing will only move across the surface of B, and rotate accordingly so it always faces out the same way and never sinks into the surface of B. Sort of like a boat in choppy waters or bugs crawling all over a tree.

Both A and B are true sub-divided surfaces. A is also the base for blend shapes targets. I'm using Maya 5.0 on Mac OS X. I've never had to do anything like this before, so I apologize if it's elementary. Any thoughts on the best way to do this would be a huge help!

-Travis


Submitted by Aven on Thu, 05/02/04 - 12:21 AM Permalink

Well, this is always a fun one to do. Unfortunately there is no quick way you can do it. All ways will require a bit of effort. The way I would do it is by using the Curve Follow technique.

When you are making terrain, try to make the surface using NURBS. Unless you really need odd shaped terrian, NURBS will be a lot easier and quicker to work with. This tutorial has the terrain as a NURBS surface. If you want to use a polygon based surface, you will need to download the Bonus Tools 5 from www.alias.com They are needed so that you can detach a polyginal edge as a curve.

Let us begin.

1. Start by making a NURBS plane. Give it the dimensions and settings you want. Then using the Sculpt Surfaces Tool (Edit NURBS > Sculpt Surfaces Tool), start painting in your uneveness. Use Push, Pull and Flood Smooth to achieve this. Be fairly rough to give it a more natural feel.

[img]http://home.netspeed.com.au/mlanham/tutes/cf_01.jpg[/img]

2. Make your vehicle. I know that it will be hard to make a car that looks better than mine, but give it a try anyway :p Make sure that the vehicle's Pivot Point is at the bottom of it, otherwise the car will sink through the ground. The placement of the car isn't important at all. Just stick it wherever.

[img]http://home.netspeed.com.au/mlanham/tutes/cf_02.jpg[/img]

3. Now. Go into Component Mode and select one of the terrain's Isoparms. This will be path that the car will drive along. With the Isoparm selected, go to Edit Curves > Duplicate Surface Curves. This will make a duplicate that Isoparm as a Curve and attach it to the NURBS mesh. When you edit the NURBS mesh, the Curve will sick to that Isoparm exactly.

[img]http://home.netspeed.com.au/mlanham/tutes/cf_03.jpg[/img][img]http://ho…]

4. Select the Curve and the Shift+Select the car. Go to Animate > Motion Paths > Attach To Motion Path. If you go to the Option Box, you can change the start and end times for the movement. Otherwise it will just use the first and last frame of your current scene as reference. They can be changed later on as well. When you do this, the car should jump straight to the start of the curve. If the start of the curve is the wrong way around (ie, the car will be going the wrong way), then you just have to reverse the curve's direction. This is done by selecting the curve and going to Edit Curves > Reverse Curve Direction. The car should now flip around and go the right way.

[img]http://home.netspeed.com.au/mlanham/tutes/cf_06.jpg[/img]

5. Chances are that your car will not be facing the right direction, and it will be flipped all over the place. Ie, the front of the car will be facing down and the roof will be the front. Open up the Attribute Editor and select the Motion Path tab. Just play around with the Front Axis and Up Axis options. You may also need to check the Invert check boxes.

[img]http://home.netspeed.com.au/mlanham/tutes/cf_07.jpg[/img]

6. You now have a car that moves smoothly along a curve. There are a few things that can now be done to that animation to make it look a little better now.
. The curve doesn't have to straight, it can be crooked as you like. Just edit your NURBS surface and the curve will update (see pic below).
. The Timing for the Motion Path will be very smooth and even. You can change this so that the car will accelerate or slow down at different times. To do this, move the Time Slider to a frame in the animation. In the Channel Box, type in a value in the U Value Box, and key it (Right ClickHold on the box and select Key Selected).
. The car's base will be travelling parallel to the origin. If your terrain has bumps, then it will look odd and flat. You can go in and manually key the car so that it will roll correctly. Just make sure that the Rotate Tool's setting is on Local or Object and not world. This is where you will have to spend a bit of time to get it to look good.

[img]http://home.netspeed.com.au/mlanham/tutes/cf_08.jpg[/img]

I hope that this helps you out a little. It was writen up as soon as I saw your question, so if it is poorly written, just let me know. Good luck.

Sorry, I would have had this up sooner, but Sumea was wigging out on me.

Submitted by wavescorx on Fri, 06/02/04 - 6:32 PM Permalink

My God, Aven! You didn't have to go to so much trouble! That's going to be a huge help in one of two similar problems. In the other I was hoping to be able to move the "vehicle" (very nice car, by the way!), virtually anywhere over the terrain, not necessarily over a single curve on the surface...in fact, in this case (especially since this one HAS to be a sub-d terrain), I'm not even so sure I could get a curve on the surface to act as the path and still have the surface look the way I want it to. Any ideas on this one? Thanks again for the well instructed tutorial, Aven...it's much appreciated!

-Travis

Submitted by wavescorx on Fri, 06/02/04 - 6:42 PM Permalink

One more piece of info--in this case, the sub-d terrain is also attached to a skeleton, so it will move all around as well. The "vehicle" would be bound to the skeleton as well or maybe parented to the terrain. At any rate, I just wanted to add that in case it changes the way you would attack the problem.

Submitted by Aven on Fri, 06/02/04 - 10:04 PM Permalink

Sweet merciful crap, you're getting yourself in the deep end :p

I will actually need you to tell me what it is you need to do. Not similarities. That is if you are allowed to. Sketched would also help. By the sounds of it though, you want to try to make an insect crawl over someone's skin?

When you say 'all over the terrain', can it still be done using a singular spline? Is it only on object, or will there be multiple objects? If it is a singular object that can follow one continuous path, then a say keep with the Motion Path method. It can be modified as such.

1. Make your SubD surface. In my case I am just using a low poly cage, but you get the idea. Using the EP Curve Tool, create your path. I made a spiral just as an example. Select the Curve and then Shift+Select the SubD mesh.

[img]http://home.netspeed.com.au/mlanham/tutes/cw_01.jpg[/img]

2. Go to Deform > Create Wrap. Play around with the settings in the Channel Box. Keep in mind that the Max distance is in Maya Units.

3. Now when the mesh deforms, the curve will follow it.

WARNING!!! There is one major flaw with doing it this way. The way a Wrap deformer works, is by taking the transform values from a vert on the parent mesh, and feeding it through to the transform value of the closest vert(s) (or CVs in this case) on the child mesh. This is basically skinning with out using bones. The problem is that you do not have a lot of control over how the verts will control the CVs. No ability to paint weights (that I know of at least). This means that you will have to try to make the Curve have a CV near every vert that the curve will pass through. Otherwise when you deform the base mesh, the curve will not deform well. This will require a fair bit of planning and work to make sure that the curve is well made and follows the mesh properly.

[img]http://home.netspeed.com.au/mlanham/tutes/cw_02.jpg[/img]
I only used four CVs per rotation on the Curve, yet there are eight verts in each rotation on the mesh.

[img]http://home.netspeed.com.au/mlanham/tutes/cw_03.jpg[/img]
The CVs that are near the verts deform really well, but...

[img]http://home.netspeed.com.au/mlanham/tutes/cw_04.jpg[/img]
If you move a vert that has no CV near it, then it wont do anything. Just be careful of that.

You can now just go ahead and apply the Motion path as normal.

If the surface doesn't actually deform as such, and is only bound to a skeleton, you will be able to just parent the Curve straight to the Skeleton and be done with it. Parenting wont work if you have to have the curve go over a flexing joint though. If you require more than a couple of objects to be moving over the surface, you may want to have a look at Particle Flows. I have never really done much with Particles in Maya though, so I am not the person to ask.

Submitted by wavescorx on Tue, 10/02/04 - 5:50 PM Permalink

Thanks Aven! I tried out ALL your advice and I found out key framing it is absolutely the best method...I don't know why I was so afraid to just do that in the first place. I was just worried that my "vehicle" surface would sink into the "terrain," but it really doesn't. Furthermore, by keyframing, I get a more hand-crafted feel...it doesn't look as "impossibly smooth" as it does when you first set up on a curve (of course this can be adjusted later, but I get effect more quickly and with more flexibility by keyframing).

So thanks for all your help, it was very necessary in figuring out the right method for me. As always, I can't tell you how much I appreciate it. By the way, I had a buddy download Bonus Tools for me, I'll be installing it soon--thanks for the tip!

Submitted by Aven on Tue, 10/02/04 - 7:08 PM Permalink

That's the problem. All animation deformers are nice and quick and easy, but you don't have a lot of control. Keyframing gives you that. No easy fix-ups unfortunately :/

It is good to hear that you have found out a way to achieve what it is you wanted to do. If it works, then there is nothing wrong with it :) Good Luck.

I have to admit that I have NEVER used Bonus Tools. There is only one tool that I find to be really useful, and that is the Count Tris HUD Display. I will have ti install it for the current competition :)