Join Lee Lanier for an in-depth discussion in this video Adjusting shadows and matte edges, part of Maya Rendering for After Effects Composites.
We have motion-tracked the spaceship so it follows the camera movement within the original footage. We're now ready to move on and refine other aspects of the ship so that it better integrates with the background. Let's take a look at the footage and see what's going on so we can match it. Now, the background in terms of the building is actually quite soft. It's a little out of focus. Also, there is a lot of blue haze. The sun is up here at the right, and it's kicking a lot of blue haze in front of the building, and in front of the actress. So, it would be great to get that soft quality, plus a little bit of blue sneaking into the ship.
Now, in terms of the blueness, we can use the Opacity trick to achieve that. Basically, what we have is an empty sky. It's mostly the same color of grayish blue, little bit of brightness variation, but not too bad. Now, the fact that there are no objects behind the ship and we have a clear sky will allow us to reduce the Opacity and therefore introduce some of the blue into the ship's color. So, I am going to go to the Ship layer and set the Opacity to 85. That gives you illusion that there is some blue haze. Now, if you had a background where there were objects like telephone poles, this would not work, because those poles would show through.
What you'd have to do instead is apply some Color Grading tools like Color Balance or Curves to try to introduce that blue color. But we have the blue here, now we can start thinking about the edges and the overall softness. The ship is much sharper than the building, also its edges are sharper than the building. One thing we do for the body of the ship is simply apply a Gaussian Blur to soften that. So, with the Ship layer selected, I'll go to Effect > Blur & Sharpen > Gaussian Blur. Now, here the background is quite blurry, so we can use a fairly high blur.
I'll put a Blurriness of 2 in here to soften the ship. That softens the body of the ship, but doesn't really do with the edge. The edge is still pretty sharp, especially when compared to the top of the building. So in order to fix that, there are a couple of approaches we can take. One, we can apply effects to the matte which is applying the Alpha to try to soften that. The other thing we can do is perhaps add a mask to the top of the building to better fit the ship to the building and also feather that edge even more right here. Before we do that, though, let's play it back and make sure the ship is really motion tracking correctly to the very top of the building. Now in fact, there is a little slippage.
The ship is slipping to the right. See, right here, there is a gap opening up where that little cut-out is. Now, since we applied the tracking data to Null, we're free to adjust the position of the actual Ship layer. In this case, I think we have to keyframe it. Now the reason the ship is slipping is in Maya, we roughed in the perspective in terms of the camera position and rotation, but we never animated the camera. There is no camera animation. You potentially have slippage when the real-world camera's moving quite a bit. I have worked at this footage in advance.
I believe a good place for keyframes is on frame 0, 10, and 25. So, let's look at frame 0. Let's make a mental note that this edge of this cut-out should line up with this edge of the building right here. So, I'm going to set a key here by clicking on the Time icon for position. I am going to move the frame 10, then, and figure out how to get that edge back to left. So, in this case a Position of -14 in the X and 6 in the Y works pretty good, so here is frame 0, here's frame 10.
Actually, 6 in the Y maybe brings it down a little bit too much, so here you see a tiny gap on top of the building. Actually, what we might want to do is leave it here on frame 10 where it intersects a little bit, go back to frame 0, and adjust that. So in this case, you actually want a positive 4, so 04. So, it looks like the same relative position. The ship is tipping down a little bit into the building edge. There is Frame 10, and then also frame 25. So in frame 25, we can enter -24 and 8.
So now if we play it back, it's lined up with the builder better. Now, it's off the slippage but doesn't deal with the fact that there is a sharp edge here, and it dips down a little bit. So, in order to soften the edge, there are two approaches that we can take. One again is to go back to the matte and adjust that, and second one is to add a garbage mask to cut out the very top of the building, that's where the ship overlaps. So let's adjust the matte. I'll go to the matte layer, and we'll apply two effects we have used before, Gaussian Blur and also Curves. I'm going to increase the Blur, let's try 3.
And the advantage of that is you can already see that the upper edge of the ship is slightly blurred. That's actually good. We want that a little bit soft. Now in order to expand or erode the matte, I can adjust these curves here. For example, if I pull it down, it erodes it a tiny bit. That's good. I don't want to wind up with that little dark edge, so about there looks pretty good. Now, that makes the upper edge look great, but we still have the problem with the top of the building. So there we're going to switch over to the garbage mask, cut out the excess. In this case, it's going to go on the Ship layer itself. So, picking the Ship layer, I'm going to go up to the Pen tool, and draw a mask that represents the top edge of the building.
We're going to do fairly rough at the start and then refine it. We'll go fairly wide as the ship does move. Then I'm going to close the mask. Now, as soon as I do it, it cuts out the top of the ship, so we want the opposite result. So I'll go down to the Mask section and on Mask 1 set that to Subtract. There we go! Now, the mask will make a hard edge still. So what I can do though is go down to the Feather and put a Feather in--say, 4. I'm going to hide the Mask now. So that's giving me a nice, soft edge. So basically I just need to adjust the mask so it looks like it lines up in the correct place.
I'm going to do that by grabbing the Selection tool, then hide the Mask. Now, there is a little bit of blue tracked in the top of the building, that's okay. But now we have achieved the soft edge there. Now you don't actually have to rotoscope this over time, in other words, you don't have to keyframe this. What has happened is we have applied the mask to the Ship layer. The Ship layer is inheriting the motion of the building through the motion tracking. Remember, we motion-tracked the building lights right here, and then the other ones in left. So, that's the motion of the building, which is of course applied by the camera.
But the building is moving through the view. The motion is applied to the null, the ship follows the null through parenting. Therefore, the mask inherits the motion of the building. Therefore the mask is always in the same place relative to the building, and we don't have to keyframe it. Let me play it back as an example. So, you can see that mask is relatively in the same position to cut out the ship where it crosses over the building. So now we fixed the edges on the ship, one last thing we can do in this movie is add the shadow back. Now the shadow is trapped in the matte layer, which we're only using for a matte now.
But what we can do is duplicate this layer, Edit > Duplicate, and use that copy as a new shadow. I'm going to turn it on so we can see it. Now, first thing we need to do is reverse the mask to get the shadow back. So, I can go down to the mask and change that from Subtract to Add. Now next thing I need to do is go to the end of the timeline so I can see where the shadow appears, and there it is. Now what I need to do is make sure it gets inverted. I want a black shadow on white. So I'm going to go up to Effect > Channel > Invert. Then I can multiply it through a blending mode against everything below it.
So I'm going to go to the blending mode and change that to Multiply, and there is a shadow over the building. Now it's extremely hard edge, so I'm going to soften it. I'm going to apply a Gaussian Blur. I can put a very large blur number in here in terms of Blurriness to really soften that out. Now, it's still extremely dark and heavy. So what I can do next is reduce the Opacity of that matte layer. So I'm going to reduce that to 20. And this is barely in there, here's with the shadow, here's without. Now, if I want to continue to fine-tune the darkness, I can go up to the Curves, it's left over from the duplication of that matte layer.
If I adjust this, this will affect the overall brightness and darkness. Of course, we can also adjust the Opacity. Let's try the Curves. So there it's getting a little bit darker. Let's play it back. So notice soft channel is coming over the edge. Well, it still looks a little too heavy to me. So I'm going to reduce the Opacity to 10%. The idea is you want the ship to look like it's blocking some of the light, but not casting a super-hard shadow. All right! So we have adjusted the matte edge on the ship, we prevented the sliding by animating the position, we have introduced some blue into the ship by reducing the Opacity, and then we added the shadow back.
So now we're ready to move on to the final steps where we improve the integration even more.
- Working with image sequences
- Matching the 3D camera to video footage
- Lighting models in Maya
- Splitting a scene into multiple render passes
- Batch rendering
- Recombining render passes in an After Effects composition
- Setting up motion trackers
- Refining layers with rotoscoping
- Adding blur and effects
- Adjusting shadows and matte edges
- Using color correction
- Stabilizing shaky video