Join Rob Garrott for an in-depth discussion in this video Controlling parameters with the Range Mapper node, part of CINEMA 4D R12 Essential Training.
- View Offline
Xpresso is a scripting language based on the idea of nodes. Data flows in the nodes from the left and out of the node on the right. The nodes are little bits of code that perform specific functions. The most useful of these is the Range Mapper node. It can be used to convert one type of input into another. In this case, we are going to use a percentage input slider to control the rotation of objects in our scene. So what I have here is a Group A null object. Underneath it are a series of cubes. If I select the first cube here, you will see that the access point for that cube has been moved.
These started out as regular cubes and I just made them editable, flattened out them, and then moved their axis to the end here. So that when it's rotated, it rotates right from it end point. So what I want to do is I have a slider object on my Group A and I've already placed it on there ahead of time. If you want to learn how to create these sliders, there is a movie in this chapter on creating User Data sliders. Watch it and you will understand exactly how I got to this point. So, this slider goes from 0% to 100% right now and what I want to do is to use this slider to control the rotation of each of these cubes.
So what I am going to do is on the Group A null object on the Group A slider name, I am going to right-click and go to Animation >S et Driver, and on the Cube 0 object, the very first cube up here, I'm going to go to Coordinate properties and go to the rotation P. Just P by itself, right-click and go to Animation > Set Driven (Absolute). When I let go, I'm going to get an Xpresso tag that shows up on my object. That Xpresso tag now has established the link between the slider on Group A and the rotation of Cube 0.
When I double-click on that tag, I will get the Xpresso Editor window and I now see three notes. I have Group A here, a Range Mapper node, which is converting the percentage value in the Group A slider, and the rotation value that can be used by that cube to move itself. So if I move the Xpresso Editor down out of the way, click on the Group A object so I can see the Group A data slider here and drag that, you see as I move this slider the cube rotates. So what I want to do is create a relationship between each of these cubes and that slider.
Now I could use the Set Driven Keys command to create Xpresso links between these automatically, but what I would end up with is an individual Xpresso tag for each of my objects. But I want to have everything all in one tag as it's a lot cleaner that way and easier to manipulate. So I'm going to go to these cubes and I'm going to drag one of them in. I'll drag this first cube in and resize the node a little bit so that see more of it. I want to set the input and I want to match the input rotation P that this one has. So I can click on the input of this node, go to Coordinates, and then to Rotation, and to Rotation P and let go, and you see now it has the same value here and this Cube 1 node now represents this Cube 1 object.
Rather than repeat that process for each of the cubes, I want to do a little shortcut. I am going to hold down the Ctrl key and make a copy of this node. So when I drag down, I get a little plus sign on my pointer there and when I let go I have a new node. That Cube 1 node now, I'm going to replace the Cube 1 reference with Cube 2. So I drag Cube 2 right onto that node. Boom! And Cube 2 now is referenced by this. And if you select the node, you see under the Node properties it has a Reference field. This points to the object that it's referencing. Now I will repeat the process for the other two cubes.
So let's create a copy. Drag Cube 3 in. Then create one more copy. Let's move the Xpresso Editor up a bit so we can see it better. I'll drag to Cube 4 in. Now I have a node for each one of my cubes. All I need to do next is to establish a link between the single Range Mapper output and each of these node inputs. I'll drag a line, one, two, three, four, there we go.
Let's go back to the Group A object. When I move that slider, each of these guys will rotate. Let's drag that back and forth. There we go. So we go from 0 to 360 degrees just by moving that one percentage slider. Now there is still a little variation on this and we are going to use this Group A as a starting point. So I am going to hold down the Ctrl key and make a copy. This Group A object we are going to call Group B. The Group B, right now all of our cubes are children of this null, but they are all peers of one another.
What I want to create is a cascading hierarchy. So Cube 0 is the parent of Cube 1, is the parent of Cube 3, and to do this I'm going to drag them to be children of one another. So I will take Cube 1 and make it a child of Cube 0, and Cube 2 the Cube 1, and Cube 3 to Cube 2, Cube 4 to Cube 3. So this cascading hierarchy here now is going to behave very differently. If I go to the Group B null object and go to the User Data field, you see its labeled Group A. I can change the name of that by right-clicking on that and going to Edit Entry.
I can change the name right here. I will change that from Group A to Group B. You see now it says Group B and I hit Enter on the keyboard to get out of that window. Both of our groups are in the same position. So let's take Group B, use to Move key, and drag it over here to be a right just a bit. Then I am going to change the colors. Let's close the Xpresso Editor up, twirl this open, and then I'm going to select, holding the Ctrl key down, each of these material tags. Then I'll drag my B material right into that field and that changes them to white.
Now when I move the Group B slider, you will see that it behaves very differently. So this cascading hierarchy now translates the rotation of the parent to child. So it compounds and it behaves very much little scorpion tail. In fact, I used the technique very similar to this to create an animation for an insect quite a while back. So it's a really fun and easy way to get that kind of behavior out of it. Let's do one more variation on this with a Group C. I'm going to close up Group B and hold down the Ctrl key to make a copy of it as a drag, and let's name this Group C. We are going to once again go to the Group B slider and right-click on it, go to Edit Entry, and change the name from Group B to Group C. Now with our Group C slider, it's still in the same location.
Let's move this entire group over and then change the color one more time. Notice it has those objects already selected, but let's just reselect them again. Now I accidentally got that tag in there. I am going to hold down the Ctrl key to deselect that tag so it's just the texture tags. Then take the C material and drag it right in there. So now we have a third color here. The third variation that we are going to do is going to use additional Range Mapper nodes so that instead of having the exact same rotation value in each of our children, we are going to have incremental rotation values so that it doesn't curl up exactly on itself.
It has more of a graduated curve to it. So if we go to the Xpresso tag on the Group C, and right now we have one Range Mapper node controlling all these guys. What I want to do is I am going to move these guys over a little bit so I have room and I am going to Ctrl+ drag a copy of this Range Mapper. The way that Range Mapper node works is that it has an Input Range and an Output Range. The Input Range is what's coming into the node, the Output Range is what it spits out on the end. So in the Node Parameters here you can see that the Input Range is set to be Percentages, which is coming in from our slider.
The Output Range is set to be Degrees, which is what it's going to spit on the other end. So it's converting percentage values into degrees. The range here that we see down here is related to the slider directly. We have our slider set to be 0% to 100%. When the slider is at 0, it's going to spit out 0 degree. When it's at a 100%, it's going to spit out 360 degrees. So that gives us a lot a control for creating these new values. So what I want to do is I want to have Range Mappers that are set to different items other than 0 to 360 so that when the slider is a 0 and it moves to 100%, it's not going to rotate 360 degrees. It's going to rotate in increments of 90 degrees so that our tail doesn't actually rotate a full amount.
So if I select this Range Mapper node, this is going to be for the first cube here. I'm going to change the Output Range from 0 to 360 to 360-90. So I can't type the math in, because I stink in math. So I'm going to go 360 minus 90 and that's going to give me 270 degree. So now I take this node and I want to take the output of my Group C slider to the input of this Range Mapper and take the output of this Range Mapper right to this cube, and when I let go, it's going to override that existing connection.
Now I can repeat that process for these other nodes. I will hold down the Ctrl key to make a copy of this Range Mapper. This next Range Mapper I want to send from output of Group C to the input of this Range Mapper and tell it to be 270 - 90. So I go 270 - 90. That gives me 180 degrees. I can connect that to this root cube. Let's do it two more times. Set this one to be 180 - 90, 180 - 90, which of course gives us 90 degrees, and now I'd do the connection and then connect it over here.
Then the last one, rather than doing 90 degrees because that would give me 0 or no rotation at all, I am going to do 45 degrees. So I'll just, in the Range Mapper node under the Output Lower, I will set from 90 to be 45. And now I can take this Range Mapper, connect it up here, send it to the last cube. Let's move the Xpresso Editor out of the way, go to the Group C slider, let's back up just a bit so we can see what's happening here. As I move this slider, you see that now instead of rotating all the way around like Group B does, this one rotates in a graduated manner.
So each rotational value is 90 degree less than the rotational value that preceeded it along the range of the slider. If I grab Group B and slide it, you see the difference at 13% here and let's move this one to 13% as well, 13. So you can see that it gives us very different values. So you can see the Range Mapper node is amazingly powerful and it gives you tremendous control over your objects.
- Exploring the importance of object hierarchy
- Modeling with splines
- Modeling with the Knife and Extrude tools
- Applying materials and texturing
- Creating and manipulating light sources
- Animating in the timeline with keyframes
- Controlling camera movement
- Compositing in After Effects
- Texturing with BodyPaint
- Using XPresso and MoGraph
- Creating particle systems
- Rendering and adjusting final render settings