Extend edges with iDistort in nuke

nuke extend edges

Extractions are all about the edges, and when you are trying to recover that edge detail that was lost or you have those bright edges around your subject, a usefull trick is to extend the pixels to “fake” edge detail. In this tutorial i am going to show you how you can use the iDistort and matrix nodes to extend the edges of your images.

Extract the subject and blur it

nuke roto blur

The first step is to create a mask and blur it either using a blur or an edge blur. You can do the extraction with a keyer or just using a roto as I did in this example.

nuke shufle

Now create 2 shuffle nodes. One will shuffle the alpha to the rgb channels and other with black in all channels.

Matrix nodes

nuke matrix

Create a Matrix node and enter the values you see in the image, selecting only the red channel. This will create a ramp for the “x pixels” that we can later use to extend the pixels in that direction. Use a copy node to add the red channel to the the “black shuffle” stream.

nuke matrix green

Create another Matrix node but this time using the green channel and using the values in the image. If you check the output of this node, viewing the green channel you will see an edge ramp of the “y pixels”. Now copy to the green channel.

Grade the channels

nuke grade

The next step is to grade the created channels, use something like 300, later you can change this value if needed. The most important thing here is to uncheck “black clamp”, so we don’t lose the negative values.

copy to motion channels

Now create a new copy node and copy the red and green channels to the forward.u and forward.v.

The iDistrot node

nuke idistort

Finally we can create an iDistort node, select the motion channel and play with the UV Scale to extend the edges of our subject.

Final result

nuke extend edges

Experiment with the blur/edge blur, grade and UV Scale values and try to get the best result. Let me know if you find this useful, leave a comment below.

  • Jorge Miranda

    Nice Trick ! Thanks !