Setting
up a Simple Control Panel: Houdini Tutorial
Tutorial
for Softimage -- Tutorial
for Houdini
Animating
Smoothly beteen Automatic and Manual
Hints
and Tips
This tutorial
will show you how to set up a simple control panel using expressions. You
can take these ideas and modify them for your particular character. I
welcome any suggestions or comments on this tutorial.
Updated August, 1998.
-
If you are using Houdini
2.5 or up, make sure that 'Keep Position when parenting' option under
the options menu is not checked on.
-
From the object editor,
(press F2), delete existing geometry objects, (geo_1 and geo_2).
-
Get a new geometry
object, and name it bicep.
-
Enter the SOP
editor, (press F3 or click on your object
and press Enter) replace the default SOP with a box SOP, and scale
it to .2, 1, and .2. (Do not scale the objects in the object editor, you
will get deformed children when you pivot the heirarchy later. (That is
not a curse, it is a fact.))
-
Go back to the object
editor, right-click on the bicep icon, and select Show Origin. Move
the pivot point to the top of the cube, (Y translation of 0.5 in the pivot
field). This is the bicep of an arm. Or maybe it's the pendelum in a clock.
-
Duplicate the object,
(alt - C, alt - V), and translate it down in Y (in the
Object Editor) and scale it slightly (in the
SOP editor) .
Call it forearm. Make bicep the parent of forearm. (You can
do this by clicking on the bottom of the bicep icon, and then clicking
on the top of the forearm icon.)
-
Add a hand if you like,
the same way you added the arm. Make forearm parent of hand.
-
Now if you select the
bicep and rotate it in Z, the whole arm should move like a stick
with all the joints locked.
-
Get a new geometry
object, go to the SOP editor,
change it to a sphere. Go back to the object editor and re-name it arm_flap.
This will be your arm control slider.
-
Translate it out of
the way of the arm (move it down in Y), scale it if necessary. (Tip: make
this object the same colour as your bicep object. You can change
wireframe colours in the object's Misc tab.)
-
Select the bicep
object. Check the expressions
box. In the RZ box, enter the expression: ch("/obj/arm_flap/tx")*10.
(Tip: If you are having trouble seeing your expression in the tiny little
expression box provided, click on the comment box, drag the corner so it's
bigger, and enter your expression there. When you're done, just copy and
paste it into your expression box. You can leave the expression as a comment
if you want.) Remember, in Houdini any parameter can be animated, and can
reference any other parameter. This expression
tells Houdini to look at the channel (ch) of the object (obj)
arm_flap, and then to look at the translation in Xvalue of
that object (tx), and to finally multiply that value by 10. For
help with expressions at any time, go to Edit
-> Textport. In the textport,
type exhelp, or if you know the name of the expression
you need help with, type exhelp expression_name.
-
Now select the arm_flap
shere, and move it in X. Note how the arm object rotates like a stick.(Tip:
Using the Select and Transform State
(top left button above the viewport, or press the S key and then select
the object with the mouse), allows you to directly pick objects with the
mouse in the viewport.) (Another tip: Left mouse button will
select and transform objects, middle mouse button will only select objects,
and right mouse button will select or move objects, but with the added
benefit of not actually having to have the cursor 'touch' the object.
A further benefit of using the right mouse button is that undos happen
much faster than if you try to undo an action done with any other mouse
button.)
-
Duplicate the first
sphere , move it out of the way, and re-name it elbow_flap.
-
Select the forearm
object, and in the RX expression box, enter the expression: ch("/obj/elbow_flap/tx")
* 10 (Tip: Copy and paste, the modify, the
expression from arm_flap.)
-
Now, moving the elbow
flap slider moves the elbow.
-
Select the elbow_flap
sphere.
-
In the expression box,
enter ch("/obj/arm_flap/tx") in
the TX box.
-
Now try moving the
elbow_flap slider. You can't because it is locked to the arm_flap
slider.
-
Move the arm_flap
sphere. The elbow also rotates now.
-
Go to the arm_flap
shere, and in the TX box, enter the expression: sin
( $F * 10) *1. (Tip: You can see the results
of this expression immediately in the Animation
Editor, or by clicking on the black channel
button beside the translation field.) This
expression creates a sin wave. The $F tells Houdini to evaluate
the expression at every frame. The 10 determines the frequency,
(speed), and the 1 determines the amplitude, (size).
-
Play the animation
now. Notice how the arm swings back and forth using the sin wave expression
you just entered. See how the elbow rotates as well.
-
Now go back to the
elbow_flap sphere. Change the expression to read: chf("/obj/arm_flap/tx",
$F - 4)
-
This expression
causes the object to use the arm_flap rotation, offset by four frames.
The chf function
looks up a value of a channel at a specific
frame, and should be used when you are referencing an animated channel.
-
Now play the animation.
Note how the arm swings, and the elbow has a slight lag as it swings. Try
changing the value after the $Fin
the expression. See how the lag changes. Note how the elbow_flap
ball lags behind the arm_flap ball.
-
Now, lets add a switch
so we can make the elbow move automatically, (with the bicep), or manually,
(independant of the bicep).
-
Get a new geo object,
scale it, move it out of the way, name it Switch.
-
Select the elbow_flap
sphere, and go to Edit -> Add User defined
Channels. Call the new channel arm_move.
-
Go to the expression
in the TX box, and change the expression to read:
if
(ch("/obj/switch/tx") >.5, chf("/obj/arm_flap/tx", $F - 4), ch("/obj/geo/elbow_flap/arm_move"))
-
The if expression is
very handy and you will use it often. The syntax is
if
(A is true, then
use the value of B, otherwise
use the value of C.)
-
Look at the expression
again:
if
(ch("/obj/switch/tx")
>.5, chf("/obj/arm_flap/tx", $F - 4),
ch("/obj/geo/elbow_flap/arm_move"))
-
In English, this expression
says:
If
switch is less than .5 in X, (off, or set to auto),
then use the value of arm_flap, which
is the value of the bicep rotation, plus the offset, (the
$F- 4 part
of the expression.) If
the switch is more than .5 in X, (on, or set to manual), use the
value of arm_move.
-
Now go back to the
animation. Play it. Move the switch back and forth in X. Note how
the forearm is linked to the bicep when the switch is set
to Auto, (about zero in X), and how it you can manually control it, (or
even animate it with the arm_move channel), when it is set to manual,
(about one in X).
-
Go to the animation
editor, (press F5). Drill down to the elbow_flap/arm_move
channel in the lower right hand box. Adjust the value in the graph.
Play with the switch object. (Tip: Add a Channel
Group so that when you go back into the Animation
editor later, you can quickly call up your
arm_move channel and adjust it.
-
Now it's up to you
to build a pretty interface for this thing. See the hints below.
Animating
Transitions Between Automatic and Manual
Sometimes you will
have to have your character go from full automatic to manual. For example,
maybe the wings of your character are flapping nicely in Automatic, and
then you have to have your character wave one arm.
Go to the frame
that you want to begin manual operation. Select all the sliders and icons
that you will be animating from that frame on, (lets say frame 50). Save
a keyframe here. Now go to the frame where you want to begin the transition
from Auto to Manual, (say frame 40). Save another keyframe here. Now go
to the object that switches between Auto and Manual. Go back one frame,
(frame 39), and save a keyframe, (should still be set to auto). Now go
ahead one keyframe, (frame 40), move your switch to manual, and save a
keyframe, (it would be a good idea to go into the animation editor, or
pop up a Jive window, (click on the black channel button) and set the slope
of the switch channel to constant.) Now you can go to frame 50,
and move the individual sliders so that the character's arm is in the position
it should be after the transition. When it's all said and done, you should
have a smooth transition between frames 40 and 50, (auto and manual).
Hints
and Tips
-
Make sure that the
render flags
are off on every object that makes up your control panel, so that your
panel won't render if it happens to get in the way. (You can do this by
editing your object so that the geometry you want to display is set with
the display flag (blue) on. Then lay down an add SOP with Point
0 checked on and the default settings,
and click the brown, (render) flag. Now your single point is the
render object and will not show up in a render.
-
I moved my panel -400
units in Y so that it would be out of the way of any action, and won't
clutter up your view when working. Save out a viewport
preset so you can return to your panel quickly
and easily.
-
Make operator
groups so you can quickly hide and unhide
your control panel.
-
To ensure your switches
move only in X, (or Y, or whatever you've chosen), you can put them on
a path, and use the objects position translation instead
of the TX translation as a reference for your effected
elements. Or you can put the expression lock(0)
in the field of the translation you don't want to move, (where the number
zero is the value at which you wish to lock the field).
-
Make sure to toggle
off the selectability of the parts of the panel that you won't want to
be able to move, (frames and such). Do this by turning off the brown box
on an your object in the Object Editor.
Now when you select your sliders, you can't inadverdantly select frames
and such in your control panel.
-
Of course, instead
of using geometry as I did to make your interface, you can use an image
map. I found it took too long to load on my O2, so I've gone with geometry.
Geometry is also much easier to edit if you change something later.
-
All of this is much
easier to do now with CHOPs. Please check back again soon for my
new CHOPs tutorial.
To
Top
Copyright© 1998, Sean
Lewkiw, Toronoto, CANADA
URL: https://members.tripod.com/~sean_lewkiw/