[Bf-committers] Blur Node: "Gamma" audit <- retire?

Troy Sobotka troy.sobotka at gmail.com
Wed Jan 30 17:32:44 CET 2013

I thought I'd crawl into the code for the "Gamma" toggle in the Blur
node now that we have a proper color management system in place.

float inputColor[4];
this->m_inputProgram->read(inputColor, x, y, sampler);
if (inputColor[3] > 0.0f) {
inputColor[0] /= inputColor[3];
inputColor[1] /= inputColor[3];
inputColor[2] /= inputColor[3];

/* check for negative to avoid nan's */
output[0] = inputColor[0] > 0.0f ? inputColor[0] * inputColor[0] : 0.0f;
output[1] = inputColor[1] > 0.0f ? inputColor[1] * inputColor[1] : 0.0f;
output[2] = inputColor[2] > 0.0f ? inputColor[2] * inputColor[2] : 0.0f;
output[3] = inputColor[3];

if (inputColor[3] > 0.0f) {
output[0] *= inputColor[3];
output[1] *= inputColor[3];
output[2] *= inputColor[3];

It strikes me that a few things are horribly incorrect here:

1) It appears as though that this node _always_ assumes that alpha is
associated, and pre-divides. This is most certainly not paying
attention to Sergey's recent alpha changes.
2) It appears that this node does a mere squaring of values, which is
3) "Gamma" is erroneous, as it fails to address sRGB or 709 transfer
curves in an appropriate fashion, so the usefulness seems entirely

To this end, I wonder if this toggle should be removed from the UI.
This would keep legacy files loading, and prevent artists from
mangling up their work inadvertently?


With respect,

More information about the Bf-committers mailing list