Point SOP: This tutorial shows you how to use Magnets and the Point SOP in Side Effects Software's Houdini to quickly create a convincing, fully procedural stingray motion. The completed project file is available as stingray.hip.gz (35k). Note: If you're not familiar with the sin() expression take a look at Anatomy of a Sine Wave Expression in the Houdini User Guide before proceeding.

There are four parts to this example:

1. assemble the body curves
2. animate the body
3. animate the wing
4. add the skin and materials.

To view larger versions of the thumbnails, just click on the image - they will open up in a new window.

Assemble the Body Curves

The first step is to build five NURBS curves for half the body, which will later be mirrored and skinned. Some important things to remember regarding the skinning operation are that the curves have to be drawn in the same direction (from nose to tail in the example), that they have to have the same number of points, and that the correct order is followed when feeding them into the Skin SOP.

Building the curves is straightforward but if you wish to skip the modelling portion load the file stingcurves.hip.gz (25k) and jump to step 14.

  • Start up Houdini and create an object called stingray. Delete or turn off the display flags for any other objects in the file.
  • Enter the stingray object SOP Editor and place a Model SOP. Rename it from model1 to model3 as it will be the third curve in the sequence. Enter its Model Editor.
  • In the top view draw an open NURBS curve with CVs to represent the outer edge of the body. Start by turning on snapping (Alt-j) and placing a CV on the X axis near the right side of the viewport. Turn off snapping and with the Alt key held down place a second CV perpendicular to the first with respect to the X axis. Continue to place CVs as shown in figure 1 until you have almost completed the tail.

  • Before you place the last CV, turn on snapping and hold down the Alt and Ctrl keys so that the last CV is snapped to the X axis but also constrained in the Z direction. The reason for keeping the first and last pairs of CVs to the same Z value is that when the body is mirrored the ends will skin smoothly with no breaks in continuity (i.e. no creases).
  • Once you're happy with the shape of the curve exit to the SOP Editor.
  • With the Model SOP selected make a duplicate using the Alt-C and Alt-V keys. It will name itself model4.
  • Enter the Model Editor for the duplicate - model4.
  • In the top view drag the CVs up towards the X axis until they are roughly half way between the original curve and the axis - figure 2.

  • In the Front view, select all the CVs except for the first and last and move them upwards a small amount. Adjust individual CVs to get a shape similar to the one shown.
  • Exit up to the SOP Editor and duplicate model4 to create model5.
  • Enter the model5 Model Editor. This curve represents the centreline of the stingray and so needs to be flattened in the XY axis. To move the CVs in one step, hold down the C key, to enter the Construction Plane state, and press Z. The Construction Plane should reorient itself to the XY plane. Then, with all the CVs selected, press the E key to flatten the selection to the plane - figure 3.

    Hint: hold down the Ctrl and Right Mouse Button to get a context sensitive pop up list of these key controls. All that remains is to duplicate and adjust the last two models.

  • Exit up to the SOP Editor. Duplicate model5 and name the copy model1, then duplicate model4 and name the copy model2.
  • For both model1 and model2 do the following: Enter the Model Editor and select the curve. Use the Tab key to turn on the Transformation Jack. Press the W key to snap the Jack to the origin and then press M to mirror the curve around the horizontal axis.
  • Merge the five models in order from 1 to 5. Make sure that the curves are merged in order or else they won't skin correctly - figure 4.

    Because of Houdini's procedural nature there is no need to follow the usual build then animate process; in this case you'll animate the curves first and then skin the result.



    figure 1.





    figure 2. 






    figure 3.







    figure 4.

    Animate the Body

    The first step is to apply a wave type motion to the entire body using magnets.

  • Start a new network by placing a Metaball SOP to the right of the model SOPs. The Metaball defines where the magnetic forces are applied. Set the Radius to 2, 1, 2 and the Centre to 0, -0.5, 0.

  • Append a Copy SOP to the metaball with 2 copies and an X translation of 6.

  • Use copy and paste, or Ctrl-C and Ctrl-V, to duplicate the Metaball SOP. Move the second metaball tile to the right. Make its Centre values 3, -0.5, 0 and set the Weight to -2. The result is a row of three metaballs 3 units apart with weights of 2, -2 and 2. Note that as the centre metaball has a negative weight it won't be visible in the viewport.

  • Merge the Copy and Metaball SOPs and append a Transform SOP. In the Transform make the X translation -$F/15. This moves the metaballs past the body based on a stately 90 frame cycle. Translating the body with stationary metaballs would have the same effect. The network so far should be as shown - figure 5.

  • The deforming effect comes from a magnet so append a Magnet SOP to the curves merge. Set its Translate parameters to 0, 0.1, 0 and wire the metaball Xform SOP into the second, right hand input.
  • Set the animation length to 90 frames, using the Playbar, and playback the result of the Magnet SOP. As the metaballs pass the curves they should create a smoothly arching body shape that responds to the metaball radius and weight - figure 6.



    figure 5.



    figure 6.

    Animate the Wing

    The next step is to add the wing motion. This is done by giving each part of the edge curve an up and down sine motion in sequence. This is easy to do as each point has a unique number.

  • In the Viewport turn on the point and point number display. Adjust the view to confirm that the outer edge points are numbered 30 to 33 - see figure 7. (If you built your own curves your numbers may be different).

  • Append a Point SOP to the Magnet SOP and set the Point SOP Group to 30-33 (or the edge point numbers in your case) to effect only those edge points. In the Y translation field enter the following expression, (turn Expressions on first):


  • This looks intimidating but the only important parts of this expression are: sin which creates the wave shape, $F*4 which sets the timing and $PT which sets the offset based on the point number. The rest of the expression is just fine tuning.

  • Playback the animation and check the wing motion. Adjust the expression to taste e.g. the 0.5 value controls the amplitude of the motion, the -0.1 controls the height above or below the body, and the 4 (in $F*4) controls the timing.



    figure 7.

    Add the Skin and Materials

    Append a Skin SOP to the Point SOP. As long as the curves are merged in the correct order the body should skin correctly with the default parameters.

  • Append a Copy SOP to duplicate the half body. Set the number of Copies to 2 and set the Scale to 1, 1, -1. You may want to put a small value in the z translation to create a gap and so a smoother join; e.g. make the Translate values 0, 0, -0.05

  • Append a Stitch SOP. Set the Direction to in V and the LeftUV and the RightUV to 0, 1. Turn on the Stitch, Tangent and Wrap First to Last options to smoothly join the two halves.

  • Finally append a Material SOP and assign a skin material of your choice. In the example this is a simple flat shader without textures so there's no need for a Texture SOP. Your final network should be as shown - figure 8.

  • Set the Render flag on the Material SOP and render.



    figure 8.

    Additional Ideas

    Other things you could do (look here for a QuickTime movie (1.6 Mb) and hip file (172k) of the following):

  • Add a Fog Object with a blue uniform depth fog.
  • Create a bones skeleton, have the bones follow a curved path and then use capture and deform tools to create a flowing motion. If you do this set the bypass on the Magnet SOP.
  • Add a projection map for the stingray to move through.