API Reference · Materials and textures
TextureColorSpace
public enum TextureColorSpaceHow the bytes of a Texture are encoded, when the slot they are put in should not be the one to decide.
Every renderer here lights in linear light and reads an eight-bit image one of two ways. A base-colour, emissive or matcap map is taken as sRGB and decoded, because that is how images of colour are stored; a metallic-roughness, normal, occlusion or bump map is taken as it is, because those are numbers rather than colours. That rule is right for every image a glTF file ships and wrong for two kinds a caller can make: a colour computed in linear light and written without the encode, and a photograph pressed into service as data. This says which, once, on the texture — see Texture.ColorSpace.
Values
| Value | Description |
|---|---|
Auto | Decided by the slot: sRGB in a colour slot, linear in a data slot. The default, and right for anything that came from an image file. |
Srgb | The bytes are sRGB-encoded whichever slot they are in, so a data slot decodes them first. |
Linear | The bytes are linear whichever slot they are in, so a colour slot does not decode them. |