lmWarpDistort Documentation

3D Equalizer v3 Lens Distortion : UFO and Lens Shader

Download

Softimage|XSI / mental ray lens shader.

Softimage|XSI 4.x UFO.

 lmWarpDistort.v1.0.xsiaddon.

lmWarpDistort.v1.0.zip - shader : dll, so, spdl - UFO : dll, so.

 

Original Image (A)
Directly rendered with standard PAL camera


Distorted Image with Lens Shader (B)
Rendered with lmWarpDistort Lens Shader: distortion=0.08

 

Disclaimer

The software is released as is, without any written or implied warranty. The software cannot be redistributed without permission from LaMaison. The program will not be supported. LaMaison is not responsible for any damage or loss of data incurred by the use of this software. lmWeightMapTools was developed by Aloys Baillet for LaMaison.

Introduction

This document describe the lmWarpDistort shader and the lmWarpDistortUfo FXTree node wich are used to distort images according to the 3D Equalizer v3 lens distortion model. You will find a mathematical description of this model created by Uwe Sassenberg, Head of R&D, Science-D-Visions , in this paper. The distortion parameters can be computed in 3D Equalizer v3, or can be tweaked from a photographed grid, for exemple.

The main parameter of these tools are the distortion value. It can be positive (Pillow effect), or negative (Barrel effect).

The lmWarpDistort shader is a Mental Ray lens shader that changes the rays directions according to its distortion parameters. This shader can only apply the distortion.
The main advantage of this shader is that it doesn't crop images when the distortion is applied: rays are just distorted (see Image B).

The lmWarpDistortUfo UFO is a custom FXTree node that applies or removes distortion in an image.
Be careful that if you apply positive distortion or remove negative distortion with this node, areas that are not in the original image will be considered black and curved borders will appear in the computed image (see Image C).
The main use of this UFO is to remove distortion of an image sequence (to use them in camera mapping, for example).

 

Distortion applied on Image A with UFO (C)
Notice the black borders


Distortion removed from Image B with Ufo (D)
 

 

Installation

Add-On: Just Drag&Drop the addon in a XSI viewport.

Shader only: Click on File->Add-On->Plugins(SPDL)... and click on Install, select the lmWarpDistort.spdl file and click on install.
You can also run the following command in a XSI command prompt: xsi -i lmWarpDistort.spdl.

UFO only: Just copy the file lmWarpDistortUfo.dll in your %USER%\Application\fx\ufos directory.

lmWarpDistort Lens Shader Use

Connecting The Lens Shader

First, select the camera you want to apply the lmWarpDistort shader to. If one of your viewport is set to this camera, you can click on the little camera icon on top of the viewport, and choose "Properties" to view the Camera Property Page (PPG) and select the "Lens Shader" tab.
Click on the "Add" button, and select the lmWarpDistort shader in your file system.

There you go! The Lens Shader is applied to the camera, and you should see it in the Lens Shader list.
To edit it's properties, select it and click on the Inspect button.

You have to know that this lens shader will change the ray direction according to the distortion parameters. Thus it is not usable with the "Scanline Rapid Motion" Mental Ray optimization mode.

Lens Shader Parameters

lmWarpDistortUfo FXTree Node Use

Getting the Ufo

First, open the FXTree (Application->Layout->Compositing for example).
Click on Ops->Plugins[U]->lmWarpDistortUfo. NB: if you have installed the UFO in a workgroup, you will find it under Ops->workgroup[W]->lmWarpDistortUfo.



Click on the green (e) or double click on the node to show the lmWarpDistort Property Page.

FXTree Node Parameters


Notes

When using the lens shader, be careful that the more you increase the distortion, the more you will put in your final image parts of your 3D scene that you don't see in the camera viewport.

If you look at the 3D Equalizer Lens Distortion Model, you will notice that applying the distortion to an image involve the numerical inversion of a 2D function. Thanks to a nice mathematical trick, the lens shader can apply the distortion function WITHOUT the numerical inversion (the function is geometrically inversed). As a result the image computed with the lens shader will be more accurate than if you apply the distortion with the UFO.