ShaderData preview is washed out in Material UI

On 02/07/2018 at 03:48, xxxxxxxx wrote:

Hi Peterakos, thanks for writing us.

With reference to your question, and following a support email received on beginning May this year, I warmly invite to check if transforming from sRGB to linear already takes place if BaseShader::IsColorManagementOff() returns true.

I also remind you that, for your comfort, you can use TransformColor to transform your data from one colorspace to another.

Best, Riccardo

On 02/07/2018 at 07:46, xxxxxxxx wrote:

Hello Riccardo.
Thank you very much for your help !

The call IsColorManagementOff returns false. The preview that I produce in output is correct (with Linear workflow off in Project Settings). The problem is that the material shows a washed out preview under ShaderLink. TransformColor doesn't help me in this case.

Thank you for your time.

On 04/07/2018 at 08:22, xxxxxxxx wrote:

Hi Peterakos, thanks for following up but it's indeed a matter of transforming the color you've selected in your shader from one space to another taking in consideration the fact that the linear workflow is enabled or not.

Using something as simple as

    Vector MyTransformColor(const Vector &color, const Int32 colorProfile, const Bool isLinearWF)  
      if (colorProfile == DOCUMENT_COLORPROFILE_SRGB && isLinearWF)  
          return TransformColor(color, COLORSPACETRANSFORMATION_SRGB_TO_LINEAR);  
      else if (colorProfile == DOCUMENT_COLORPROFILE_LINEAR && !isLinearWF)  
          return TransformColor(color, COLORSPACETRANSFORMATION_LINEAR_TO_SRGB);  
      return color;  

could sort your problem out passing the color you've selected in the color picker out of your ShaderData in the ShaderData::Output() method.

Best, Riccardo