1

I have over 100k of GLTF 1.0 models. We are in the process of converting to 2.0, and is hitting a brick wall.

The source models are Collada at first, and we used Collada2GLTF converter to generate the GLTF files. But we did do this using the KHR_materials_common setting, which created perfect results for us.

But now we want to convert the GLTF files to 2.0, and this is proven quite problematic. The process works fine, but the converted model gets the 'KHR_materials_common' extension. It is through that material that the texture is bound.

As we are using the THREE JS renderer, its GLTF loader does not yet support this extension, and no texture is displayed. It only gets a totally black surface.

I have given it (a quick) got to add that extension locally, using MeshBasicMaterial, but with no good result.

So, my question is, what are my options, if any?

  • Is there a way to convert and remove the KHR_materials_common from the GLTF 1.0 source?
  • Can the conversion process (gltf-pipeline) remove the extension?
  • Is there any work in progress to add the support in THREEJS GLTFLoader?
  • Conversion from source to GLTF 2.0 works, but I do not have all sources available. Some are customers property, and we do not store that.
  • Reversing back to COLLADA is not supported (here)
David Gustavsson
  • 597
  • 4
  • 25

1 Answers1

2

A quick summary of the material types in glTF 1.0 and glTF 2.0, as of late 2018:

glTF 1.0

  • (Core): Custom GLSL shaders.
  • KHR_materials_common: Blinn, Phong, Lambert, and Constant/unlit.

glTF 2.0

  • (Core): Metal/rough PBR.
  • KHR_materials_pbrSpecularGlossiness: Spec/gloss PBR.
  • KHR_materials_unlit: Constant/unlit.
  • KHR_techniques_webgl: Custom GLSL shaders. (in progress)

Note that there are no blinn, phong, or lambert materials in glTF 2.0. Do you know what types of materials, or what types of textures, are used by your 100,000 models? That will help to answer which glTF 2.0 material you should be using.

Three.js implements all of the glTF 2.0 material options, except KHR_techniques_webgl, for which the specification is not complete. Three.js does not implement KHR_materials_common, because it isn't part of glTF 2.0.

Most likely, if you used unlit materials in glTF 1.0, you should use the KHR_materials_unlit extension in glTF 2.0. If you used blinn, phong, or lambert, you should use metal/rough or spec/gloss PBR in glTF 2.0. The PBR conversion of those materials should look quite good, although if you're looking for an exact match of the legacy materials, you may need to consider the custom GLSL extension.

I don't think glTF-Pipeline can do this conversion, but it would be well worth filing an issue there (it looks like you already have?) to request it. If not, the conversion is probably something you can implement yourself. It's much easier, for example, than converting anything to/from a GLSL material.

Don McCurdy
  • 10,975
  • 2
  • 37
  • 75
  • 1
    Hi, thanks for the detailed answer.I went on and implemented a short script that load a gltf and identifies if it is using KHR_materials_common. If so, convert to another material (I'm using PBR as it is acting as default in the GLTFLoader) and then it works as intended. There are some differences in the rendering result, so I might have another go at it to try to mimic the result with GLTF 1.0. – David Gustavsson Oct 21 '18 at 20:53
  • Great! If you also adjust `roughnessFactor` and `metalnessFactor` you may get closer in the result, but sounds like you're on the right track. – Don McCurdy Oct 22 '18 at 16:10