Animating Electromagnetic Attraction and Repulsion with Cinema 4D Dynamics

Photo of Donovan Keith

Instructor Donovan Keith

Share this video
  • Duration: 21:57
  • Views: 2035
  • Made with Release: 17
  • Works with Release: 17 and greater

Learn how to recreate an abstract motion graphics animation that shows a number of glowing orbs flying through space attracted to and repulsed by each other.

In this briskly paced tutorial, Donovan Keith walks you step by step through the process of recreating an abstract motion graphics animation that shows a number of glowing orbs flying through space attracted to and repulsed by each other. The key takeaway from this tutorial is that with reasonably simple dynamics setups you can create infinitely varied animations with beautiful and seemingly organic emergent properties. The techniques taught in this tutorial can easily be applied to simulating molecular interaction, celestial bodies, and simple flocking.

By the end of this tutorial, you will:
• TweakUse the Twist Deformer and the Sweep Object to create corkscrewing neon lights on the surface of a sphere.
• Setup a simulation where objects are attracted to and repulsed from each other using the Force object.
• Seamlessly pingpong keyframe animation with the oscillate looping mode.
• Tweak the attack and delay of the attraction with the F-Curve manager.
• Randomly assign colors from a palette to objects using the Variation Shader.
• Bake / Cache a dynamic simulation for faster playback.
• Reveal the strength of the magnets by linking their hue with their force use of Xpresso and the Filter shader.
• Setup the animation for render, and automatically match of the name of your rendered images to your project file with the use of render path tokens.
• Know which steps you might want to take in After Effects to punch up the quality of your finished image.

Less...

Transcript

- Hi, I'm Donovan Keith and in this video I'm going to take through the process that I went through in order to create this animation. ♪ [music] ♪ In it we see a bunch of spheres that are dynamically interacting. They've got a number of different colors and their colors are turning on and off as they are attracted or unattracted to each other. Let's go ahead and jump into Cinema 4D and get started. Go ahead and create a new project file and adjust your scene setting. So go to your project settings. I'm going to set my project scale to one millimeter and I'm doing this because my end models, I think, are going to be fairly small in scale. I want them to sort of move around like Christmas ornaments. Next step let's go ahead and save our project file. So to do that I'm going to go to File, Save and I've created a folder called "DynamicForceSpheres" and I'm going to name my project file "DynamicForceSpheres." I'm going to name my project file "DynamicForceSpheres_vAO1" for you, and because this is my second take, _vBO1. And then I'm going to choose Save. All right, we've got our project file set up. Let's go ahead and start modeling these different elements. Let's start with the central sphere. I'm going to add a sphere to my scene and let's set its radius to four centimeters. So it's pretty small and then I'm going to add a circle spline which we are going to use to create that spiral artifact around the outside of my sphere. So take the circle spline, drag it inside of the circle and change its radius to be four as well. Now I want to twist this circle around my sphere so I am going to add a twist deformer and as I add the twist deformer, I am going to hold down the shift key and in so doing it's going to automatically resize to the same size as my circle. This is going to allow me to quickly change its amount of angle or if I want to do this a little bit more easily I can type in 360 for one rotation times three for three spins round. Now the spline is a little hard to make out in some points and that's because there are not enough segments in this spline. So I'm going to go into my circle and I'm going to adjust the intermediate points. I'm going to do this by adjusting the angle a little bit lower. I could do something like say, one degree. We get something much smoother or if I wanted I could change it to subdivided and lower the number here to something like 0.1. And that ensures that I've got quite a few points on my circle spline. Now if I want to give this a bit of thickness so that it will actually render, I can use the sweep object. So I'm going to add a sweep object to my scene, drag it into my sphere, drag my circle into that and then I'm going to give it thickness with the inside splines. I'm going to drag the inside in and this becomes my profile. Now it's sort of huge by comparison, so I'm going to set this to 0.1, see how that looks and it's looking all right. Maybe I'll do 0.15 so it's just a little bit bigger. And what you'll see is that there's some hard edges on here and in order to fix that I'm just going to increase the number of sides up to something like 8, 9 or 10 depending on how close it's going to get to the camera. So now when I render I've got something that's looking pretty good. Let's start with some basic materials on this. So I'm going to start with a black material. So I'll just create a new material and call it "Black." And in this new material I'm just going to turn off reflectance and color. So this is just a totally black material and I'm going to throw that on my sphere so when I render, I see nothing. Now I want to create a luminous material for this piping so I'm going to create a new material and let's call this "Piping." I guess it's as good a name as any here. I'm going to open that up and I'm going to turn off color and I'm just going to turn on luminescence and I'm also going to turn off reflectance. Now I'm going to drag this piping material onto my sweep nurb and we can see we've got at least some color on that now. Now we'll go through adding in more specific colors in just a bit. Now having created my sphere I want to start arranging it into a pattern but before we do that, let's do a save incremental because we've done a good first step here. Okay, to create that grid I'm going to go to Mograph, Cloner and drag my sphere inside of the cloner. And I start out with this linear arrangement and I'm going to switch over from linear to grid. And now I get something like this. I'm going to want a few more of these spheres and I'm going to want a slightly more spread out arrangement. So let's say eight by eight by eight and I can just sort of drag this up and eyeball what I think is a good number. Let's say 150 for x, y and z here. And I'm going to tap the H key on my keyboard to frame up all of these spheres. See we've got a nice big grid here and I want these spheres to, well one, redraw more quickly and a quick way to do that is to turn on render instances in your cloner and it's going to treat these objects as one object in the memory of your computer which will make it a little bit faster to display and work with which is very nice. Next let's go ahead and jumble these up a bit. It's a little too ordered for me. So I'm going to select my cloner, I'm going to go to Mograph, Effector, Random. And my goal is to randomize the position a bit which is working. Maybe I'll crank this up to 20 by 20 by 20 so they leave their slots a little bit more. And I'm going to add in some rotation and I'm going to say 90 degrees on each of these axes. So all of these are now rotated and positioned differently. Now because we've got this cool sort of spiral shape, I would like for these to spiral over time. So when I press play right now they're just static. So in order to create that spiral effect I'm going to again select my cloner so that my next effector affects this. And I'm going to choose Mograph, Effector, Time. That's going to allow me to now animate the rotation of these over time. So as we see, they are spinning along their heading at 90 degrees per second. Now this is a little bit too slow for me. I want a slightly more psychedelic effect so I'm going to crank that up to 360. Looking pretty good, I find the deformer a little bit distracting so I'm going to turn off the visibility of the twist and now it's looking pretty good. Let's give it a render. It is a pretty powerful image just black and white like this, but I think I'd like a like a little bit of color variation. So let's go back into our piping material and in the Luminance channel, I'm going to add that variation by using the Effects, Variation shader. Let me just pull this up so you can see it in the recording, Effects, Variation. Now rendering this again, I see that I get a random color for each of these but they're all sort of pastel. So there's a couple of reasons that's happening. One, if I go into my variation shader, I see that the random color mode is set to normal which blends the randomized color with whatever is below it. So I'm actually going to switch over to gradient mode so I'm going to just bring random color down to zero. So now they're all white again but I'm going to turn Gradient Blend on at 100%, render again. And I want a stronger commitment to that blue so I'm going to change gradient mode from Normal to Replace. And now we're only going to get colors that we see in this gradient here. So I've got a good mix between blue and white but I want a little bit more color variation without the full randomness of that default random. So I'm going to untwirl my gradient then I'm going to choose Load Preset. And inside of here there are a number of different color schemes and I'm going to choose to work with scheme number seven here and give this another render. I now have a pretty interesting color palette for all of these different objects. So I'm going to close my material editor. I tell you this is another good point to save. So I'm going to save incremental. Perfect. Let's now add in some dynamic animation. So I'm going to select this cloner and I'm going to go to Simulation Tags and choose Rigid Body. Now if I press play right now, they are all just going to fall straight down and I don't want them to fall. I want them to sort of operate in a zero gravity space. So I have to adjust the gravity in my scene. So I'm going to go to Edit, Project Settings and in the Dynamics tab I'm going to set gravity to zero and press play again. Now we're right back where we started. They're just hovering in space, nothing is happening. Let's go ahead and change one last setting in here before we go into adding our forces. So click on this Dynamics tab and on the Collision tab, I'm going to change from Individual Elements Off to Top Level, which means that each and every copy of this sphere is going to be able to interact with every other copy of this sphere. And when I press Play, this is pretty slow. I'm getting about 30 frames per second. I'm going to change the shape from Automatic to Ellipsoid, which means that I'm going to get a spherical shape and that bought me about 15 frames per second. And that's basically because it's no longer trying to calculate the collisions for that piping. It's not really necessary to do that. Let's press Play again and see how this is working. We're getting our rotation that's looking pretty good. Let's go ahead and start having these spheres get attracted to each other and then break apart. So to create that attraction, I'm going to go to Simulate, Dynamics and add a Force. The default force basically turns each and every one of these spheres into a magnet and the closer to another sphere it is the more magnetized it becomes. That's what this inverse square falloff is saying. So when I press Play, well it's a lot slower for one and it's slower than you'll probably experience because I'm on a laptop and I'm also recording this video right now. So we're going to have to do a fair amount of caching moving forward. But as I press Play, we see that all of these spheres are slowly clumping together in the center and it's a pretty cool effect. , but it's one that takes a while to happen. So let's increase our project length from 90 frames to 300 which is the same as about 10 seconds long. So having done that, let's now animate this force property. If I was to just press play, at the end of this animation there would just be one big clump in the center and I want something a little more dynamic than that. And to achieve that, I'm going to crank up my strength to well one. It's not really that high and that's going to increase the force with which they hit each other. So it's going to happen more quickly and they fully collide and congeal with each other at about 30 frames. So based on knowing that, I'm going to say I want the strength to turn on and off about every 30 to 60 frames. So let's key frame strength at frame zero with a strength of one centimeter. And then go to frame 30 and I'm going to set the strength to a very small negative value so that they get repulsed from each other over time. So I'm going to set this to -0.075 and I'm going to press record again. So now when I press Play, they get attracted to each other and then shortly thereafter they start to push apart. And that's all well and good, but they just keep going and going and going and that's a pretty boring animation. So I want this to pulse on and off. Now in order to achieve that effect, I'm going right click on this perimeter, choose Animation and I'm going to choose Show Track. And what this brings me is the strength track which I can select and in my attributes manager I have this after setting and it's currently set to Constant. So what that means is after we hit frame 30, just stay at that same value. Well I want to change that to Oscillate. And I'm going to increase my repetitions to 10 because we've got about a 10 second animation and I'm going to go over to my F-curve mode here so you can see what's actually happening. When I tap F-curve, you now see that we've got this sort of sin wave where things are oscillating on and off. And I want the repulsion to be a little bit longer than the attraction. So I'm going to select this second key frame or maybe I'll select both of these and then just tap the H key which will frame them both. Select the second one and if hold down my control or command key, I can drag the handle out without changing its angle. And I'm just going to drag this over so it's a little bit slower coming into that repulsion end. It's repulsing a little bit longer. So now let's play through this again and see how it looks. All right, they start by getting attracted to each other in this way and then they're repulsing and then they are coming back together again and then repulsing and so on and so forth. And we're getting some fairly interesting shapes here. I'd say the repulsion isn't quite as strong as I would necessarily like in some of these portions, but let's say this is good enough for now. You can certainly tweak those settings to your heart's content. And just to get a better playback speed I need to cache this so I'm going to select my Dynamics Body Tag. Go to the Cache settings and choose Bake Object. It's going to take a minute for this to happen. Well thanks to the magic of editing, that baking is already finished and we can watch this playback in closer to real time. We're getting some fun attraction, repulsion and then these smaller clumps that form before entrophy just sort of has its way and knocks everything away from everything else. So I'd say that's actually looking pretty good. I want to now set up my camera for animation. So let's add a camera object to our scene and I'm doing this so that we can adjust the focal length. So let's first look through that camera and then check the focal length and I'm going to change it to wide angle. And I'm doing this so that there is more apparent perspective distortion so the closer objects seem much larger than the ones further way. And let's go to sort of this first natural clumping and then I'm going to tap the H key so I can frame everything. I just kind of want to rotate around here until I find a framing that's kind of interesting where I can see most of what's going on. And one thing I'm realizing is that my framing has got a nearly square aspect ratio and that's because I haven't setup my render settings yet. So let's just go ahead and do that. Go into your Render Settings, in the Output tab, let's do a 16 by 9 1080 p. So go to Film/Video presets and then down a little bit lower HDTV 1080 29.97. I'm going to change from Current Frame to All Frames. That means I'm going to rendering all of my frames out. And in our Save tab, I'm going to change the Default Render Path from No Path to including the project's name. So I'm going to use $prj. So my renders will now have the same name as my project up above here thanks to the new token system. And I want to put all of my renders in a renders folder so I'm going to add . /renders. So that's adding that renders folder and then inside of that I'm going to create a folder called $prj, so $prj. And so, what this means is that we'll get a separate folder for every single version of this file name and then we'll get a render with the exact same name. And just so you can save on file size, I'm going to change to a PNG. I'm going to keep it at eight bit but I am going to add an Alpha Channel and I'm going to turn on Straight Alpha so I get a cleaner composite. If you don't plan on changing the background, leave it off. And Anti-Aliasing, thankfully this is such a simple scene, we don't need to really change that. And I'd say we're actually in a pretty good place for our render settings and again we did all of this so that we could get a more accurate aspect ratio for our framing. Now I like the framing pretty well. I might shift the composition ever so slightly. We've got some of these objects in the foreground. Feel free to play around and then I'm now going to scrub through my animation and see how this composition looks over time. The first clump is centered and then we get these smaller clumps that are sort of elsewhere. I'd say it's good enough for me for now. Feel free to tweak this as you like. And what I'm going to do now is add in a motion camera and I'm doing this so that I can add some simple dynamic animation without having to key frame anything. So by adding my motion camera with my camera selected, it's automatically put it in the Camera link and I'm going to now look through my motion camera. I'm going to press Play. There's no difference between the two, but if I go to the Motion tab and change my preset I could choose something like Dogma Cam which is this really hyperactive camera similar to what you saw in the movie Dogma. Or you can change it to, let's say, Steady Cam 2 which is nice and floaty. It makes me feel like the camera is underwater or in some sort of aqueous solution. So I would say that's looking pretty good. Now right now the only clue that there are forces at work is the animation itself. That these objects are coming in together, colliding and separating. But what I want to do is have the color of these spheres change with the pulsing of the force. So it feels like they're maybe becoming more electrified as they suck in towards each other. So I'm going to use the force to drive the color of my variation shader. So select the Strength here for the force, right click, choose Xpressions and I'm going to choose Set Driver. So I'm saying, "Okay, pay attention to the strength." And then in my material manager here, I'm going to open up my piping shader, go to Luminance and once inside there I'm going to add in a filter effect. So that Filter shader, once I add it, is going to allow me to do things like change the saturation. So I can hyper-saturate the colors or I can totally desaturate them. And I want to drive the saturation with that force strength. So we've done Set Driver. I'm now going to select the saturation and choose Xpressions, Set Driven (Absolute. ) This creates a new null object with a tag on it. I'm going to go ahead and open that Xpresso tag and adjust the settings of my range mapper. So this controls how these two parameters relate to each other. The force is varying between zero and one so Input Lower, zero makes sense. Input Upper, I'm going to set to one and because the force actually goes negative and I don't want it to ever become less saturated than it is at default, I'm going to turn on Clamp Lower. Now doing this, we can play through and see that the colors even in the editor are changing. Their saturation is shifting over time. All right, I'd say we are actually in a pretty good place to set this up for our final render. If I recall, our settings look pretty good. I'm just going to do a Save Incremental. That way, our render file gets its name from something meaningful. I'm going to press this middle render button. And you're seeing maybe some artifacts on the edges of your objects. That's because of the straight alphas. Don't worry about that, you'll just take it into a compositing program and lay it over a colored background. And we're getting nice and zippy render times. Now this is just one possible look that you can take with this animation. I did some earlier tests where I made them reflective and I also added in some depth of field effect rendered out in Cinema 4D which looks beautiful but is pretty slow to render. So you can certainly play around with your materials and get a better look, but for the effect that we see in the finished animation here, all I've done is I've taken that raw render and I added in some glow in After Effects. I added in a vignette as well as a blue background and then I piped all of that through the Reel Smart Motion Blur plugin which gave me a nice quick rendering motion blur which is not quite as good quality as you'll get out of Cinema 4D. The final step that I took in creating this was to create a simple sound design using the program Adobe Audition which allows you to bring in a bunch of preset sound effects and layer them in as I've done when things are colliding with each other and being repulsed and attracted. All right, I hope that you've picked up at least a couple of interesting techniques for your next project. Thank you very much for watching and I'll see you next time on Cineversity. ♪ [music] ♪
Resume Auto-Scroll?