How does GLTF loader map materials to Three.js material types?

I had a quick peek at the GLTF Loader code and I could see how the materials are assigned three.js types when loaded with gltf extensions, but couldn’t quite see what happens to material definitions not using extensions.

Is everything simply mapped to the MeshStandardMaterial?

This will depend on which glTF extensions are present in the material. If no extensions change the default, it would be MeshStandardMaterial.

  • Default → MeshStandardMaterial
  • KHR_materials_unlit → MeshBasicMaterial
  • KHR_materials_clearcoat (or other future extensions) → MeshPhysicalMaterial
  • KHR_materials_pbrSpecularGlossiness → custom ShaderMaterial
3 Likes

Got it, that’s pretty much what I assumed. Thanks!

You can also manually process the extension after loading in your application. Textures are a kind of large topic in three.js and i’m not 100% sure at what level to call its load method with the URL of an image and set the material’s map. myprepaidcenter activation MeshBasicMaterial({map:loader.load(‘resources/images/flowers-3.jpg’)}, it should be noted though that not all geometry types supports multiple materials.