ldpk
LDPK - The Lens Distortion Plugin Kit

About

The current version of LDPK is 1.10.1 The PDF-document contains some information on the underlying mathematics of the built-in lens distortion models.

Files

A list of files can be found here. We left out some of the less interesting files in the documentation directories.

Binaries

As of version 1.6 of the $LDPK, only 64-bit architectures are supported. For each of the supported platforms there is a simple program in $LDPK/bin which you can use in order to check, if your plugin is accepted by the executable. They have been compiled on the same platforms using the same compiler as 3DE4. These binaries are:

Python

As of version 1.6 of the LDPK there are python bindings for the five built-in lens distortion models (OSX, Linux):

In $LDPK/source there is a source tde4_lens_distortion_plugins.module.C for building python bindings. If the pre-compiled version does not meet your requirements you can compile them yourself. In order to do this please run the appropriate script make_python_bindings.<arch>.csh in $LDPK/script. The make-script will create a file named $LDPK/python/<arch>/lens_distortion_plugins.so. If you move this to an appropriate location, you can import this in python e.g. with

import lens_distortion_plugins as ldp

Please have a look at the sample programs in $LDPK/python and read this document.

Nuke

As of version 1.7 of the LDPK there are compiled plugins based on the five built-in lens distortion models for various versions of Nuke (from The Foundry) In the documentation and in 3DE4 we will refer to these nodes as the LD_3DE4 Lens Distortion Nodes or briefly the LD_3DE4 nodes.

They are fairly easy to install, you simply copy them to your Nuke plugin directory. Currently, Nuke versions 7.0, 8.0, 9.0, 10.0, 10.5 on Linux, OSX and Windows are supported. The Nuke node for the recently add model LD_3DE4_Anamorphic_Rescaled_Degree_4 is available on Linux for Nuke 10.0, 10.5 and on OSX and Windows for Nuke 7.0, 8.0, 9.0, 10.0, 10.5. If you need to compile the Nuke plugins yourself, please have a look at the scripts make_nuke_nodes.<arch>.csh in $LDPK/script. Please insert the paths to your Nuke installation directory and consult The Foundry's documentation for the appropriate compiler version. If you miss support for any version of Nuke here please let us know, we will add this if possible.

menu_nuke_ld_3de4.png

We have modified $NUKE/plugins/menu.py as in the following code snippet, but you may handle this according to your needs. Also, it might be helpful to consult Nuke's documentation about adding commands to the GUI.

nuke.menu("Nodes").addCommand("3DE4/LD_3DE4_Anamorphic_Standard_Degree_4", "nuke.createNode('LD_3DE4_Anamorphic_Standard_Degree_4')")
nuke.menu("Nodes").addCommand("3DE4/LD_3DE4_Anamorphic_Rescaled_Degree_4", "nuke.createNode('LD_3DE4_Anamorphic_Rescaled_Degree_4')")
nuke.menu("Nodes").addCommand("3DE4/LD_3DE4_Anamorphic_Degree_6", "nuke.createNode('LD_3DE4_Anamorphic_Degree_6')")
nuke.menu("Nodes").addCommand("3DE4/LD_3DE4_Radial_Standard_Degree_4", "nuke.createNode('LD_3DE4_Radial_Standard_Degree_4')")
nuke.menu("Nodes").addCommand("3DE4/LD_3DE4_Radial_Fisheye_Degree_8", "nuke.createNode('LD_3DE4_Radial_Fisheye_Degree_8')")
nuke.menu("Nodes").addCommand("3DE4/LD_3DE_Classic_LD_Model", "nuke.createNode('LD_3DE_Classic_LD_Model')")

In $LDPK/3de4/python you will find an export script named

export_nuke_LD_3DE4_Lens_Distortion_Node.py

which you run from within 3DE4. In order to do this please copy it into your 3DE4 installation, at $TDE4/sys_data/py_scripts/. In 3DE4's GUI the script appears in Main Window -> 3DE4 -> File -> Export

menu_3de4_file_export.png

In addition to the seven built-in parameters and the model-specific parameters the plugins have four parameters which allow to specify the field of view as defined in 3DE4:

Default values are 0,0,1,1. By definition, the field of view in 3DE4 corresponds to the area represented by filmback width and height. In contrast to previous solutions, field of view is now taken into account.

Classes

The LDPK contains various classes. It is important to know that most of them are not required in order to develop a plugin. In the following we will classify all classes according to their importance. Note that you only need one API class in order to develop a plugin with at least basic functionality.