View Full Version : Twist along a tube ?
pooby
06-20-2008, 05:19 AM
I wonder if anyone can think of a way of doing this.
Imagine you have a hose pipe and you can freely move and rotate each end.
What I want is to have the TWIST of the pipe distributed correctly down the length of the pipe.
It needs to work even if the pipe goes into a loop or gets tangled. and it needs to work if you twist either end not just one.
kim aldis
06-20-2008, 09:30 AM
apply a twist op to a cylinder then deform the result along a curve?
or try this tool: http://kim-aldis.co.uk/drupal-6.1/TinyCurveExtrude
pooby
06-20-2008, 09:37 AM
Thanks Kim, but I meant for a rig that you can manipulate and animate, A bit like the way the 'spine' works in XSI, but for a long tube that can be moved about in any way you like.
kim aldis
06-20-2008, 11:10 AM
twisted tube on a curve would animate. What am I missing?
pooby
06-20-2008, 11:14 AM
Youre missing the ability to swivel either end of the tube and have it distribute the twist down the tube.
I dont just want a twisted tube that I can then animate, I want to be able to actually animate the twisting.
Imagine you have 2 people holding the ends of a hose pipe and one turns it one way and one the other to make the tube twist.. Thats what i want, but it needs to work even if the tube isn't straight and wherever the people are standing and in whatever direction.
ThE_JacO
06-20-2008, 12:54 PM
Long story made short: You need to rig it.
It's no different from a tentacle/snake rig.
If the curvature changes aren't excessive or distributed on too few points you can get away with nulls constrained to the curve and use the built-in tangency and upvectoring heuristics, and then rotate envelope deformers nulls parented under the constrained rig nulls (or use a roll on those if they are both rig and deformers).
Writing expressions to control the twist and the distribution progression is trivial even if you're on the absolute lowest end of the technical curve.
If things get trickier than that and the orientation isn't to your satisfaction custom sets of upvectors are the next step.
Next step again is a custom constraint that can upvector something positioned on a curve by another curve's closest point, but that can get a bit slow since, even if the sdk provides a reasonably fast one, closestPointOnCurve with nurbs exceeds integration costs (a minimization problem, so of indefinite order).
Last and most advanced solution is writing a deformer based on heuristics different from the ones provided in xsi for tangency and up-vectoring, which is what I ended up doing for a snake rig I had to build last year. Personally I wrote my own centripetal up-vectoring system for it and it turned out great, and we're talking an 8m long snake that was being handled by hands and wrapping around arms and legs, but I don't know if you have the time and/or resources for that.
pooby
06-20-2008, 01:08 PM
I've been playing with nulls constrained to a curve, expressions and upvectors, but it ceases to work once the curve deviates too much from a straight line.
I can get one working as long as I have one end fixed, but once the two have free reign to rotate in any direction, it all goes to pot.
I had a suspicion the solution would involve a lot of custom stuff which I don't have the skills for.
oh well, never mind. worse things happen at sea, etc.
ThE_JacO
06-20-2008, 01:24 PM
up-vector every N nulls to a controller and animate those.
It can be time consuming to animate, but it's stable and it will do what you want.
The roll distribution itself is trivial to write as a set of expressions really, might only be a little time consuming if you write all the expressions manually. Automating it, the setup I mean, with a script would also be trivial, but out of reach if you're not comfortable scripting. If you have python installed I can probably write you something for that next week, no xsi at hand right now or I would put something together.
The issue at hand is with the nature of the problem itself.
While in human thinking terms this seems trivial to you (solving the tube), there are no heuristics (fancy word for guesswork) that will apply to every possible case of curve constraints (although xsi's could definitely be improved a bit in some regards).
Problems like creating transforms at arbitrary points of a moving curve that are stable and all often require to work in 4D (looking up time to figure out motion), while a generic toolset needs to be efficient in 3D (current frame) only.
I would still say you can definitely peg it if you want, involved custom deformers and all are only really needed and worth it if there's enough re-use, like having many shots for a creature or re-using the rig. For a one-off the thing can definitely be done manually.
Could you tell us in the specific what's the problem you need to solve and give it a bit of context?
Even just posting a quick animation on youtube of how the curve deforms and how many shots and of what quality you need would help a lot in pointing you in the right direction.
kim aldis
06-20-2008, 01:46 PM
the tinycurveextrude plugin handles twisting at inflection points better than deform along a curve or the builtin extrude does. It also allows you to transform (rotate) the profile you're extruding along the curve using function curves, which isn't quite the same thing but maybe it's a start? I've never tried to drive fcurve cps through ops at all, maybe it's possible, maybe not.
just chucking stuff into the mix.
It also has a much better segment distribution than the built in tools do, by the way.
pooby
06-20-2008, 01:47 PM
Well, Its for a creature that has long tentacly arms with a 'hand' at the end. But the arms need to be able to 'snake' about and around things.
I can recognise that this is a complex problem to solve, as in the middle of the curve, when its bent out of shape, it flips and you lose the point of reference for the expressions to make sense. In reality, a tube is held together by dynamic forces which cause the distribution of the twist whereas in CG we're just doing it with positions and rotations of items.
As you suggested, I guessed that for me having manual controllers would probably be the way to do it. I did make a manual test version that works fine.
I just was curious if someone had a relatively understandable way of making it work automatically.
Thanks for the scripting offer to speed up the setup. I'll have a crack at doing that myself, as I'm currently learning scripting and it might be a good test for me, but If I fail, maybe Ill call on you later.
Hmm... I wonder if there is a way of fudging it with cloth? Highly unlikely, but I might have a fiddle
pooby
06-20-2008, 01:49 PM
the tinycurveextrude plugin handles twisting at inflection points better than deform along a curve or the builtin extrude does. It also allows you to transform (rotate) the profile you're extruding along the curve using function curves, which isn't quite the same thing but maybe it's a start? I've never tried to drive fcurve cps through ops at all, maybe it's possible, maybe not.
just chucking stuff into the mix.
It also has a much better segment distribution than the built in tools do, by the way.
Oh ok.. I'll take a look at it and see what I can do with it.. thanks a lot both of you
kim aldis
06-20-2008, 03:01 PM
where extrusions are concerned the flipping has nothing to do with upvectors, it's at points of inflexion - points on the curve where the centre of curvature flops from one side of the curve to the other, where the proplem lies. If normal/binormal/tangent is calculated properly this won't happen. Unfortunately it's not always done properly
ThE_JacO
06-20-2008, 03:38 PM
if you use an envelope with constrained nulls for deformers up-vectoring will determine the transforms :)
kim aldis
06-20-2008, 05:06 PM
if you use an envelope with constrained nulls for deformers up-vectoring will determine the transforms :)
which is why I said where extrusions are concerned. (kissy, kissy)
ThE_JacO
06-21-2008, 05:07 AM
Apologies for that.
I only read one word every three or four of your posts first line usually, so to me that read:
"where concerned has to upvectors"
The rest I usually try to guess. It makes forum reading a lot more fun.
ximage
06-21-2008, 12:11 PM
Hey pooby
dont know if this would help, its a stretchy spine set up from Charbel Koueik does in his riggin pro DVD.
in the scene it looks a bit wierd maybe because there are only like 7 deformers or what ever. but take a look break it down.
in basics the curve drives the bones, which drive the cubes which take the rotation influence from the controls at either end, so a fal off from one to the other.
hope it can help.
ximage
vBulletin® v3.7.0, Copyright ©2000-2008, Jelsoft Enterprises Ltd.