Skip to main content

Gltf Extensions

The only document that is normative regarding the glTF specification is the official repository. While the Markdown specification can provide context and hints for implementation of a glTF interface, the schema is the bare description of how the gltf json will be composed. When creating classes or objects that correspond to gltf properties, always use the schema as a guideline as json examples in the Markdown specification can be incomplete or misguiding.

There is a cheat sheet that can be helpful when you are new to the format. Just be aware that some things might be more complex in the spec.

KHR_materials_specular

the most dominant feature is the ability to modify the specular color. Although with the standard microfacet BRDF model such a thing should not be necessary for dieelectric materials, there are cases where it makes sense. This comment explains some of them.

Basically the coloring of the specular reflection can be explained by light passing through fibres and reflecting

Examples:

Acrylic FiberUSB Cable
Specular effect on acrylic fabricUSB Cable with specular color

Also take a look at the KHR_materials_sheen extension, as specular tinting will typically be used in conjunction with this other extension.

KHR_materials_sheen

A blue pillow with a sheen effect

The glTF Sample Viewer is currently based on an outdated sheen specification. In the Gestaltor, Ashikhmin is no longer used to calculate the shadowing term and sheen intensity is no longer given as parameter.

You can observe the differences between Charlie and Ashikhmin in this shadertoy

There is more information about formulation in this blog post by Krzysztof Narkowicz.

Assets with sheen

Typically, this effect can be observed with all kinds of cloth materials. The roughness controls the size of the effect, or i.e. corresponds to the length of the fibres at the surface of the material. Silk or Velour would have a low roughness while terrycloth could have a high value. The color factor parameter is typically set to a value close to the base color.

Filament has an artist document that also makes mention of the specular tint that can be set with the KHR_materials_specular extension. Just be aware that naming in filament is confusingly different.

To create a velvet-like material, the base color [SheenColorFactor in glTF] can be set to black (or a dark color). Chromaticity information should instead be set on the sheen color [SpecularFactor in KHR_materials_specular in glTF]. To create more common fabrics such as denim, cotton, etc. use the base color [SheenColorFactor in glTF] for chromaticity and use the default sheen color or set the sheen color [SpecularFactor in KHR_materials_specular in glTF] to the luminance of the base color.

KHR_materials_transmission

Compared to alpha blending, transmission does not affect the contribution of light effects on the objects. In other words, when a material is fully transmissive, the specular highlights (and other effects) are still visible. Additionally, point lights behind a transmissive object get visible. By combining a transmissive material with rougness, the transmitted light gets scattered, resulting in a blurred background. Without any further extensions, the material is assumed to be infinitely thin. This means, refraction of light can be neglected.

Currently, the sample viewer is not able to handle this extension correctly. Gestaltor is able to handle transmission of point lights and light originating from an environment map. However, at the current state, objects behind transmissive objects are not rendered as this would involve an additonal renderin pass.

A test asset can be found on the Khronos Group glTF-Sample-Models repository

TransmissionTest

A transmission effect on a sphere

KHR_materials_ior

Allows to set the index of reflactions which influences the specular reflection of dielectric materials. In the shader the f0 value is initialized with the fresnel formula instead of being set to a constant 0.04. Future extension implementations in gestaltor might bring further interactions. For now, the specular extension can be configured to produce the same result as the ior extension. The specular factor and ior value are linked by:

specular = ((ior-1)/(ior+1))^2/0.04

For approximate references you can alternatively use the following chart:

A graph relating ior to specular. The curve is nonlinear.