Your online Softimage Educational Resource

The blog has been online for more than 4 years and there’s still not a single post even remotely related to the delicious brew called coffee… Perhaps it will someday, but in the meantime you can read the articles about Softimage. Most of the material are tutorials and Q&As I’ve written for 3D World Magazine sometime between today and 2003. If you have any questions please don’t hesitate sending me an email.


Thanks to Letterbox Animation Studios for hosting all the scene files.

Make sure you visit their Redi-Vivus.com for 100s of hours of free XSI video tutorials.

Tuesday, August 5, 2008

Animating a Writing Pen

By constraining the pen to two different paths we can control how the tip will move, independently from which direction we want the pen to point.

This is an interesting question, which of cause calls for an equally interesting solution. But as always before moving on to the fun part of actually animating, we need to go through the obligatory tedious theoretical details. As we start playing with the project, we will soon realize that we are facing two different difficulties; making the movement of the pencils appear natural and making the pen actually write/draw something on the paper.

So, in which end of the problem should we start then – do we want the drawing to follow the pen or the pen following the drawing? Well, it really depends on the complexity of the figure you are trying to draw, the requirement on the end result and your preferred workflow. If you are animating a pen drawing a blue print for example, where the main focus lies on how the actual shape is being reviled, you’ll most likely save a lot of time by starting with imprint, using your compositor, and then trace this inside XSI as the image is being reviled. But if it on the other hand lies on the motion of pen, you’ll be better of starting with the pen. This will also allow you to play around with the animation without having to redraw the imprint texture every time you make a change.

We will start this Q&A by looking in to on how to control the motion of the pen. What we want to accomplish is making it look like as if a hand is controlling the pen, as it usually is in reality. For this we will need to create a couple of nulls, set up a hierarchy, adding two constrains and draw two curves for the pen to follow. The first curve is a representation of the figure we are trying to draw and will also determine the position of the tip of the pen. If we where to use this curve alone to animate the pen the result would be quite stiff and unrealistic, therefore we will add an additional curve to control in what direction the pen shall point. This curve will be a duplicate of the first, which we’ve just modified and offset somewhat. To make the pen follow those two different paths the way we want to, we first need parent it under a null which we have position just at the tip. The reason we are doing this instead of animation the actual pen object, is because it ads a greater flexibility and will also serve as the center for the orientation. We will then create two new nulls, each animated along their respective paths, and constrain the pen hierarchy to these.

Since we’ve focus this project on the actual drawing, we will build the animation upon the first curve –the position of the tip. If the pen where to interact with the hand of a character in your scene we might have taken a slight different approach, concentrating more on the second curve, since this element is intended to fake the hands movement. Enclosed on the CD-ROM you can find two small movies, animated with the exact same curve but at different position.

Once finished animating the pen we need to create the ink trail chasing it. To get a good representation of the ink streak we will build it as a 3D object, wrapping it along the same curve as the tip is moving. By applying a constant or a toon material to the ink object we’ll give it a more 2 dimensional look. For basic scenes or if the objects are placed in a distance, this might be enough but many times we would like to take it one step further. Although we could add different textures and bump maps directly to the ink material to give it a desired character, it wouldn’t be the most efficient way. Instead you could use a rendered version a detailed animated ink texture. See the tips section for more information on the subject.

The project files used in this tutorial can be found at:
http://www.Redi-Vivus.com/Caffeineabuse/Animating_a_Writing_Pen.zip


Animating a writing pen step by step
Locate the XSI project files on the accomplishing CD-ROM and fire up the scene called Pen.scn. Not only does this scene hold a Pen, which some of you masterminds might have guessed, but I’ve also made it even easier for you and removed the cap so you can fully concentrate on the animation. Lets start by adding a Null at the tip and make it the parent of the pen object.

Next we need to create the path for our pen to follow. In the top viewport draw a curve corresponding with the figure or text you like to create. Create a new Null and set your curve as the path (found under Animate>Create>Path>Set Path). Change the options any way you like, just make sure you leave the Tangent box unchecked since this will otherwise rotate the pen as it travels along the curve.
Middle click on the first Null to branch-select the Pen. Add a position constrain to the hierarchy and choose the second Null as the constraining object. Playback the animation the see that everything is working. You should se a stiff, upright pen moving along your path. Don’t worry about this; we will fix this in the next step.

Select your curve object and the second null and press Ctrl + D to duplicate it. Move them both along the Y-axis till about the middle of the pen, and move it slightly towards the direction where your imaginary hand would be. Since we haven’t yet constrained the pen to the new path it might be hard to se what effect modifying the shape of the curve would have, so lets do that first.


Branch-select the pen null again. Turn on the Constraint Compensation (CnsComp) in the Constrain Panel, apply a Direction Constrain and pick the third null. This will force the pen to always be pointing towards the center of the null, whiteout affecting its position. Now you can start playing with the shape, scaling and position of the second curve. When you’re satisfied move on to the last step, where you’ll create the ink.



Create a Grid and set the U Length to about 0,2 and the V to 0,05. Decrease the U and V Subdivisions to 1 and position the Grid at the very beginning of the first curve. Select the “top edge” and extrude it along the curve. In the PPG increase the Subdivs until you get a smooth flowing object. On frame 1, set the End parameter to zero and set a keyframe. Jump to the last frame, increase the End to 100 and set another keyframe.

A couple of additional tips
Some tips on how to swing your pen and get that ink on the paper, and staying on.

Tip # 01
In the step by step section we just set two keyframes for the path animation, running from zero percent to one hundred. This will most likely not correspond with how you move a pen in real life, since you don’t write at a constant pace. A good starting point to give it a more natural movement is to add additional keyframes whenever the pen is passing trough areas with a harsh bend. Change the slope on the keyframes just enough to notice a slight change in the pace…

Tip # 02
You can achieve really rich looking texture by bringing a rendered version of the ink object into your compositor for stylization. To do so, start by creating a new Orthographic Camera. Turn one of your viewports into an Ortho view and click on the Y icon to view your objects straight from above without any perspective distortion. Position the camera so it is just above the object you are drawing on and zoom in, but without clipping the object. Create a separate Pass where only the ink object is visible (or just hide the other objects manually in your current Pass) and render the entire animation. Now, bring the sequence into your compositor and give it your desired characteristics, such as color, bumps, streaks and variations to its edges. Once back in XSI apply your newly created texture to the imprint object and hide the ink geometry. You should now have a nice-looking animated ink texture perfectly matched with your pen’s movement.

Tip # 03
Instead of controlling the path percentage on each individual object separately, you can use one slider to control them all. Use the Link With… function to link all of the others path percentage to the percentage on one object. Now whenever you change the value on this object, all the other will follow. Or for an even neater solution you could create a Custom Parameter Set and link all of them to this slider instead.

0 comments: