Is there a way for "real" spline IK?

   7638   8   0
User Avatar
Member
249 posts
Joined:
Offline
Ok

So ui have asked this on odforce already, sorry.

But with 3 replys and over 250 views i havent had any help. (plus i waited, almost 2 weeks).

So the question is it possible to have real Spline IK. A combination of Spline control and IK control.

I don't mean “Follow Curve” because that does exactly as the name describes. I would like something like follow curve with an IK handle at the end so i can move the goal which will bend the curve and then i can adjust the actual curve, with persistent handles or whatever control i want.

It sounds like im going to have to build something that will generate this effect but i know it would be extremely useful. If im not mistaken this is how the spline IK works in Maya.

All thoughts are welcomed. thank you for listening and helping out.


-andrew

with the file.

The visibility is turned off on one anim ctrl. This determines the slack of the spline IK and direction (sorry dont know the right terms here).

Someone must have a better solution.

oh and sorry about the crappy stretch and scale of the scene. I kinda threw this together as quick as possible.

plus there is a little animation on it, to show how it easy it is (its also very easy to break)

Attachments:
splineIK_hack.hipnc (248.3 KB)

blog [abvfx.wordpress.com]tumblr [andrewbrowne.tumblr.com]twitter [twitter.com]
User Avatar
Member
1145 posts
Joined: July 2005
Offline
I took your approach and rebuilt it a bit differently and added the IK to the bone chain.

I used the Path object and placed 3 pathcv's which gives me a curve.

Then I used the BoneFromCurve shelf tool and set it to give me 4 bones.

I then went into the Kin chop and changed the solution to IK and assigned the last pathcv to be the End Affector and the middle pathcv to be the Twist.

I plugged your “arclen” expression where it should be in the first bone and did a relative reference in the remaining bones.

If you wanted more control over the middle of the curve I suppose you could add more pathcv's and a Blend object, and reference the Blend as the Twist Affector.

Attachments:
ik_to_spline.hip (122.7 KB)

“gravity is not a force, it is a boundary layer”
“everything is coincident”
“Love; the state of suspended anticipation.”
User Avatar
Member
249 posts
Joined:
Offline
hey there pete.

Looks like a working solution. I'm sorry i haven't replied in the last few days (new year and all that ). But i have been playing with it and working out what i can do with it, (your explanation made it easier to understand what exactly is going on) and i will post a mock up setup of what i have so far soon.

Thanks again mate.
blog [abvfx.wordpress.com]tumblr [andrewbrowne.tumblr.com]twitter [twitter.com]
User Avatar
Member
249 posts
Joined:
Offline
ok

Thank again for the file pete.

I have chosen to use the follow curve setup, but im sure i will use your approach for other various setups.

So here is another file with a problem.

It should be a simple solution but we know that isnt always the case.

Ok.

The two half spheres control the bridge in the middle. Translating, fine. Although i havent yet built in the stretch it looks like it would work perfectly.

The spheres parent a single bone (the link is hidden).

Using the single bones at both ends i have captured the curve to them. One after the other.

The problem is the first time i capture the bone to the curve, everything works fine. I can translate and rotate the control spheres and the curve responds as i expected and hoped.

when i perform this procedure again, the translation works fine but when i rotate the control object the curve doesnt do anything.

And when i rotate im talking about rotating the controls so it bends the curve. I havent moved onto twisting just yet.

So if anyone can help, this is a problem with a solution (hopefully). It sounds like a capturing problem but im not sure.

Attachments:
FollowCurve_Test.hipnc (196.3 KB)

blog [abvfx.wordpress.com]tumblr [andrewbrowne.tumblr.com]twitter [twitter.com]
User Avatar
Staff
1450 posts
Joined: July 2005
Offline
It looks like you are applying a curve kinematic solver to the bones, and, in addition, also capture the curve with the bones.

So, the curve tries to be deformed by the bones, but the bones will always follow the curve. Because the bones use curve kinematic solver, their rotation does not have any effect since it is overridden by the CHOP. And since the bones always lie on the curve, the curve is deformed to its original position.

You should not be capturing the curve with the bones. The idea is to animate the curve yourself, and have the bones follow it. Then, you use the bones to capture some other geometry (eg, a snake skin) that will be deformed according to the curve animation.
User Avatar
Member
249 posts
Joined:
Offline
Why cant i capture the curve with the bones? Its the critical part of the setup (for me).

Im using two single bones at the top and bottom to control the weight of the curve. And the curve, controls the bone chain underneath it.

The single bones are parented under the control object and those are the ones that are animated.

They both work for translation, and the base one works in rotation. I just don't understand why the top one doesn't rotate.

I don't know any other way to have an object at the top and bottom of the curve to equally control it. You can only capture geometry with bones and if rotation shouldn't work, then why does it on the base?

And its not just the base, it works with the bone you bind to the curve first, the second one, translations are taking into account but not rotation.
blog [abvfx.wordpress.com]tumblr [andrewbrowne.tumblr.com]twitter [twitter.com]
User Avatar
Staff
1450 posts
Joined: July 2005
Offline
Sorry, I did not notice the two hidden bones top and bottom in the viewport. In that case, then, indeed you can capture the curve with these two bones (top/bottom) and have the other bones follow the curve.

The reason why the top bone's rotation does not bend the curve is that the middle control point of the curve is not captured by the top bone. The top bone only captures one end point of the curve.

To verify this, if you right-click on the curve_object1_capture SOP node, and choose “Spreadsheet…”, you will notice that point #1 has no capture region associated with the top bone.

To fix that I just edited (TAB > Edit Capture Region) the capture region of the top bone to encompass the middle control vertex of the curve, and then the top bone's rotation started affecting the curve's shape. The amount of influence of the top bone on the middle control vertex depends how “deep” within the capture region the vertex is, and of course on the blend factor on the Capture node.
User Avatar
Member
249 posts
Joined:
Offline
Thought it was the way i was capturing it.

And i forgot about the spreadsheet. Cheers mate.

I figured out how to get it to work before i seen your post. The method i used was to resample the curve so there were 4 cv's and not 3. hehe.
It makes sense it worked, the two cv's in the middle were pushed towards the capture region.

I attached the file for you and everyone else to check out (it has some nice geometry and stretch applied (the squash looked a little weird), imagine if a characters back was rigged like this ).

But i will implement your method, since it is really the proper way.

There is only one more problem lol.

I cant figure out how to twist the damn thing. I thought the capturing would take care of that but i have no idea now how to achieve it.

Thanks again for all your help.


-andrew

Attachments:
FollowCurve_Working.hipnc (257.5 KB)

blog [abvfx.wordpress.com]tumblr [andrewbrowne.tumblr.com]twitter [twitter.com]
User Avatar
Staff
1450 posts
Joined: July 2005
Offline
If I remember correctly, if you add a normal attribute to the curve, the Curve IK Solver CHOP will align the bone's y-axis with the normal of the curve. So try playing with the curve's N attribute.

Also, if you use “twist” attribute (which is an angle measure) you may get twists of more than 180 degrees. But, I think it is a bit tricky to set that up manually. You can play with the Path tool in the viewport at the object level, which sets the “twist” and “twist_rest_position” (or whatever it is called) attribute automatically:
- TAB > Path and click twice in the viewport to create two Path CV objects
- TAB > Bones From Curve to create bones; select “Follow Curve” in the viewport's top toolbar to add IK
- in the network pane, press ‘t’ to view list mode, and turn on the gnomon flag to see each bone's coordinate system
- now, select one of the CVs in the viewport and twist it. The bones will twist too.
Now you can inspect the Path CV network to see how the twist attributes have been set up (then the curve inherits them).

But, if you don't need the twist above 180, then adding simple normals to your curve should do.
  • Quick Links