Using ctl render on Windows (with Ubuntu)

Tags: #<Tag:0x00007f63348b2f88> #<Tag:0x00007f63348b2e70>

Hello,

as part of the effort for the Output Transform VWG, I wanted here to detail the process to convert images using the ctl reference code. This post is a transcript of the conservation held on rocketchat with @sdyer, @Alexander_Forsythe and @nick.

There is a certain need for accuracy when reviewing images processed with the ACES Output Transforms, that it is not available currently in OCIO V1. Hence the need to process the images using CTL.

You may start by installing the Ubuntu 20.04 LTS from the windows store for free. You do need an hotmail account though to download and install it.

Once you’re done, you may open a terminal and follow these steps :

# Update apt and install dependencies
sudo apt update
sudo apt-get install cmake libilmbase-dev libopenexr-dev libtiff-dev build-essential -y

# Build and install aces_container
cd ~
git clone https://github.com/ampas/aces_container.git && cd aces_container
mkdir build && cd build
cmake .. && make && sudo make install

# Build and install ctl
cd ~
git clone https://github.com/ampas/CTL.git
cd CTL
git fetch origin pull/73/head:pr-73
git checkout pr-73
mkdir build && cd build
cmake .. && make && sudo make install

# Get ACES CTL files and add lib directory to CTL_MODULE_PATH environment variable
cd ~
git clone https://github.com/ampas/aces-dev.git
export CTL_MODULE_PATH=~/aces-dev/transforms/ctl/lib

Please note that this script from Alex Forsythe is a temporary fix. And also that the last command

export CTL_MODULE_PATH=~/aces-dev/transforms/ctl/lib

needs to be run every time you open a new terminal. The command is only active in the terminal where it is activated. If you wanted it to persist, you’d need to put it in your shell startup (it’s just an env variable that shows where it should look for ctl modules, import files, etc). Or you could also add it to your bashrc file.

Now the command to convert AP0 exr files to Output - Rec.709 (ACES) tiff is this :

ctlrender -ctl /path/to/ctl/rrt/RRT.ctl -ctl /path/to/ctl/odt/rec709/ODT.Academy.Rec709_100nits_dim.ctl /path/inputImage.exr /outputpath/outputImage.tiff

You’d need to use your actual local path to the CTL. Same thing for the Rec.709 (ODT).

~/aces-dev/transforms/ctl/rrt/RRT.ctl

The command may look like this :

ctlrender -ctl /home/yourname/aces-dev/transforms/ctl/rrt/RRT.ctl -ctl /home/yourname/aces-dev/transforms/ctl/odt/rec709/ODT.Academy.Rec709_100nits_dim.ctl /home/yourname/aces-dev/images/RenderPass_Beauty_All_Beauty_1_00001.exr /mnt/c/Users/Home/Documents/ctl/test3.tiff

This command expects AP0 exr files. The RRT expects linear AP0 (aka ACES). The flie format could be something else technically but will almost always be exr in practice.

You can stack up as many CTLs as you need. So you could have IDT -> LMT -> RRT -> ODT, each as a CTL, in which case the appropriate input would be e.g. LogC. Or if your EXR was ACEScg, the first CTL would be the ACEScg to ACES CSC.

A few extra notes :

  • You sometimes need to add -param1 aIn 1 or you get an error saying aIn has no default value if your input image is RGB only.
  • You can also add -format tiff8 to get an 8 bits tiff file, it would only affect the output format.
  • You can also try adding a -v flag and see how far the verbosity report gets.
  • If you think there is a permission issue, you may try this command on the output folder :
    chmod ugo+rwx images/
  • ctlrender -help is also a commande that can be useful if you’re having issues.

Hopefully, processing images in ctl is now a bit easier for window users,

Chris

2 Likes

Worth also noting that the simplest way to get the correct path for your image files is to open the shell in the image directory. You do this from Windows by shift-right-clicking in Windows Explorer, and choosing “Open Linux shell here”.

Thanks Nick, I completely forgot about that part. :wink:

So far, I have been converting AP0 exr files to 8 bits tiff without any issue. I got a couple of segmentation fault on one exr, but fiddling in Nuke and re-exporting the AP0 exr fixed it for me.

Update : The segmentation fault came from a difference between the dataWindow and displayWindow in the exr. You need to crop the exr to fix it.

dataWindow (type box2i): (0 129) - (1919 950)
displayWindow (type box2i): (0 0) - (1919 1079)

I guess the next steps for me would be :

  • Try to add more ctl conversion, like AP1 -> AP0 -> Rec.709 (ODT)
  • Try to play with the ctl code of the GM VWG (to get the ARRI and RED Transforms)

Chris

The ARRI and RED display transforms are only available as LUTs. There is no CTL implementation for either.

Okay cool. Thanks for the clarification !

Actually, they ask you to login but you can close the window and it works :slight_smile: I have installed Ubuntu myself without using any Hotmail account.

Thanks @oktomus ! I didn’t know about this trick and would have saved me from creating an hotmail account. :wink:

A couple of updates on ctl with Ubuntu :

  • If you want to use aces 0.1.1 for testing, you just go into the aces-dev repo and do a git checkout v0.1.1 (assuming you have a copy of the aces-dev repo downloaded locally)
  • git checkout dev will take you back to the HEAD (back to “normal”).

From the command lines from the previous posts of this thread (shared by Alex), you should normally have a local copy of the aces-dev repo downloaded locally.

A couple of notes, the folder structure and naming between 0.1.1 and 1.2.0 have changed. So you will need to adapt a couple of things.

For the CTL_MODULE_PATH, you should do with aces 0.1.1 :
export CTL_MODULE_PATH=~/aces-dev/transforms/ctl/utilities

Or even better, so it works with both versions (0.1.1 and 1.2.0), with a colon separator :
export CTL_MODULE_PATH=~/aces-dev/transforms/ctl/utilities:~/aces-dev/transforms/ctl/lib

And since there are some minor changes in the terminology, here is the command for 0.1.1 :

ctlrender -ctl /home/yourname/aces-dev/transforms/ctl/rrt/rrt.ctl -ctl /home/yourname/aces-dev/transforms/ctl/odt/rec709/odt_rec709.ctl /yourpath/light_sabers_004_lin_ap0.exr /yourpath/light_sabers_004_ctl_rec709_0.1.1.tiff -format tiff8 -force

You can se that RRT used to be written rrt and that the name of the odts were shorter as well.

Neat !

I will lock this thread and add a note that it is out of date once these instructions are no longer relevant.

Cool, keep me in the loop with the new instructions if you can. I am actually enjoying a lot ctl.

Thanks !

I think it’s generally a better idea to put environment variables is .bash_profile instead of .bashrc since .bashrc is used for non-interactive shells.

You can add it to the file by replacing my final export line with
echo 'export CTL_MODULE_PATH=~/aces-dev/transforms/ctl/lib' >>~/.bash_profile

Note, if you’re using zshell you should put it in ~/.zshrc

Thanks Alex ! I’ll need to look into that ! Another interesting command I found is if your exr is ACEScg and not ACES2065-1. You may do the following :

ctlrender -ctl /path/aces-dev/transforms/ctl/csc/ACEScg/ACEScsc.Academy.ACEScg_to_ACES.ctl -ctl /path/aces-dev/transforms/ctl/rrt/RRT.ctl -ctl /home/chrisb/aces-dev/transforms/ctl/odt/rec709/ODT.Academy.Rec709_100nits_dim.ctl /path/RenderPass_00001.exr /path/RenderPass_00001.tiff -format tiff8 -force

Regards,
Chris