Sets whether the texture image should be displayed with zero saturation (i.e. converted to grayscale)
Sets whether the texture image should be displayed with zero saturation (i.e. converted to grayscale). Returns nil if the current system does not support texture desaturation; in such cases, this method has no visible effect (but still flags the texture object as desaturated). Authors may wish to implement an alternative to desaturation for such cases (see example).
Signature:
Code
supported = Texture:SetDesaturated(desaturate)
Arguments:
desaturate - True to display the texture in grayscale; false to display original texture colors (boolean)
Returns:
supported - 1 if the current system supports texture desaturation; otherwise nil (1nil)
Examples: -- Wrapper for the desaturation feature used in the default UI: -- if running on display hardware (or drivers, etc) that does not support desaturation, -- uses SetVertexColor to "dim" the texture instead
function SetDesaturation(texture, desaturation) local shaderSupported = texture:SetDesaturated(desaturation); if ( not shaderSupported ) then if ( desaturation ) then texture:SetVertexColor(0.5, 0.5, 0.5); else texture:SetVertexColor(1.0, 1.0, 1.0); end end end