Breaking Glass: Controlling and Animating the Crack Growth

Share this video
  • Duration: 11:00
  • Views: 914
  • Made with Release: 19
  • Works with Release: 19 and greater

Using a 3D Gradient Shader, a Null and a teeny weeny bit of XPRESSO, we can control the Glass Cracking Growth, and animate it using just a few keyframes.



Now that our glass text is nicely textured and detailed, we're going to proceed to creating a setup that will allow us to introduce these cracks in an art directable and controllable way. Now the way we're going to do this is as follows. If I go to the inner glass material, I'm going to drag it over here so we can see what's going on. I'm going to activate the Alpha Channel. And in the Alpha Channel, I'm going to add a color, and I'm going to click on the color and make it black. If I render in my viewport, you will see that the cracks are now gone because we are masking them and making them invisible. I'm going to use this with a gradient, a very special type of gradient, and I'm going to animate that gradient to animate the introduction of the cracks. Now in order to do that, instead of doing it directly on this material because we can't really preview what's going on with our Alpha Channels and our transparencies, I'm going to create a new material which I'm going to call Preview, prev. I'm going to double click on it. I'm going to move it over here. Turn off everything and activate luminance. Then I'm going to take the preview and drag it on my Voronoi Fracture. And I'm going to activate my microshading so I can see it on my text. In the Luminance Channel, I'm going to load a gradient shader, and I'm going to click on it and change the gradient type from 2DU to 3D spherical. Now you can see, this looks very odd. The reason is that the space is object, which means that for each and every one of the fragments, the new gradient is created. I do not want that. I want to change this from object to world coordinates. And now you can see these circles going out. The reason we see this kind of pattern is that the Cycle is on. So every time the gradient finishes, it starts again. So I'm going to turn this off. And now we have one gradient from black to white, it has a radius of 100, and it starts at world coordinates, world coordinates minus 100, 0, and 0. I'm going to zero this out. And what I'm going to do is use Xpresso to control the start and the radius, which are two very important parameters, using a null. So going to go here and create a null. I'm going to call it Control Null. On this Control Null, I'm going to right-click and add an Xpresso tag. And what I'm going to do here after I make this window a bit shorter, is the following. I want to use the Control Null to drive the gradient. So I'm going to click and drag the Control Null here to the left. And in order to drag the gradient parameters, don't drag the gradient or anything like that, go and drag this icon. This icon represents the result of everything underneath it. So if I click here and drag it over here, I will get all the parameters over here as you can see, which correlate to all the parameters over here. Another way to do that will be to go to the luminance and drag this icon over here. It's exactly the same thing. So select it and delete it for now. Let's go back in here. The two parameters I want to control using Xpresso are the start. So click and drag over here. Instead of clicking on this and trying to find where it is, it's easier to drag it from your interface. And I want to drag the radius, so click and drag over here. Now if you can't see the text properly, all you have to do is press CMD or CTRL and doubleclick on the name and it will resize it to fit or the input and output ports. Now I'm going to use the two parameters from my control. Now I'm going to close this for now. But in order for the parameters to work as I want them to, I need to change the null display from dot to sphere. So now my null is represented by a sphere in my viewport. I want to change the orientation from camera to X, Y, and you can see the representation of the viewport changed. Then now if I change this, you can see that we have a nice little sphere-type null over there. Fantastic. So because our start on the gradient is set in world coordinates, I'm going to click here and go to the coordinates, and get my Global Position, which are my world coordinates. And the next thing I want to do is click on the null and drag the radius over here as well, and again, CMD or CTRL+doubleclick. So I'm going to connect my global position over the null to the start and my radius to the radius. And now, by just moving this null, I'm controlling my gradient. And if I go to the radius here, I can control how this null looks like. The next thing I need to do, and I can close this down for now, is I want to make this gradient much sharper because I need it as a mask. So I'm going to click here, and all I have to do is grab this guy here and bring it very close to the white side. So now, I can use my Control Null to control exactly where this dark circle exists. What I have to do is replace this setup in this materials, Alpha Channel. And I'm going to do it in the following way. Double click here, go to the luminance, say Copy Shader, click on this, go to the Alpha Channel, and say Paste Shader. Now don't forget that in the Xpresso setup, these are linked up to this material's gradient. So all we have to do is click and drag this guy over here, and let's go inside and drag the start, and the radius, and then CMD or CTRL+doubleclick, and let's connect this one to this one, and this one to this one. So now, this null is controlling both the gradient on the preview material and our Glass Alpha Channel. So let's close this down, let's close this down. And let's click on this, so I can just delete it because now we have everything we need over here. Let's render this and see what happens. And as you can see, we have the opposite effect than what we need. Instead of having the cracks inside of the radius of our null sphere, we have them outside. So I need to invert my gradient. So go back to the material, bring it over here, and you can go here and just select the black color, untwirl this and make it white, and the white and make it black. You can always go here and say Invert, but I prefer to have a setup material so I can know what I'm doing if I render. Now, you will see that the cracks are visible only within the gradient. So all I have to do is animate these parameters. Let's go to my front view, and let's scrub around and see where our animation begins. And you can see that if I maximize this view, I want my control null to be somewhere between the E and the A. And you can see that it starts moving, and this is where it touches. I want the crack to appear when these touch the other letter. So what I'm going to do is go to Frame 14, take my Control Null and say radius is zero, and add a keyframe, Frame 15 or 16 just to make it grow for a couple of frames or even 17. I'm going to grow my null so that it includes the K, and the R on the other side, and add a keyframe. So now, I'm going to create this introduction of my cracks. And then I'm going to go to my 3D view and start scrubbing. Don't forget we need to have our dynamic simulation baked in order to see the scrubbing. I'm going to go somewhere here and grow my radius a bit more over here, for example, add a keyframe, then I'm going to move a bit more. And there you go. When the N touches the G, I'm going to grow this even more. Excellent. And on the next frame, I'm just going to make this number huge. I'm going to make it add two zeros at the end, and add a keyframe because I want it to be infinite. I want everything to be cracked. So here we are. On this frame, we don't have any cracks. On Frame 14, we don't have any cracks. On Frame 15, the cracks start appearing. And this is how this animates. I'll render this out and show you the result in just a few seconds. And through the magic of editing, here's the result. Now, you will see that the timing is not all that perfect, but that illustrates the point that this kind of revelation of the cracks can be fully art directable, and you can make it as good or as bad as you wish. Now let me switch over to the other one. So a bit more consideration was put into this in terms of the keyframing over the gradient revelation, and that's why it looks ever slightly better. You will get access to all the files from this tutorial series including this one, which is really nice so you can dissect it and find out all the little details. Well, thanks for watching. I hope you enjoyed this tutorial.
Resume Auto-Scroll?