• getTextureColorSpace(texture: Texture): string | null
  • Returns the color space (if any) implied by the Material slots to which a texture is assigned, or null for non-color textures. If the texture is not connected to any Material, this function will also return null — any metadata in the image file will be ignored.

    Under current glTF specifications, only 'srgb' and non-color (null) textures are used.


    import { getTextureColorSpace } from '@gltf-transform/functions';
    const baseColorTexture = material.getBaseColorTexture();
    const normalTexture = material.getNormalTexture();
    getTextureColorSpace(baseColorTexture); // → 'srgb'
    getTextureColorSpace(normalTexture); // → null
Function symbol, where the argument and output are a box labeled 'glTF'.

Made by Don McCurdy. Documentation built with greendoc and published under Creative Commons Attribution 3.0.