EXTTextureAVIF

EXT_texture_avif enables AVIF images for any material texture.

AVIF offers greatly reduced transmission size, but requires browser support. Like PNG and JPEG, an AVIF image is fully decompressed when uploaded to the GPU, which increases upload time and GPU memory cost. For seamless uploads and minimal GPU memory cost, it is necessary to use a GPU texture format like Basis Universal, with the KHR_texture_basisu extension.

Defining no ExtensionProperty types, this Extension is simply attached to the Document, and affects the entire Document by allowing use of the image/avif MIME type and passing AVIF image data to the Texture.setImage method. Without the Extension, the same MIME types and image data would yield an invalid glTF document, under the stricter core glTF specification.

Properties:

  • N/A

Example

import { TextureAVIF } from '@gltf-transform/extensions';

// Create an Extension attached to the Document.
const avifExtension = document.createExtension(TextureAVIF)
    .setRequired(true);
document.createTexture('MyAVIFTexture')
    .setMimeType('image/avif')
    .setImage(fs.readFileSync('my-texture.avif'));

AVIF conversion is not done automatically when adding the extension as shown above — you must convert the image data first, then pass the .avif payload to Texture.setImage.

When the EXT_texture_avif extension is added to a file by glTF-Transform, the extension should always be required. This tool does not support writing assets that "fall back" to optional PNG or JPEG image data.

Hierarchy

Static properties

EXTENSION_NAME: "EXT_texture_avif"

Properties

extensionName: "EXT_texture_avif"

Methods

  • dispose(): void
  • isRequired(): boolean
  • Indicates to the client whether it is OK to load the asset when this extension is not recognized. Optional extensions are generally preferred, if there is not a good reason to require a client to completely fail when an extension isn't known.

  • listProperties(): ExtensionProperty[]
  • Indicates to the client whether it is OK to load the asset when this extension is not recognized. Optional extensions are generally preferred, if there is not a good reason to require a client to completely fail when an extension isn't known.

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.