docs: function processMaterial(material) {
        if (cachedData.materials.has(material)) {
          return cachedData.materials.get(material);
        }
  
        if (!outputJSON.materials) {
          outputJSON.materials = [];
        }
  
        if (material.isShaderMaterial) {
          console.warn('GLTFExporter: THREE.ShaderMaterial not supported.');
          return null;
        }
  
        // @QUESTION Should we avoid including any attribute that has the default value?
        var gltfMaterial = {
          pbrMetallicRoughness: {}
        };
  
        if (material.isMeshBasicMaterial) {
          gltfMaterial.extensions = { KHR_materials_unlit: {} };
  
          extensionsUsed['KHR_materials_unlit'] = true;
        } else if (!material.isMeshStandardMaterial) {
          console.warn(
            'GLTFExporter: Use MeshStandardMaterial or MeshBasicMaterial for best results.'
          );
        }
  
        // pbrMetallicRoughness.baseColorFactor
        var color = material.color.toArray().concat([material.opacity]);
  
        if (!equalArray(color, [1, 1, 1, 1])) {
          gltfMaterial.pbrMetallicRoughness.baseColorFactor = color;
        }
  
        if (material.isMeshStandardMaterial) {
          gltfMaterial.pbrMetallicRoughness.metallicFactor = material.metalness;
          gltfMaterial.pbrMetallicRoughness.roughnessFactor = material.roughness;
        } else if (material.isMeshBasicMaterial) {
          gltfMaterial.pbrMetallicRoughness.metallicFactor = 0.0;
          gltfMaterial.pbrMetallicRoughness.roughnessFactor = 0.9;
        } else {
          gltfMaterial.pbrMetallicRoughness.metallicFactor = 0.5;
          gltfMaterial.pbrMetallicRoughness.roughnessFactor = 0.5;
        }
  
        // pbrMetallicRoughness.metallicRoughnessTexture
        if (material.metalnessMap || material.roughnessMap) {
          if (material.metalnessMap === material.roughnessMap) {
            gltfMaterial.pbrMetallicRoughness.metallicRoughnessTexture = {
              index: processTexture(material.metalnessMap)
            };
          } else {
            console.warn(
              'THREE.GLTFExporter: Ignoring metalnessMap and roughnessMap because they are not the same Texture.'
            );
          }
        }
  
        // pbrMetallicRoughness.baseColorTexture
        if (material.map) {
          gltfMaterial.pbrMetallicRoughness.baseColorTexture = {
            index: processTexture(material.map)
          };
        }
  
        if (
          material.isMeshBasicMaterial ||
          material.isLineBasicMaterial ||
          material.isPointsMaterial
        ) {
        } else {
          // emissiveFactor
          var emissive = material.emissive
            .clone()
            .multiplyScalar(material.emissiveIntensity)
            .toArray();
  
          if (!equalArray(emissive, [0, 0, 0])) {
            gltfMaterial.emissiveFactor = emissive;
          }
  
          // emissiveTexture
          if (material.emissiveMap) {
            gltfMaterial.emissiveTexture = {
              index: processTexture(material.emissiveMap)
            };
          }
        }
  
        // normalTexture
        if (material.normalMap) {
          gltfMaterial.normalTexture = {
            index: processTexture(material.normalMap)
          };
  
          if (material.normalScale.x !== -1) {
            if (material.normalScale.x !== material.normalScale.y) {
              console.warn(
                'THREE.GLTFExporter: Normal scale components are different, ignoring Y and exporting X.'
              );
            }
  
            gltfMaterial.normalTexture.scale = material.normalScale.x;
          }
        }
  
        // occlusionTexture
        if (material.aoMap) {
          gltfMaterial.occlusionTexture = {
            index: processTexture(material.aoMap)
          };
  
          if (material.aoMapIntensity !== 1.0) {
            gltfMaterial.occlusionTexture.strength = material.aoMapIntensity;
          }
        }
  
        // alphaMode
        if (material.transparent || material.alphaTest > 0.0) {
          gltfMaterial.alphaMode = material.opacity < 1.0 ? 'BLEND' : 'MASK';
  
          // Write alphaCutoff if it's non-zero and different from the default (0.5).
          if (material.alphaTest > 0.0 && material.alphaTest !== 0.5) {
            gltfMaterial.alphaCutoff = material.alphaTest;
          }
        }
  
        // doubleSided
        if (material.side === THREE.DoubleSide) {
          gltfMaterial.doubleSided = true;
        }
  
        if (material.name !== '') {
          gltfMaterial.name = material.name;
        }
  
        if (Object.keys(material.userData).length > 0) {
          gltfMaterial.extras = serializeUserData(material);
        }
  
        outputJSON.materials.push(gltfMaterial);
  
        var index = outputJSON.materials.length - 1;
        cachedData.materials.set(material, index);
  
        return index;
      }