Description
The TextureColorSpace
enumeration in the Editor.ShaderGraph
namespace defines the color space options available for textures in a shader graph. This enumeration is used to specify how the color data of a texture should be interpreted.
The Srgb
field represents the standard RGB color space, which is a common color space for images and textures. It is used when the texture data is stored in sRGB format, which applies a gamma correction to the color values to better match human vision.
Usage
Use the TextureColorSpace.Srgb
field when you want to specify that a texture should be interpreted using the sRGB color space. This is typically used for textures that are intended to be displayed directly to the screen, as it ensures that the colors appear correctly to the human eye.
When setting up a shader graph, you can assign TextureColorSpace.Srgb
to a texture input to ensure that the texture is processed with the correct color space.
Example
// Example of using TextureColorSpace in a shader graph setup
// Assume 'texture' is a texture input in the shader graph
TextureColorSpace colorSpace = TextureColorSpace.Srgb;
// Use the colorSpace variable to configure the texture input
// This ensures the texture is interpreted in the sRGB color space
shaderGraph.SetTextureColorSpace(texture, colorSpace);