- [Instructor] The CornerPin node is most often used
to do monitor insert shots,
so it's designed to be linked to tracker data.
The idea is to first track the corners of the monitor
and then export a CornerPin node from the Tracker Node
that has the links all setup.
We'll learn more about the Tracker node shortly
in the tracking and stabilizing lesson.
So in this Nuke script,
the Tracker node already has all the tracking data,
so we'll just worry about how to hook up to it.
The element that you're tracking into a monitor
can be any size, but it should be
at least a little larger,
otherwise you'll be stretching it up, and it'll get soft.
One key point on corner pinning and tracking!
The order of the trackers is critical.
The corner pin expects track 1
to be in the lower left hand corner,
then two, three, and four, in that order.
You get it wrong, and you'll twist up your corner pin.
Another key point.
Let's look here on track 1, we'll push in.
And you'll note that the tracker
is not sitting right on the corner
where I want my element to end up.
This is a very important point
because the tracker has to collect the best tracking data,
not the final position of the element.
So you put the tracker where you get the best data
and then there's an offset to adjust the element
to fit exactly where you want.
So I'll rehone the viewer,
and we're ready to export our CornerPin node
from the Tracker node.
The first step is to select all four of the tracks.
So I'll select the top one
and then Shift + click on the bottom one.
Come down to the Export section here,
click on the pop-up, and just make sure it's set
for CornerPin2D (use current frame).
We'll click create, and here's my new CornerPin node.
I'll hook that up to my graphic,
and now we're going to need a Merge node
to comp it over the background.
So with the CornerPin node selected,
I'll type M on the keyboard to get a Merge node,
and hook that up over my background.
I'm done with the Tracker node,
I'm going to fold that up for now.
And in the Merge node, in order to see what I'm doing,
I'm going to set the mix to 0.1
so that we can see our target back here.
Now if I play it right now,
you'll see that my element is moving with the background,
but it's not properly positioned.
The reason is that the from, or source,
has not been properly set yet for the corner pin.
So let's open up the CornerPin node
and here's our problem right here.
The CornerPin node is based on the concept
of source and destination.
The source is this corner of the graphic,
and the destination is this corner of the monitor.
In Nuke speak, that's from and to.
So the to is the destination, and the from is the source.
By default, when exported from the Tracker node,
the CornerPin node has the same data
in the from and the to.
So to fix that, all we have to do is come down here
to set input and click on that, and that resets the position
of all of the from points to be correct.
Now you recall earlier that the tracker on point one,
down here in the corner, was not as the corner of the bezel.
It was over here.
And you'll see that my graphic element
has landed right on top of it.
This is what you want, because now we can come over
to the From tab, and remember, this is point one,
and I can now dial in the position of this guy
with an offset and this is the way
it's designed to be worked.
There!
Now point one is properly set in the corner of the monitor.
I'll zoom out, move over,
and let's dial in point two.
Point two, X,
point two, Y.
Zoom out, pan over, zoom in to point three.
Dial that in.
Okay, zoom out.
Zoom in to point four, this is way off.
Okay, no problem, we don't, that's not a problem.
So we'll dial that guy in there in X and in Y.
Okay, rehone the viewer.
Alright, on frame one, everything looks copacetic, okay.
However!
With 2D trackers there can be drift.
And so if I play this clip,
you can see that point four in the upper left hand corner
is drifting noticeably over the length of the shot.
Not a problem.
Stop this, jump to frame one.
I'll zoom in here to point four.
So on the From tab, point four,
we're going to have to do a little key frame animation.
So we'll, first of all, we'll tell point four
to set a key frame,
then we'll jump to the end of the shot,
we see how much it's drifting.
And now, I'll put in a second key frame here
to correct for the drift.
There we go.
I'll hone the viewer and I'll play.
And now that point stays locked on the target quite nicely.
Of course, if you have to,
you can add one or two control points
in the middle of the shot.
And of course, you're going to check all four corners
for any drift.
If I go back to my merge node,
and turn off my mix, we can now sit back
and admire our shot.
Very nice, alright, we'll stop that.
On the CornerPin2D tab,
you'll find your motionblur controls.
So like all transform nodes in Nuke,
it has all the same motion blur controls
as any Transform node in Nuke.
Monitor insert shots are a staple
of our visual effects works.
So mastering tracking and corner pinning is very important.
While the CornerPin node is optimized
for being driven by tracking data,
you can of course use it by itself on a static shot
by just dialing in the to and from positions
for each corner.