Version: 2023.2
LanguageEnglish
  • C#

GL.sRGBWrite

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

public static bool sRGBWrite;

Description

Controls whether Linear-to-sRGB color conversion is performed while rendering.

This property is only relevant when Linear Color Space rendering is used. Typically when linear color space is used, non-HDR render textures are treated as sRGB data (i.e. "regular colors"), and fragment shaders outputs are treated as linear color values. So by default the fragment shader color value is converted into sRGB.

However, if you know your fragment shader already outputs sRGB color value for some reason and want to temporarily turn off Linear-to-sRGB write color conversion, you can use this property to achieve that.

Note that the ability to turn off sRGB writes is not supported on all platforms (typically mobile "tile based" GPUs can not do it), so this is considered a "feature of last resort". Usually it is better to create RenderTextures with appropriate color space flag (linear vs sRGB) and not switch the conversions in the middle of rendering into it.

See Also: Linear Color Space, RenderTexture.sRGB, RenderTextureReadWrite, PlayerSettings.colorSpace.

Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961