Lens ditortion data export for NUKE

Hallo everybody,

If I’ve rightly understand, with default settings, Mocha make a lens distortion correction automatically, before tracking. I say that because, if you make a corner pin tracking, at the end of the process, you can export corner pin data selecting “Remove lens distortion”. It should mean that Mocha apples a Lens distortion correction (with Lens panel default setting )before tracking. Is it right?

And if is it right, I’d like to know how can I export in Nuke the Lens distortion data. I see in documentation"Exporting lens data" the mocha Lens fo AE. There are also Distortion map clip and Imagineer Lens Data but I don’t know which is good for Nuke. What I’ve to do in Nuke is to use Lens distortion data ti distort corner pin image o 3d render to match de original distorted plate.

So, what do you suggest?

Hi Simone,

You need to first do a lens calibration in the Lens tab to obtain the right distortion. This must happen before the tracking, because the warp needs to be applied to make the tracking distort correctly.

Once you have your Lens calibrated and the tracking done, you need to render a Distortion Map and use the STMap node in Nuke to apply the distortion correctly (or remove it, depending on what you are trying to do).

Take a look at this video to see more:

Hi Martin
I thought Mocha did, however, automatically, a Lens correction (but only with default Lens panel settings ).
Anyway, if I’ve rightly understand, I’d like to know if this workflow is correct to Nuke - Mocha integration. For example, about a Corner pin or Mask Shape, the best practise should be:
In NUKE
1 - Convert plate footage in a sequence as .TGA. EXR. PNG… (without any Stabilization and Lens distortion correction!) ;

in MOCHA
2 - Import sequence in Mocha;
3 - Make a Lens calibration to obtain the right distortion;
4- Track your Corner Pin;
5 - Export tracked data for a compositing sw (AE or Nuke…), selecting “Remove lens distortion”!
6 - Export Distortion Map
again in NUKE
5 - Apply corner pin data to a image to see the corner pin effect on the plate;
6 - Distort Corner pin image to match it with the distorted plate sequence using STMap node;

7 - At this time, if you want, you can stabilize all…

Is this workflow correct?

Many thanks for a reply!

Mocha will not do an auto correction for the lens. You will need to calibrate it with the Locate Lines tool and give it some guides before calibrating.

From steps 5 onwards it depends on what you would like to do:
a) Insert a distorted image
b) Remove lens distortion entirely (undistort)

This will determine which distortion map you need.

Regardless of whether you want to remove the distortion from the image or place insert as distorted then you need to check the option in the tracking export (in your step 5). This will make sure that the insert you are applying the data to will match the undistorted plate when you apply the lens data. The only difference will be which footage you apply the data to: The original plate (to be undistorted) or the insert (to be distorted to match the plate).

Hi Martin,

okay now, it seems all clearer. Shortly, in Mocha (as well all 3d matchmoving software) Lens distortion process helps and improve the tracking process. But we need Lens distortion process also to distort the CGI elements inside compositing sw.

About step 5 onwards, what I’d like to do is to have e Distortion Map to import in NUKE to distort, for example, 3d render, Motion graphics, Text, Corner Pin, Mask Shape, and every kind of CGI you created to match with (distorted) original plate. (I include corner Pin and Mask shape in this list, cause we “Remove lens distortion” before export them ).

I see the suggested tuts (we need an update to Mocha 4 cause something is different… :wink: ) but I didn’t exactly understand how to export a Distortion Map to distort CGI elements in Nuke.

 

Thanks foa a reply!

 

 

 

 

 

 

Hi Martin,

I’d like to add another question. n the suggested tut she use a 1-Parameter to correct a very wide lens (Go PRO): But I thing we should be 2-Parameter for a not so extreme “fish eye” lens distortion…

 

2-Parameter distortion is required anywhere there is a wave in the lens, not just a barrel distortion.
The GoPro would fit this category, but sometimes the barrel distortion calibration can be enough. I personally would use 2-parameter distortion for GoPro Lens.

Okay Martin, many thanks.

There was still a question maybe you didn’t see (it was above my last post). I write it again:

"About step 5 onwards, what I’d like to do is to have e Distortion Map to import in NUKE to distort, for example, 3d render, Motion graphics, Text, Corner Pin, Mask Shape, and every kind of CGI you created to match with (distorted) original plate. (I include corner Pin and Mask shape in this list, cause we “Remove lens distortion” before export them ).

I see the suggested tuts (we need an update to Mocha 4 cause something is different… ) but I didn’t exactly understand how to export a Distortion Map to distort CGI elements in Nuke."

 

 

Right, so here’s how that workflow is going to run:

  1. Do your lens calibration in mocha
  2. Render the distort map in mocha (not the undistort)
  3. Apply the distort map to any CGI elements using STMap
You may need to use a Reformat node on the CGI elements if they are not the same dimensions as the original plate.

Here is another example from the Nuke workflow webinar we did a while back. I’ve skipped to the point where I start talking about the Lens module and STMaps:

 

 

(OT. Often, when I reply to this forum threads, it appears this error message: ERROR: Your reply cannot be created at this time.) ???

Great Martin,

many thanks! I have to post this my reply in different stocks, cause there are problem with forum (<strong style=“box-sizing: border-box; color: #1f1f1f; font-family: ‘Source Sans Pro’, Helvetica, sans-serif; font-size: 15px; line-height: 21px;”> ERROR: Your reply cannot be created at this time).

Normally I’m going to shot a grid checkerbox for every lens I use on set and maybe could a great idea to calibrate lens distortion with this grid instead the plate, which sometime doesn’t show a usable long perspective lines (as in your tut here above). So, if you have a grid from lens used, I think is the best practise to nake lens calibration on this grid and Export Distort map clip. But sorry, to complete this crucial argument, I have still some question about…:

 

It very hard to post… I 'm receiving all time this error: ERROR: Your reply cannot be created at this time.