# Controlling saturation on scene referred data

As troy_s mentioned in his answer about CDL node, Saturation is part of ASC CDL, but blender doesn't incorporate it in the CDL node. And

to control saturation on scene referred data a custom node group needs to be created to operate after the CDL node.

So, I searched about it on internet and found that:

A fourth parameter “Saturation” is achieved by converting the out.rgb data in a Luma and Chroma component. The Chroma Signal is then multiplied by the “Saturation” parameter.

I created this nodes and they seems work, but I'm not sure about math, is it the right way to control saturation?

• First of all don't use YUV, use RGB.. Then Look up the formula for cdl saturation. It is a bit more involved as it requires the luminance vales to be wighted differently for each channel. Look for a file created by Tynaud in blendswap he created the proper saturation node as a node group. – user1853 May 6 '18 at 19:22

The sample code for the ASC-CDL Saturation component looks like this:

/* compute the fully desaturated grey value */
luma =  rgb[0] * sat_coef_709[0] +
rgb[1] * sat_coef_709[1] +
rgb[2] * sat_coef_709[2] ;

/*
output rgb is a weighted average between the input rgb and
the fully desaturated grey value with "sat" as the weight...
*/

for (c=0; c<3; c++)
rgb[c] = rgb[c] * sat + luma * (1.0 - sat);


The coefficients for any given RGB colourspace will differ. The coefficients for REC.709, are RGB 0.2126, 0.7152, 0.0722

Should be easy to sort out.

And yes, as per @cegaton, avoid the horrible use of (the also equally incorrectly labelled) YUV.

Technically, the RGB to BW node should work and honour the luma coefficients in the OpenColorIO configuration as well.

• Tynaud node group to recreate the ASC CDL node can be found here: blendswap.com/blends/view/85008 – user1853 May 6 '18 at 22:00
• Worth noting that the ASC Saturation has a clamp in on the values, which makes it essentially useless for scene referred work. – troy_s May 6 '18 at 23:04