MaterialKey

data class MaterialKey(var doubleSided: Boolean = false, var unlit: Boolean = false, var hasVertexColors: Boolean = false, var hasBaseColorTexture: Boolean = false, var hasNormalTexture: Boolean = false, var hasOcclusionTexture: Boolean = false, var hasEmissiveTexture: Boolean = false, var useSpecularGlossiness: Boolean = false, var alphaMode: AlphaMode = AlphaMode.OPAQUE, var enableDiagnostics: Boolean = false, var hasMetallicRoughnessTexture: Boolean = false, var metallicRoughnessUV: Int = 0, var baseColorUV: Int = 0, var hasClearCoatTexture: Boolean = false, var clearCoatUV: Int = 0, var hasClearCoatRoughnessTexture: Boolean = false, var clearCoatRoughnessUV: Int = 0, var hasClearCoatNormalTexture: Boolean = false, var clearCoatNormalUV: Int = 0, var hasClearCoat: Boolean = false, var hasTransmission: Boolean = false, var hasTextureTransforms: Boolean = false, var emissiveUV: Int = 0, var aoUV: Int = 0, var normalUV: Int = 0, var hasTransmissionTexture: Boolean = false, var transmissionUV: Int = 0, var hasSheenColorTexture: Boolean = false, var sheenColorUV: Int = 0, var hasSheenRoughnessTexture: Boolean = false, var sheenRoughnessUV: Int = 0, var hasVolumeThicknessTexture: Boolean = false, var volumeThicknessUV: Int = 0, var hasSheen: Boolean = false, var hasIOR: Boolean = false)

MaterialKey encodes glTF material properties for material selection and creation.

MaterialKey holds a set of boolean flags and texture coordinates that describe the properties of a glTF material. MaterialProvider uses this to determine which material to create or select. Key properties include texture presence, shading model, alpha mode, and advanced features like clearcoat and transmission.

See also

Constructors

Link copied to clipboard
constructor(doubleSided: Boolean = false, unlit: Boolean = false, hasVertexColors: Boolean = false, hasBaseColorTexture: Boolean = false, hasNormalTexture: Boolean = false, hasOcclusionTexture: Boolean = false, hasEmissiveTexture: Boolean = false, useSpecularGlossiness: Boolean = false, alphaMode: AlphaMode = AlphaMode.OPAQUE, enableDiagnostics: Boolean = false, hasMetallicRoughnessTexture: Boolean = false, metallicRoughnessUV: Int = 0, baseColorUV: Int = 0, hasClearCoatTexture: Boolean = false, clearCoatUV: Int = 0, hasClearCoatRoughnessTexture: Boolean = false, clearCoatRoughnessUV: Int = 0, hasClearCoatNormalTexture: Boolean = false, clearCoatNormalUV: Int = 0, hasClearCoat: Boolean = false, hasTransmission: Boolean = false, hasTextureTransforms: Boolean = false, emissiveUV: Int = 0, aoUV: Int = 0, normalUV: Int = 0, hasTransmissionTexture: Boolean = false, transmissionUV: Int = 0, hasSheenColorTexture: Boolean = false, sheenColorUV: Int = 0, hasSheenRoughnessTexture: Boolean = false, sheenRoughnessUV: Int = 0, hasVolumeThicknessTexture: Boolean = false, volumeThicknessUV: Int = 0, hasSheen: Boolean = false, hasIOR: Boolean = false)

Properties

Link copied to clipboard

Alpha mode: 0 = OPAQUE, 1 = MASK (alpha cutoff), 2 = BLEND.

Link copied to clipboard
var aoUV: Int

glTF texcoord set index for the ambient-occlusion texture.

Link copied to clipboard

glTF texcoord set index for the base color texture.

Link copied to clipboard

glTF texcoord set index for the clearcoat normal map.

Link copied to clipboard

glTF texcoord set index for the clearcoat roughness texture.

Link copied to clipboard

glTF texcoord set index for the clearcoat texture.

Link copied to clipboard

Renders both faces of each triangle (glTF doubleSided).

Link copied to clipboard

glTF texcoord set index for the emissive texture.

Link copied to clipboard

Enables shader diagnostics (visualizes the material as a debug aid).

Link copied to clipboard

A base color texture is bound.

Link copied to clipboard

The clearcoat layer is enabled (KHR_materials_clearcoat).

Link copied to clipboard

A clearcoat normal map is bound.

Link copied to clipboard

A clearcoat roughness texture is bound.

Link copied to clipboard

A clearcoat intensity texture is bound.

Link copied to clipboard

An emissive texture is bound.

Link copied to clipboard

A custom index of refraction is set (KHR_materials_ior).

Link copied to clipboard

A metallic-roughness texture is bound (specular-glossiness texture when useSpecularGlossiness).

Link copied to clipboard

A tangent-space normal map is bound.

Link copied to clipboard

An ambient-occlusion texture is bound.

Link copied to clipboard

The sheen layer is enabled (KHR_materials_sheen).

Link copied to clipboard

A sheen color texture is bound.

Link copied to clipboard

A sheen roughness texture is bound.

Link copied to clipboard

One or more textures use KHR_texture_transform.

Link copied to clipboard

Transmission is enabled (KHR_materials_transmission).

Link copied to clipboard

A transmission texture is bound.

Link copied to clipboard

The mesh provides per-vertex COLOR_0 data to be multiplied into base color.

Link copied to clipboard

A volume thickness texture is bound (KHR_materials_volume).

Link copied to clipboard

glTF texcoord set index for the metallic-roughness texture.

Link copied to clipboard

glTF texcoord set index for the normal map.

Link copied to clipboard

glTF texcoord set index for the sheen color texture.

Link copied to clipboard

glTF texcoord set index for the sheen roughness texture.

Link copied to clipboard

glTF texcoord set index for the transmission texture.

Link copied to clipboard

Uses the unlit shading model (KHR_materials_unlit).

Link copied to clipboard

Uses the legacy specular-glossiness workflow (KHR_materials_pbrSpecularGlossiness).

Link copied to clipboard

glTF texcoord set index for the volume thickness texture.

Functions

Link copied to clipboard

Mutates this key to trim requested features down to what the provider supports, and fills uvmap with the resulting glTF-texcoord → Filament-UV-set mapping. Called by providers before material creation.

Mutates this key to trim requested features down to what the provider supports, and fills uvmap with the resulting glTF-texcoord → Filament-UV-set mapping. Called by providers before material creation.

Mutates this key to trim requested features down to what the provider supports, and fills uvmap with the resulting glTF-texcoord → Filament-UV-set mapping. Called by providers before material creation.

Mutates this key to trim requested features down to what the provider supports, and fills uvmap with the resulting glTF-texcoord → Filament-UV-set mapping. Called by providers before material creation.

Mutates this key to trim requested features down to what the provider supports, and fills uvmap with the resulting glTF-texcoord → Filament-UV-set mapping. Called by providers before material creation.