Re: Color space transformation issue (first-time user)


Michael Dolan
 

Hi,

Apologies for the slow response. Are you certain that your rendered image is in the "lnh" space? "lnh" is a linear space with sRGB/Rec. 709 primaries. Since all transforms in OCIO are relative to a specific reference space, knowing exactly which color space defines your source encoding is critical to producing correct results. Also, in the spi-vfx config, the "sRGB Film" view is not the canonical sRGB transform, but a film emulation LUT, intended to be viewed on an sRGB device. This is described somewhat in the OCIO docs:

srgb8 bakes in the film3d emulation lut. This table can be used for either QuickTime generation or output to the sRGB display. The transformation is a 3d film emulation table with gray balance compensation, so a value of 445,445,445 in lg10 space os modified to become equal RGB values in sRGB. Additionally the lut is scaled so that at least one of the color channels on maximum white uses the display max.
 
The transformation takes place in three parts. First the linear data is converted to the show log space. Then a film emulation table is applied. Then the grey balance and white scaling compensation are applied. This table is designed to be evaluated in a dimly lit office environment on a sRGB display.

The API differences you are seeing are because it looks like you pulled from the OCIO Github master branch, which is the OCIO v2 development branch. If you pull the source from a release tag (i.e. v1.1.1) the API will be consistent with the docs you found on opencolorio.org. Note that the website and docs are being overhauled for v2, so things are changing a lot right now.

If you know your input is sRGB linear, and you want non-film-emulation sRGB, I would recommend you use the newest ACES config:
https://github.com/colour-science/OpenColorIO-Configs/tree/feature/aces-1.2-config/aces_1.2 

Set your source to "Utility - Linear - sRGB" and your dest to "Utility - sRGB - Texture". That will result in only the sRGB EOTF being applied to your image.

Thanks,
Michael

On Thu, Aug 6, 2020 at 3:18 PM silverlann via lists.aswf.io <silverlann=googlemail.com@...> wrote:
Hello all!

I'm using a renderer which outputs images in linear color space with HDR colors (16 bit), and I want to use OCIO to apply tone mapping +gamma correction to these images to convert them to sRGB space, but I'm somewhat uncertain on how to approach this. There are some usage examples on https://opencolorio.org/developers/usage_examples.html , however they appear to be outdated, as some of the functions used in them (like "getDefaultDisplayDeviceName" or "getDisplayColorSpaceName") do not exist anywhere in the code base.
I ended up using the "ocioconvert" app shipped with the repository as a base instead, but I'm still not entirely sure on how to go about it.
For my test program I've loaded the "spi-vfx" configuration (https://opencolorio.org/configurations/spi_vfx.html) and tried setting up the color space transformation for my image like so:
OCIO::DisplayViewTransformRcPtr t = OCIO::DisplayViewTransform::Create();
t->setSrc("lnh");
t->setDisplay("sRGB");
t->setView("Film");
processor = config->getProcessor(t);
The input color space is "lnh", since my input colors are 16 Bit HDR colors in linear color space.
"display" and "view" are set to "sRGB"/"Film", which, as I understand it, should transform the colors for output on a sRGB display.

The program runs without any errors, but after the transformation the output image mostly just looks very milky: https://i.imgur.com/AL861bG.png
I've had similar results with other configurations. My understanding of color management is still somewhat limited, so I'm not sure what I'm doing wrong, any guidance would be much appreciated!

Here's my test program code with the input image and executable (Windows), if needed: https://www.dropbox.com/s/u29bcl5dbui6xam/ocio_transform_test.zip?dl=1

Thank you!

Join ocio-dev@lists.aswf.io to automatically receive all group messages.