LIBRARY: Tutorials Reviews Interviews Editorials Features Business Authors RSS Feed

How to Control Keyframed Animation with XPresso

COW Library : Maxon Cinema 4D Tutorials : John Starr Dewar : How to Control Keyframed Animation with XPresso
How to Control Keyframed Animation with XPresso
CreativeCOW Cinema 4D Tutorial


How to Control Keyframed Animation with XPresso
John Starr Dewar John Starr Dewar
Orange, California, USA

©2004 John Starr Dewar and CreativeCOW.net. All rights reserved.


Article Focus:
In this article, John demonstrates the use of XPresso to control playback of keyframed animation in Cinema 4D. This functionality is not built into the program, and the Time track in the timeline is inadequate for many situations. John looked for a solution and found a surprisingly straightforward method.


Download files here before you begin


Recently, I needed to animate a Union Pacific “Big Boy” Steam Locomotive. I found a nice model on Turbosquid in .3ds format. It imported into Cinema 4D nicely, and even had the drivers and wheels pre-animated. But there was a problem: they were keyframe-animated, and I needed to be able to control the speed of the animation based on the speed of the locomotive. Therefore, I needed a way to control the animation with XPresso. Unfortunately, Cinema 4D does not have this functionality built in. Luckily, there is a simple solution available with a little help from the free Object Trails plugin available from Maxon’s Plugin Café website.

In addition to steam locomotives, this technique will come in handy for any complex animation that might you want to control with XPresso. For example, you can use a User Data slider to control a plane’s landing gear sequence, and have the gear locks and gear doors operate before the landing gear extend without futzing around for ages in the XPresso editor with the mix, clamp, and range-mapper nodes.

1) First you need a bit of complex keyframed animation. So download the example file above. Our sample file is an elongated sphere flying randomly through some randomly spinning rings. Utterly useless, but kind of artistic in a modern-pointless-expressionism sort of way. Also, download and install Object Trails 1.0 if you haven't already done so.

2) Select Torus.2 in the Object Manager and then select Plugins -> Object Trails 1.0.

3) In the window that opens, accept the default settings.


The plugin is pretty self-explanatory, but I'll explain it anyway. The sampled area is from frame 0-90, and the sample rate is how many frames go by before a new position point is sampled. This, of course, will determine how many points the resulting spline will have

Note: It is very important that you follow the following steps in order for each object, because Object Trails won't work with expression-based animation.

4) Next, create a null object, rename it Torus.2 Target Null and child it to Torus.2 as shown below.



5) Making sure that the null is selected, go to the Coordinates Manager and — first ensuring that it is set to Object Mode — zero all of the fields. Then, choose an arbitrary positive number and type it into the Z position field, as shown below.



(I arbitrarily chose 300.) It's probably a good idea to choose a number small enough that the null is still visible in the editor window, but whatever floats your boat is fine with me.

6) With the null still selected choose Plugins -> Object Trails 1.0. Accept the default settings.


7) Now you should see in your Editor Window two splines that follow the path of the torus and its child null.


8) Add an Align To Spline Expression to Torus.2.



9) Select the Align To Spline Expression Tag in the Object Manager and drag Torus.2 Path to the Spline Path box in the Attributes Manager as shown below.



10) Remove Torus.2 Target Null from the child position under Torus.2, and apply an Align To Spline Expression to it. Then select the tag and drag Torus.2 Target Null Path to the appropriate box in the Attributes Manager, just as you did in Step 9. Now your Object Manager should look like the figure below.



11) On the “Basic” page of the Attributes Manager, rename the Align To Spline Tags to something helpful. I just copy and paste so that my tags are named Torus.2 Target Null Align To Spline and Torus.2 Align To Spline.



Yes, they're a mouthful, but it will help keep things organized later on in the XPresso editor.

12) Select Torus.2 and add a Target Expression. Select the Target Expression and drag Torus.2 Target Null to the appropriate box in the Attributes Manager as shown in below.



13) Close any open umbrellas, pick up any stray pins you may find, and be extra careful around mirrors. So help me, I'm superstitious.

14) Organize your Object Manager so that it doesn't get too out of hand with all these tags, nulls, and splines. I like to create a null and name it “----------“. This makes a really nice separator.



15) Now repeat the process with Torus.1, Torus, and Sphere. You should end up with something like the Figure below.



16) Create a new Null Object. Name it Control Expression. Add an XPresso Expression Tag to this null. The XPresso editor will open automatically.



17) Drag and drop all of your Align To Spline tags into the XPresso editor window in the same order top-to-bottom as they appear in the Object Manager. Then select all of them by drawing a box with the marquee, and right click (or Command/Control-click) to bring up the contextual menu. Choose “Optimize” as shown below.


Now they will all be nice and organized. All this organizing isn't all that important to our project, but when you have thirty pistons and one of them isn't animating properly, you'll wish you'd been OCD about this like I am. Just remember, Aristotle says virtue is learned by habit, and most people agree that he was a pretty smart guy.

18) Click on the blue box to the left of the title bar of each node and select Tag Properties -> Position.


Sadly, you can't do this en masse, at least in version 8.5 — you must do it one at a time.

19) Select Control Expression in the Object Manager. Go to the Attributes Manager and find the User Data menu. Click on User Data -> Add User Data...



In the dialogue that pops up, change the name to “Position”. Leave the other fields as they are, but change the Interface to “Float Slider” as shown below.


Click OK. Your new user data slider will appear in the User Data tab of the Attributes Manager.

20) Drag and drop Control Expression from the Object Manager into the XPresso editor. Click on the red box next to the title bar. Choose User Data -> Position. Now connect the red out port to all of the blue in ports on the Align to Spline Tag nodes as shown below.


21) Close the XPresso editor and drag the User Data slider in the Attributes Manager. The effect should be exactly like dragging the time slider back and forth.

22) Assuming that your slider control works as you expect (if not, make sure that all of your null paths are correctly animated…it’s easy to forget to translate the null on the Z-axis before using Object Trails), you should now open the timeline and delete all of your keyframes.

Congratulations! You've successfully converted a keyframed animation to an XPresso-controlled animation! Download the finished scene to compare, if you like. I animated the XPresso slider so that the animation plays back normally. You can experiment with funky things like attaching a Time Node to a Sin Math Node to the slider, or making the animation loop and accelerating it over time. Have fun!

Discuss this technique in the Cinema 4d forum at Creativecow.net


Please visit our forums and view other articles at Creativecow.net if you found this page from a direct link.



Related Articles / Tutorials:
Cinema 4D
Multi Shader and Clones in Cinema 4D

Multi Shader and Clones in Cinema 4D
  Play Video
In this tutorial, CreativeCow leader Chris Martin explains how to use the multi shader material when working with clones in Cinema 4D. Other C4D concepts explored are the morph camera and the bend deformer.

Tutorial, Video Tutorial
Chris Martin
Cinema 4D
Cinema 4D: Containing Pyrocluster Particles Within An Object

Cinema 4D: Containing Pyrocluster Particles Within An Object
  Play Video
In this tutorial, we will be taking Pyrocluser particles and containing their movement inside a text object, as well as keeping them inside the object without the object itself being visible.

Tutorial, Video Tutorial
Bill Kelly
Cinema 4D
Making the Sun and controlling it using Xpresso in Cinema 4D

Making the Sun and controlling it using Xpresso in Cinema 4D
  Play Video
In this tutorial, you will see a simple method for creating a star that is more than just a lens flare. Graham goes on to show you some basic Xpresso methods to make animating easier.

Tutorial, Video Tutorial
Graham Quince
Cinema 4D
Creative Clouds in Cinema 4D

Creative Clouds in Cinema 4D
  Play Video
In this tutorial we'll be high above the Earth making some clouds that are natural looking and have some depth and volume, while not using the Pyrocluster plugin. After we create the materials, I'll show you how to adjust the various settings to make a wide array of different types of cloud formations. The sky is the limit!

Tutorial, Video Tutorial
Bill Kelly
Cinema 4D
Cinema 4D Boot Camp: Interface

Cinema 4D Boot Camp: Interface
  Play Video
In this chapter of the Cinema 4D introductory series, we'll get acquainted to the interface of Cinema 4D, explaining who is who and what is what.

Tutorial, Video Tutorial
Neal Barenblat
Cinema 4D
Cinema 4D Boot Camp: Modeling

Cinema 4D Boot Camp: Modeling
  Play Video
In the modeling section of our Cinema 4D introductory series, we take a look at the essential tools needed to become awesome modelers!

Tutorial, Video Tutorial
Neal Barenblat
Cinema 4D
CInema 4D Boot Camp: Animation

CInema 4D Boot Camp: Animation
  Play Video
In the Animation chapter of the Cinema 4D introductory series, we take a look at the tools provided to accomplish basic animation.

Tutorial, Video Tutorial
Neal Barenblat
Cinema 4D
Cinema 4D Boot Camp: Texturing

Cinema 4D Boot Camp: Texturing
  Play Video
In this chapter of the Cinema 4D introductory series, we take a look at some basic texturing principles.

Tutorial, Video Tutorial
Neal Barenblat
Cinema 4D
Creating a Leather Armchair: A Modeling Extravaganza

Creating a Leather Armchair: A Modeling Extravaganza
  Play Video
In this tutorial, I'll teach you some modelling concepts in order to create a leather armchair from scratch, including vertex manipulation and Hypernurbs smoothing! Of course, these techniques can be used to create many, many things!

Tutorial, Video Tutorial
Neal Barenblat
Cinema 4D
Part Two: Water Tutorial using MoGraph

Part Two: Water Tutorial using MoGraph
  Play Video
In part 2 of the Water Tutorial, Neal Barenblat will show you some cool and useful compositing techniques in After Effects to get this scene singing! You'll take a look at simple color correction, rotoscoping, and making a wiggle expression.

Tutorial, Video Tutorial
Neal Barenblat
MORE
© 2016 CreativeCOW.net All Rights Reserved
[TOP]