Multi-Layer Car Paint with glTF Material Extensions

Simulating realistic multi-layer automotive paint in glTF requires combining the core physically based rendering (PBR) metallic-roughness model with specific Khronos extensions. Real-world car paint typically features a base primer, a color basecoat often containing metallic or pearlescent flakes, and a protective, glossy clearcoat. By chaining KHR_materials_clearcoat, KHR_materials_iridescence, and KHR_materials_specular, developers can accurately model these distinct optical layers within a single glTF material definition.

The Anatomy of Automotive Paint

A typical automotive finish consists of three functional visual stages:

  1. The Basecoat: Provides the underlying diffuse pigmentation and primary metallic reflectivity.
  2. The Flake/Pearlescent Layer: Introduces directional color shifts and microscopic sparkles (thin-film interference).
  3. The Clearcoat: A smooth, highly reflective transparent polyurethane or enamel top layer that exhibits distinct specular reflections and subtle surface imperfections known as "orange peel."

Step 1: Basecoat with Metallic-Roughness and Specular

The simulation begins with the core pbrMetallicRoughness model. Set baseColorFactor or baseColorTexture to define the primary body color. Automotive paints often use high metallic values (approaching 1.0) paired with moderate roughness (0.3 to 0.6) to represent the dispersed aluminum or mica particles suspended in the binder resin.

To fine-tune the reflectivity of the metallic flakes independent of the base color, incorporate KHR_materials_specular. This extension enables control over the specular reflection strength (specularFactor) and specular tint (specularColorFactor), allowing metallic flakes to shine with distinct color characteristics under direct lighting.

Step 2: Adding Pearlescence with Iridescence

Factory finishes such as "chameleon" coatings or pearlescent white rely on light waves interfering within micro-thin layers. In glTF, this is achieved using the KHR_materials_iridescence extension, positioned conceptually above the basecoat:

  • iridescenceFactor: Controls the overall intensity of the color shift.
  • iridescenceIor: Defines the index of refraction of the thin-film layer (typically 1.3 to 1.6 for mica flakes).
  • iridescenceThicknessMinimum and iridescenceThicknessMaximum: Set in nanometers (nm), usually within 100 to 800 nm, to control which wavelengths of light shift across viewing angles.

Step 3: Layering the Top Finish with Clearcoat

The final outer finish is created using KHR_materials_clearcoat. This extension evaluates a secondary specular lobe on top of the basecoat and iridescence layers without extinguishing the lighting beneath it.

  • clearcoatFactor: Set close or equal to 1.0 to represent a clean, continuous automotive lacquer.
  • clearcoatRoughnessFactor: Kept very low (0.0 to 0.05) to ensure sharp, mirror-like environmental reflections.
  • clearcoatNormalTexture: Crucial for physical realism. Apply a subtle micro-bump normal map here to simulate the "orange peel" texture found on painted panels, while leaving the base layer normal map flat. This decouples the smoothness of the top layer from the micro-facets of the flake layer underneath.

Structural glTF JSON Implementation

In the glTF asset, these extensions are chained under the material's extensions object:

{
  "materials": [
    {
      "name": "CarPaint_Pearlescent_Clearcoat",
      "pbrMetallicRoughness": {
        "baseColorFactor": [0.05, 0.1, 0.4, 1.0],
        "metallicFactor": 0.8,
        "roughnessFactor": 0.45
      },
      "extensions": {
        "KHR_materials_specular": {
          "specularFactor": 1.0,
          "specularColorFactor": [0.8, 0.9, 1.0]
        },
        "KHR_materials_iridescence": {
          "iridescenceFactor": 0.6,
          "iridescenceIor": 1.5,
          "iridescenceThicknessMinimum": 200,
          "iridescenceThicknessMaximum": 400
        },
        "KHR_materials_clearcoat": {
          "clearcoatFactor": 1.0,
          "clearcoatRoughnessFactor": 0.03,
          "clearcoatNormalTexture": {
            "index": 1,
            "scale": 0.3
          }
        }
      }
    }
  ]
}

Shader Execution Order

Standard glTF runtime engines evaluate this stack hierarchically:

  1. The base diffuse and metallic contributions are calculated via pbrMetallicRoughness.
  2. Specular reflection is modulated by KHR_materials_specular.
  3. Thin-film interference from KHR_materials_iridescence tints the specular response based on the view angle.
  4. Finally, KHR_materials_clearcoat calculates an independent Fresnel reflection based on its own normal map, blending the clearcoat reflection over the accumulated sub-layers using energy conservation principles.