Search - User list
Full Version: Limiting arbitrtary range for a channell using expression?
Root » Technical Discussion » Limiting arbitrtary range for a channell using expression?
What is a good way to arbitrarily limit a numerical range for a channell.
For example I set up a Transform Axis SOP. In that SOP is a rotation channell. Its path is /obj/Body/Left_Jaw/rot. It has a persistent handle.
What I would like is to be able to freely drag that handle but at same time for Houdini to limit its range to 0-60 degree (0- -60 for Right_Jaw). Kind of like bone joint limits where the rotation stops after limits are reached. The intention is so that another person would be constrained to my imposed limits, and so I don't have to worry about overdragging.

What would the syntax of the expression be in the channell?
Thank you
David Rindner
Like anything in Houdini there are a number of ways you can do this.

First you can try adding this expression to the channel you want to limit.

clamp(cubic(), 0,60)

It does what you want but most likely you won't like how it does it. Visually it does what you want but if you look at the channels procduces you might see some problems.

A better way to do this is use to objects. Make one channel/handle persitent, keep it free and in your jaw roation xform use a fit expression to drive the animation.

fit(ch("/obj/Jaw_Handle/rz), 0, 180, 0, 60)

Basically all the rotations in the handle will be inside the domain you need them to be.

If you used an actual bone to do the rotations you could use the rotational limits there as well.

Hope that helps somewhat.

FYI, you can use the textport to find all the expressions you can use. typing exhelp in the textport will show you the expression based hscript functions. you get a different return from a straight help.

The textport is your friend.

Good Luck.
Thank you.

Clamp expression works great and does exactly what I need it to do.
I thought that with cubic() option it would ease the value during dragging, but its of no consequence. I see no problem in the F-curves of a channell with clamp expression. But I kept the curve with in range. I would imagine that if the f-curve exceeds the range it would be truncated or clipped with sharp breaks at offending regions.
Houdini is marvelous. What a great app.

Dave Rindner
Yes, if the values are within your limits the resulting channel is fine. It's when it is more or less when you have channel problems. It can be more of a headache when setting up something for mass consumption in the shop. Most animators hate limits/clamps. The next best thing is to set another expression to change the colour of the handle or mesh in question to alert them they have done something wrong.

Just some more info.

I guess its a matter of established procedures in a shop. I don't see anything wrong with either approach. IMHO, there are certain items that have natural range of motion. Eyelids for example. The range of motion for an eyelid, in a realistic creature, ranges from open (i.e. folded) position to closed (unfolded) position. In BlendSOP that range is between 0 and 1. If an animator sets the values outside of this gamut then geometry begins to self intersect and looks wrong, departing from intended design of the creature. In Centaur creature the clamshell mouth open/close actions are accomplished with cluster animation. That is Transform Axis SOP (persistent) is controlling the opening of left and right clamshells. Without clamps, the dragging can result in jaw clusters being rotated into the head or overrotated. I know that with Wacom, if stylus goes off the screen, Houdini puts in huge value, like 543334. As modeling TD, I don't want the animator to concern themselves with trivial issues. So for eyelid motion I wish to clamp the motion between 0 and 1. I figure it this way, speaking from modeling TD's point of view. I want to deliver the rigged model to the animator with motion ranges clamped, so an animator unfamiliar with the model rig cannot make a mistake. As he/she gains profficiency with the model within context of the shop, the clamps can be relaxed or removed. My intention, of course, is to make the animation proccess as easy for animator as I can. IMHO one of the best ways to do that is to provide a rig+geomtry that has simple, clear, and accessible controls, that help the animator by constraining input to nice numbers. I think you know what I mean.

Dave Rindner
Oh, I know what you mean. One of the wonderfull things about Houdini is how you can hide some ugly values/parameters and present the animator with clean channels to animate. The addition of scripted subnets is a big effort in this effort. Custom Panels never really did what we wanted out of them. As a result in earlier versions of Houdini opted to write dummy VexSOPs to handle/store channels to make an animator's life eaiser.

This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Powered by DjangoBB