openexr-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Openexr-devel] playexr lut table and black levels


From: Gonzalo Garramuño
Subject: [Openexr-devel] playexr lut table and black levels
Date: Wed, 22 Feb 2017 09:12:46 -0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0

Hi,

My viewer (mrViewer) uses part of the code used in playexr to create the lut table for CTL transforms. This lut is created in log space, like ( as the playexr explains ) :

    //
    // We build a 3D color lookup table by running a set of color
    // samples through a series of CTL transforms.
    //
    // The 3D lookup table covers a range from lutMin to lutMax or
    // NUM_STOPS f-stops above and below 0.18 or MIDDLE_GRAY.  The
    // size of the table is lutN by lutN by lutN samples.
    //
    // In order make the distribution of the samples in the table
    // approximately perceptually uniform, the Cg shaders that use
    // the table perform lookups in "log space":
    // In a Cg shader, the lookup table is represented as a 3D texture.
    // In order to apply the table to a pixel value, the Cg shader takes
    // the logarithm of the pixel value and scales and offsets the result
    // so that lutMin and lutMax map to 0 and 1 respectively.  The scaled
    // value is used to perform a texture lookup and the shader computes
    // e raised to the power of the result of the texture lookup.
    //


Recently, a user, trying to match nuke and with my suggestion, used an identity transform as RRT and a linear_to_sRGB function (from the CTL utilities) to create an sRGB transform. To make it clear:


/// Utility -- convert linear value to sRGB
float linear_to_sRGB (float x)
{
    if (x < 0.0)
        return 0.0;
    if (x <= 0.0031308)
       return (12.92 * x);
    else
       return (1.055 * pow (x, 1.0/2.4) - 0.055);
}

The problem the user and I are facing is that the LUT table clamps (and raises) the black levels to 0.0182 and makes it not match the sRGB curve (black levels) as seen in nuke.

I am wondering if anyone has seen something similar with playexr (or your own code) and if someone knows how to address this. Any code or pointers would be highly appreciated.

--
Gonzalo Garramuño




reply via email to

[Prev in Thread] Current Thread [Next in Thread]