Legacy Documentation: Version 5.4
LanguageEnglish
  • C#
  • JS

Script language

Select your preferred scripting language. All code snippets will be displayed in this language.

RenderTextureReadWrite

enumeration

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

Sumbission failed

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

Close

Cancel

Description

Color space conversion mode of a RenderTexture.

When using Gamma color space, no conversions are done of any kind, and this setting is not used.

When Linear color space is used, then by default non-HDR render textures are considered to contain sRGB data (i.e. "regular colors"), and fragment shaders are considered to output linear color values. So by default the fragment shader color value is converted into sRGB when rendering into a texture; and when sampling the texture in the shader the sRGB colors are converted into linear values. This is the sRGB read-write mode; and the Default mode matches that when linear color space is used. When this mode is set on a render texture, RenderTexture.sRGB will return true.

However, if your render texture will contain non-color data (normals, velocities, other custom values) then you don't want Linear<->sRGB conversions to happen. This is the Linear read-write mode. When this mode is set on a render texture, RenderTexture.sRGB will return false.

Note that some render texture formats are always considered to contain "linear" data and no sRGB conversions are ever performed on them, no matter what is the read-write setting. This is true for all "HDR" (floating point) formats, and other formats like Depth or Shadowmap.

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

Variables

DefaultDefault color space conversion based on project settings.
LinearRender texture contains linear (non-color) data; don't perform color conversions on it.
sRGBRender texture contains sRGB (color) data, perform Linear<->sRGB conversions on it.
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961