You can export lens maps (ST map as a 32-bit EXR file) for calibrated video cameras from Shogun Live as distortion maps. You can then import your calibrated video camera/lens into a game engine such as Unreal, or into your compositing software.
The ST map contains information about the distortion of the lens and has four channels: R, G, B, and A:
-
B and A store the location of the pixels in a pinhole/undistorted image, ranging from 0 to 1 in proportion to the width and height of the image. These two channels are used to distort the CG image to match the SDI camera output.
-
R and G store the location of the pixels in a raw/distorted image (currently unused).
To use a Shogun Live ST map, the first step is to export it from Shogun Live.
See also the Vicon video How do I set up a Vicon-driven cine camera in Unreal Engine with lens distortion?
Export an ST map
-
Ensure the video camera(s) have been calibrated, then from the File menu, select Export Video Camera STMap
. -
In the Save Camera Distortion Map dialog box, locate a folder to which to export the ST maps.
ST maps for all video cameras are exported to this folder.
Each filename has the format: <Camera DeviceID>_<focal length in pixels- integer part>_<focal length in pixels - decimal part>_<date time stamp>.exr, for example,
vi101_1064_535479_20210623165749.exr
.
The ST map contains information about the distortion of the lens and has four channels: R,G,B,A:
-
B and A store the location of the pixels in a pinhole/undistorted image, ranging from 0 to 1 in proportion to the width and height of the image. These two channels are used to distort the CG image to match the SDI camera output.
-
R and G store the location of the pixels in a raw/distorted image (currently unused).
This is an example of an ST map:
You can use the exported ST maps in a number of ways, including in game engines such as Unreal Engine, or in compositing software. The following example shows how to use the ST map to set up a live composure in Unreal Engine, using the Virtual Production template project.
Set up a live composure in Unreal Engine
-
In Unreal Engine, to import the ST map into the content, right-click to create a new subfolder in the content folder
. -
Browse to the new folder, right-click and select Import to /Game /Distortion Maps to import the ST map that you exported from Shogun Live.
-
In the Import dialog box, locate and select the ST map file.
The ST map is displayed in the Content Browser.
-
In the Content Browser, navigate to Content > VprodProject > Maps and double-click the LiveComp map.
-
In the Content Browser, navigate to Content > VprodProject > Materials and double-click the M_Live_Comp material.
-
Expand the note and right-click to add a new TextureSampleParameter2D node to the graph:
-
Give the node an appropriate name:
-
With the node selected, in the Details panel, find the Material Expression Texture Base.
-
Click on the default texture to browse for the ST map and start typing the name of the file.
-
Drag from the UV's pin on the FG (foreground) node:
-
Add a new AppendVector node:
-
To 'undistort' the foreground layer in this example, connect in this way:
-
Save the asset: