3
$\begingroup$

The question is about the Gamma Cycles node.

In this period I am studying the linear workflow in Computer Graphics and how it is managed by Blender.

I noticed that Cycles automatically handles the jpg-png (sRGB in general) color space linearization process by simply setting "Color" in the image texture node.

While instead, we do not want to linearize to preserve sRGB we set "No Color Date".

That's what I thought I understood. Is it right?

The doubt comes to me, when I use the Gamma node. Theoretically if I insert 0.22 to a "Color Data" image (linearized by Cycles) I should get an sRGB image for manual conversion from Linear to sRGB (Color Management disabled). But the reverse thing is, the image is as dark as if I had inserted a double linearization (0.454545), the automatic cycles and my manual.

Theoretically, I expect the gamma node to work as in Nuke where (in a linearized space and then converted to sRGB in the preview) set at 2.22 I see a brighter picture.

In Blender, the accounts return me to setting the menagement color to "none" (Display Device) where the image is dark and contrasted, as does the Cycles internally.

But, I still do not understand the behavior of the Gamma node. Can anybody tell me what's going on internally and why?

EDIT:

Thanks for the answer, cegaton.

The things you said I understood. But, probably, I did not explain it well, the gamma blender node works differently than other programs. Here's an example.

This is the original image.

enter image description here

This is correct with a 0.454545 in Natron (dark image).

enter image description here

This is correct with a 0.454545 in Blender (brighter image).

enter image description here

0.454545 is the conversion curve to convert sRGB (2.22) so I expect the image to be darker, while in Blender it corrects it inversely.

The settings are identical. Both were interpreted as sRGB and then linearized and displayed sRGB but the gamma node works in reverse.

Why?

$\endgroup$
3
$\begingroup$

While instead we do not want to linearize to preserve sRGB we set "No Color Data".

No. This is specifically for data that is not a colour. Linear colour data should be tagged as “linear”.

In Blender, the accounts return me to setting the menagement color to "none" (Display Device) where the image is dark and contrasted, as does the Cycles internally.

You should never set your display device to none unless purely for diagnostic testing.

The settings are identical. Both were interpreted as sRGB and then linearized and displayed sRGB but the gamma node works in reverse.

Look for yourself. You can see that the value is simply taken to the power of the power specified.

void GammaOperation::executePixelSampled(float output[4], float x, float y, PixelSampler sampler)
{
    float inputValue[4];
    float inputGamma[4];

    this->m_inputProgram->readSampled(inputValue, x, y, sampler);
    this->m_inputGammaProgram->readSampled(inputGamma, x, y, sampler);
    const float gamma = inputGamma[0];
    /* check for negative to avoid nan's */
    output[0] = inputValue[0] > 0.0f ? powf(inputValue[0], gamma) : inputValue[0];
    output[1] = inputValue[1] > 0.0f ? powf(inputValue[1], gamma) : inputValue[1];
    output[2] = inputValue[2] > 0.0f ? powf(inputValue[2], gamma) : inputValue[2];

    output[3] = inputValue[3];
}

So we can see that the value is taken to the power of the supplied power value.

When you load an sRGB image, it is linearized via an inversion of the sRGB OETF, which it should be noted is not simply a pure 2.2 power function. A value such as 0.467 is linearized to approximately 0.2 in the reference space.

If we run that value through the power function, 0.2 would be taken to the power of 0.454545 as per your example. This would indeed yield a reference value of 0.48119 approximately, which is roughly middle grey in terms of a typical sRGB display.

In Nuke, for reasons that are beyond me, the "Gamma" node is inverted. Natron followed this because it is attempting to be a Nuke knock off.

Strangely, Nuke’s idea of gamma is inverted, so the equation in Nuke is: output = input^(1/gamma).

As taken from https://compositormathematic.wordpress.com/2013/07/06/gamma-contrast/

Most people are utterly confused as to what a “Linear Workflow” is. I can say with utmost certainty that it has very little to do with power functions, and much more to do with understanding the difference between a scene referred model and a display referred model.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.