Controlling multiple objects with a single slider
Video: Controlling multiple objects with a single sliderIn the previous movie, we created user data that contained a slider that controlled the Offset function of the spline wrap object here on our scene. What we're going to do in this movie is to duplicate these objects and show how to create a single slider and show how to use that single slider to control multiple objects. This is the scene file as we left off in the previous movie, and I've got a Slider's Null Object here, and there's a User Data field on here with the slider on it that is animated from 0 to 100 percent.
Viewers: in countries Watching now:
CINEMA 4D Essentials with Rob Garrott is a graduated introduction to this complex 3D modeling, rendering, and animation program, which breaks down into installments that can be completed within 2 hours. Start this installment with a look at Xpresso, a scripting tool that allows you to speed up your workflow by automating control of rigs, animations, and menu commands. This course also covers the basics of character rigging, from binding joints and geometry to adding movement with CMotion.
- Linking objects to points in Xpresso
- Creating a data slider to control a spline wrap
- Controlling multiple objects with a single slider
- Understanding the traditional character animation workflow
- Using the Character object for building and applying rigs
Controlling multiple objects with a single slider
In the previous movie, we created user data that contained a slider that controlled the Offset function of the spline wrap object here on our scene. What we're going to do in this movie is to duplicate these objects and show how to create a single slider and show how to use that single slider to control multiple objects. This is the scene file as we left off in the previous movie, and I've got a Slider's Null Object here, and there's a User Data field on here with the slider on it that is animated from 0 to 100 percent.
So what we want to be able to do is to duplicate the relationship of the matrix object in the spheres on the spline, but leave the big sphere alone. We want to have just one big sphere and multiple copies of these objects traveling through it. You'll see why in just a moment. Before we do that though there's a very important thing we have to fix on the XPresso tag for this spline wrap. When we used Set Driven Keys to create the relationship in the previous movie, we told it to do an absolute reference, but it only does an absolute reference for half of the equation.
Let's see what that means. If I double-click on this XPresso tag, I now get the XPresso Editor, and it looks like I only have two nodes in here, but it's a little bit tangled up right now so I have to untangle my nodes. So let's take the Range Mapper and drag it down here, and drag the Sphere over here, and drag the Sliders over here. Now you can see this whole relationship. This Range Mapper node is automatically placed when you use Set Driven Keys, and what a Range Mapper does is interpret data between two different nodes.
It can interpret data in a lot of different ways. In this case, it's basically a straight pass-through, but we're going to use this Range Mapper node in a little bit later to control the speed of our objects. So if we look at the Sliders node, and in the Attributes for the Slider node, you see in fact it does have an Absolute Reference. And this was created when we right- clicked and did the Set Driven Absolute. Now if you look at the Sphere spline wrap node and you click on that, you can see that that one is set to be a Relative Reference. That means if we move this tag off the object, it won't work.
So what we need to be able to do is to move this tag any place in the scene. So I'm going to set the mode from Relative Reference to Absolute Reference. What that will do is now no matter where we put this tag, it will always point back to this same spline wrap object. Objects in CINEMA 4D have something called an Object Index and that index is independent from the name. So now that we've fixed that very important element, what we need to do is to make copies of this relationship. Let's twirl close the Blobby uber object. And I'm going to hold down the Control key and drag down.
That's going to create a Blobby uber.1. It looks like nothing has happened. That's because we now have two in exactly the same position. So let's go into Point mode if you're not there already, and then twirl open the Blobby uber.1 and let's grab the spline that's in there. Let's move the points around a bit. Let's close the XPresso Editor for just a moment, and let's grab the points on this side of this spline and I'll move them over here. You can see that I in fact now have two splines. Let's take these points and move them over here. I'm grabbing the axis band.
It doesn't really matter where you put them. This is going to be a very abstract sort of element and I'm just going to be kind of roughing these in. Then I want to take this last point, and there's a very tight bend here. I'm going to go twirl open this one and grab the spline and grab this point here and just drag it out to soften that curve. Now you can see that when we scrub through we've got two sets of these spheres traveling through that central sphere. Let's do one more copy. Twirl close the Blobby uber.1. You want to make sure and select the actual object first and then hold down the Ctrl key and that makes Blobby uber.2.
Let's move the points on the spline for Blobby uber.2 and let's move those up. Sounds good. I'll take that and move it up there. Take that point, move it up here. Take both of those points and move them at the same time up here. Let's move them closer in, too. I think that's better. So now when you hit play, you can see that we've got three sets of these spheres traveling through that central location. Now right now all these spheres are traveling at the same speed in the same direction, approximately, because the splines are the same lengths.
What we want to do is to reverse one of them. Now the one I have selected is just as good as any other. You can see that the spline direction is set to go from white to blue along the X axis here. So let's right-click and do Reverse Sequence. That changes the point to start over here now and flow back the other direction. Watch what happens when I hit play. The spheres are now flowing the other direction. I think that's good. I didn't want to have everything flowing the same way. Now let's take a look at what that's done to the XPresso.
Each time we copied the Blobby uber group, it made a new copy of the XPresso tag as well. And each of those XPresso tags, because of the Absolute References, are all pointed back at the same sliders. That's why the animation still works, because this information from this slider null is still driving each of these spline wraps. So what we want to do is to rename the spline wraps, because it's going to get very confusing since they're all named the same thing. So let's call this first one 01 wrap and then let's go ahead and call the next one 02 wrap.
Let's call this next one 03 wrap. Here we go. Now that we've named those, it will be much easier to identify them when we get into XPresso to clean things up. It's bad form to have the XPresso for all three of these spread out amongst so many objects. We're going to do ourselves a favor and clean up this XPresso a bit. So to do that, we need to have a single XPresso tag that's going to contain the XPresso for each of these. I'm going to right-click on the Sliders, and then go to CINEMA 4D Tags, and then XPresso.
That's going to give me a new XPresso Editor. Now let's start by going to this spline wrap number 01 and double-click on that. That shows us the XPresso Editor for that spline wrap. Let's grab all of these nodes, then go to Edit and Cut. Next thing we want to do is make sure we're going to paste this down in the right location. Let's double-click on this XPresso node up here, the one that's on the Sliders null. We double-click and you can see now we're in this node on that object. If you want to make double sure, you can close the XPresso Editor up and then double-click on that to make sure you're in the right place.
Now let's go to Edit and then Paste that down again. Then let's scrub through the animation to make sure that everything is still working. And you could see it is still working, so we haven't messed anything up. And there's our 01 wrap reference, and we can move these down here. So there's the Sliders null reference, here's a Range Mapper for 01, and then there is the 01 itself. Let's repeat that process for 02. Now we no longer need the XPresso tag on 01 so we can delete that. Let's go to the 02 node, and there's our 02 wrap.
Let's grab all those nodes, and then go to Edit > Cut those nodes, and then on this one here paste that down into the window. So let's click away from those guys and then hit Edit and then Paste. And let's drag those down here. You can see we're having multiple nodes and multiple relationships all in the same XPresso Editor. Let's verify that everything still works. You can see, yes, it does. Let's repeat that process one last time. We'll delete the 02 XPresso tag, because we don't need that one anymore, and then go down to the 03 XPresso tag.
Double-click on that, and then take these nodes, and then go to Edit > Cut. Then scroll up and open up that Sliders XPresso, and then paste it down, Edit > Paste. I'll hold down the Shift key to select multiple nodes, and let's drag those down here. You can see now if we back out a little bit, we've got all of these nodes and relationships in a single XPresso Editor, much more clean. So let's go back and delete that errant tag now. That one is just an empty tag. You can see if we double- click on it nothing's there.
Delete it from the Manager. Now what we can do is to go back to our Sliders null and clean things up a bit here. We don't need to have a reference for each of the sliders. We can actually use one reference of the sliders to control all of these Range Mappers. So let's resize all of these nodes and I'm going to drag to the left to resize each of those nodes. Zoom in just a bit and I'll hover my mouse over there and just give myself a little bit more space to work. Let's delete two of these sliders references.
Select these bottom two and then hit the Delete key. And that's going to break the Range Mappers. If we go back and move our animation you see that two of the objects don't move anymore. What we can do though, is use this single Sliders null and take multiple connections out of this port. That's one of the really cool things. You can just click on the Sliders output and drag down and put it back into the input and now that same Sliders null is controlling that Range Mapper as well. Drag through. You can see that there it's working. Let's fix the last one.
Drag that down and put it right on top of there, and now we've got three Range Mappers being controlled by a single slider. That makes things a lot easier to keep track of from an XPresso standpoint. Now what we want to do, if we hit play you'll see that all those guys are all travelling at the same speed. So what I want to do is to vary the speed a little bit. I can do that actually two ways, I could change the lengths of the splines, so a spline that's longer will have an object that's traveling faster on it, and a spline that's shorter will have objects that are traveling slower.
But I'd rather control that numerically. I want to keep these splines all about the same length. So if I go into the Range Mapper node, and bring up the Attribute Manager a little bit so we can see better, the way the Range Mapper node works is it interprets data from one node to another. The Inputs, Upper and Lower, represent how much information is coming into the input field. The Output, Upper and Lower, relates to how much data is flowing out. So when the input is on 0, the output is also on 0. When the input is on 100, the output is on 100.
So if I want to have spline wrap 01 travel a little bit faster, what I can do is tell it, instead of being 100% when these sliders are at 100, tell it to be 110%. Now watch what happens when I hit play. One of them is traveling, it goes actually beyond the spline, it's this guy right here. It's also traveling a little bit faster. Let's use that same technique to slow things down. Let's stop playback for a second and go to Range Mapper. Again, for this number 02, and let's slow that one down. The way we do that is by having it go not as far.
Let's change that to 90. Now when we hit play, you see that one of them is going as little bit slower and it also doesn't quite reach the end of its path. So now they don't all hit at exactly the same time. That feels a lot better. Let's close the XPresso Editor and stop playback. Now we get down to the nitty-gritty. Why did I do all this? We're going to create a little abstract shape, and the object we're going to use to do this is something called a Metaball. If you click and hold on the Modeling Objects, down here in the bottom left, the Metaball object has this weird, interesting icon.
What it does is it takes both spheres and splines that you place under it and creates a smooth skin around those shapes. I'm going to start off by taking the Metaball and dragging it down below Sliders. Then let's take Blobby uber and place it under the Metaball and watch what happens when I do that. I get this new shape that's based on both the shape of the spline and the shape of the spheres that were underneath it. Now one of the bad things about the Metaball is you can only put spheres and splines under there, but you can still create some really cool stuff.
Now when we hit play look what happens. I get this weird blob traveling along an even longer weird blob. Let's go ahead and add in the others as well and let's take the Blobby uber and drag it into the hierarchy, and drag Blobby uber.2 and drag it into the hierarchy. You can see each time we do that, we get this weirdness. Let's do the last thing and add the big sphere into the hierarchy as well, and we get this nice bulge in the center. Let's rewind back to zero and hit play. The animation is going to playback too slow.
So let's stop playback and let's give it a chance to speed things up. On the Metaball in the Object Properties there's something called an Editor Subdivision and a Render Subdivision. This controls how accurately the Metaball is drawn here in the Editor window and how accurately it's going to be drawn in the Renderer. Now if I hit Shift+R on the keyboard and render something to the Picture Viewer, the shapes that I have here are incredibly smooth compared to the rough shapes that I have here. And that's because of that Render Subdivision.
Let's close up the Picture Viewer, and you can see that the Render Subdivision is 5. A very important gotcha with the Metaball is never put the Editor Subdivision below the Render Subdivision. You always want it to be higher. To speed things up here in the Editor window I'll make the Editor Subdivision higher than 40. Let's bring it up to, say, 60. Our shape is going to get a little more coarse, but now though we can see we can scrub through it a lot easier. It's not going to be chunking anymore. The Hull Value controls how tightly the Metaball object is conformed to the objects underneath it.
So let's take the Hull Value and go up. It's counterintuitive. The higher the Hull Value, the tighter the object is. Let's bring that down a little bit. You can see that we get a little more definition on our central blob. And don't worry that this chunkiness is going to go away when we render. You can see that we've got weirdness going on. Those will be still smooth. But now we can scrub through and we get a definite bulge in the transition area, and I really like that. Let's zoom in on that. Let's rewind back to 0 and hit play, and this is not playing back at real-time.
We'd want to make a preview movie of this. Let's hit Option+B or Alt+B on the keyboard, change it from Full Render to Software Preview, and let's see how these guys are traveling. I'll leave it at 320, so it's a nice small render and it should go pretty quick. You'll see the Calculating Preview is down here in the Infos field. I'll hit Play here, and that's going to cache the frames first. So hopefully you got an idea for how you could use XPresso techniques to control your animation. Remember, this is just the tip of the iceberg, and this kind of organic shape could have been done without XPresso, but with XPresso it becomes a whole lot easier.
I'm going to put a rendering of this smooth organic shape into the Exercise Files folder. That way you can see what the final result looks like.
There are currently no FAQs about CINEMA 4D Essentials 8: Character Rigging and Xpresso.