Calibrate, correct and remove lens distortion with Mocha Pro's Lens Module.
Wide angle lens or even common lens distortion can cause unpleasant hurdles when working
on visual effects.
Removing or matching the lens distortion can improve tracking and roto tasks and produce
more realistic composites and object removes.
It can also help dramatically reduce pain points when doing rotopaint work.
Mocha Pro’s simple and easy-to-use interface allows users to calibrate the distortion introduced
by camera lenses.
Unwanted lens distortion can be removed or matched for realistic compositing.
To compute the lens distortion you need an image with one or more distorted straight
lines, an in-camera grid, or a previously generated distortion map.
First, check your source material to see if it has suitable lines or, if your production
team thought ahead, you can use an image of a grid filmed with the same camera your footage
was shot with.
In the Lens tab, you can automatically generate line segmentations to calibrate the lens information
by using the Locate Lines button here and then selecting the New Line button to join
the lines that you know should be straight.
OR new in Mocha Pro 2022.5, we can use spline-based calibration with hand-drawn open splines.
To use splines, simply click “Use Layer Splines.”
Now I can draw X-splines along lines that I know should be straight in the scene.
The spline tools create open splines by default when drawn in the Lens Module and the process
cogs are turned on by default as well.
Next, I’ll choose what type of distortion is present in the scene.
Using either barrel or fisheye radial distortion models will allow you to straighten up the
image for most scenes.
Barrel distortion is a single spherical correction, so select the 1-parameter option for this
type of distortion, while fisheye is a double spherical distortion that is typical for wide-angle
shots, so we would select 2-parameter distortion for this option.
There is also an Anamorphic model that will accurately model the distortion of anamorphic
or extreme wide-angle lenses, and an equirectangular option typical for 360/VR videos.
Selecting Distortion Map will allow you to calibrate with an existing imported ST Map.
Once I have selected the lens type, I can click “Calibrate” here.
If we want to check the calibration, I’ll either create a new Mocha layer and enable
the grid OR render an undistorted frame in the Lens module.
If the curved lines appear flat, you have a good calibration.
After calibrating the lens, other Mocha modules like tracking, insert and remove will work
more accurately.
Also new in Mocha 2022.5 is the ability to save and import Lens calibration.
Save the Lens data and import it into a new project if you are working on multiple shots
with the same lens settings.
And if you have a Distortion Map generated from another program, you can import it into
Mocha and then use it to assist the Mocha modules in the same way.
If you are running the Mocha Pro standalone application, you can export distortion map
data, sometimes called ST maps, for Nuke, Flame, Fusion, and more.
To export lens data, click “Export Lens Data” and choose the “Distortion Map Clip”
option in the dropdown, choose whether you are exporting the undistort or distortion
map using the radial buttons, and choose your file location and format.
Click save, and your ST Map will be rendered to the location you chose.
You can also export Mocha XML lens data from this dropdown menu for use on similar Mocha
shots, use the “Import Lens Data” to bring this information back into sister shots, or
import ST maps from other software.
If you are using the Mocha Pro plug-in, you can apply or remove lens distortion directly
in the in-host app.
To remove distortion in the plugin, twirl down the “module renders” section in the
Mocha Pro plug-in interface.
Now click the render checkbox and select lens: distort or lens: undistort from the dropdown
menu depending on whether or not you need to apply or remove the lens distortion to
that clip.
The results will render directly to your timeline in whatever host software you are using.
The Lens Module can assist advanced Mocha Pro functions that perform rendering operations
such as Remove, Insert, and Stabilize, and is an essential part of our VFX toolbox.
Find out more about Mocha Pro and the Lens Module at BorisFX.com, where you can gain
access to support, user forums, tutorials, and so much more.