Q100149: Mix luminance slider is not a linear mix




Many customers have asked why the Grade node mix luminance slider is not a linear mix.
Here is an explanation of the mathematics behind the mix luminance slider in the Grade node in Nuke.




The mix_luminance calculation in Nuke's Grade node is
achieved by first converting the RGB values to digitised
YPbPr, using the conversion formulae detailed in ITU-R
BT.709, which includes a non-linear gamma encoding. The
mixed luminance is obtained with mix_luminance as the linear
ratio between colour-corrected and non-colour-corrected
luminance values, and then we finally convert back to RGB.

In the this example with RGB values of (0.5, 0.5,
0.5), the non-colour-corrected luminance works out to be
0.694, and the colour-corrected luminance works out to be
0.524. The blended luminance is then 0.5 * 0.694 + (1 -
0.5) * 0.524 = 0.609. Converting this back to RGB values
then gives approximately (0.362, 0.362, 0.362).

The the example script compares the Grade node with a
straight dissolve of two constants, where the blending is
being done on the RGB values, rather than against the
luminance. This is why the results are different, since the
luminance conversion is non-linear.

If you paste this example script into Nuke, it will help to illustrate the difference in values.

set cut_paste_input [stack 0]
version 10.0 v3
Constant {
inputs 0
channels rgb
color 0.25
name Constant3
selected true
xpos 75
ypos -82
Constant {
inputs 0
channels rgb
color 0.5
name Constant2
selected true
xpos -16
ypos -80
Dissolve {
inputs 2
channels rgb
which 0.5
name Dissolve1
selected true
xpos 25
ypos 27
Constant {
inputs 0
channels rgb
color {0.5 0.5 0.5 0}
name Constant1
selected true
xpos -179
ypos -81
Grade {
white 0.5
mix_luminance 0.5
name Grade1
selected true
xpos -179
ypos -2

Was this article helpful?
0 out of 0 found this helpful