mikaxyz/elm-gltf/5.0.0

Gltf.Material.Extensions

Material extensions as defined in the glTF specification.

Currently supports:

  • KHR_materials_anisotropy
  • KHR_materials_clearcoat
  • KHR_materials_dispersion
  • KHR_materials_emissive_strength
  • KHR_materials_ior
  • KHR_materials_iridescence
  • KHR_materials_sheen
  • KHR_materials_specular
  • KHR_materials_transmission
  • KHR_materials_unlit
  • KHR_materials_volume

The raw JSON value is there for everything else.

type alias Extensions =
{ anisotropy : Maybe Anisotropy
, clearcoat : Maybe Clearcoat
, dispersion : Maybe Dispersion
, emissiveStrength : Maybe EmissiveStrength
, ior : Maybe Ior
, iridescence : Maybe Iridescence
, sheen : Maybe Sheen
, specular : Maybe Specular
, transmission : Maybe Transmission
, unlit : Maybe Unlit
, volume : Maybe Volume
, raw : Value
}

Material extensions

type alias Anisotropy =
{ strength : Float
, rotation : Float
, texture : Maybe Texture
}
type alias Clearcoat =
{ factor : Float
, texture : Maybe Texture
, roughnessFactor : Float
, roughnessTexture : Maybe Texture
, normalTexture : Maybe Texture
, normalTextureScale : Float
}
= Dispersion Float
= EmissiveStrength Float
type Ior
= Ior Float
type alias Iridescence =
{ factor : Float
, texture : Maybe Texture
, ior : Float
, thicknessMinimum : Float
, thicknessMaximum : Float
, thicknessTexture : Maybe Texture
}
type alias Sheen =
{ colorFactor : Vec3
, colorTexture : Maybe Texture
, roughnessFactor : Float
, roughnessTexture : Maybe Texture
}
type alias Specular =
{ factor : Float
, texture : Maybe Texture
, colorFactor : Vec3
, colorTexture : Maybe Texture
}
type alias Transmission =
{ factor : Float
, texture : Maybe Texture
}
type Unlit
= Unlit
type alias Volume =
{ attenuationColor : Vec3
, attenuationDistance : Maybe Float
, thicknessFactor : Float
, thicknessTexture : Maybe Texture
}
clearcoatTexturesPackedIndex : Maybe Clearcoat -> Result () (Maybe Index)

Get clearcoat texture with the assumption there is only one reference.

If your renderer is limited by max samplers (elm-webgl) you might want to use this to only allow materials where values are "packed" into rbg-channels of a single texture.

The clearcoat normal texture is not included: it holds full rgb normal data and can not share channels.

iridescenceTexturesPackedIndex : Maybe Iridescence -> Result () (Maybe Index)

Get iridescence texture with the assumption there is only one reference.

If your renderer is limited by max samplers (elm-webgl) you might want to use this to only allow materials where values are "packed" into rbg-channels of a single texture.

sheenTexturesPackedIndex : Maybe Sheen -> Result () (Maybe Index)

Get sheen texture with the assumption there is only one reference.

If your renderer is limited by max samplers (elm-webgl) you might want to use this to only allow materials where values are "packed" into rbg-channels of a single texture. The sheen color uses the rgb channels and the sheen roughness the alpha channel.