David Gustavsson
David Gustavsson

Reputation: 597

Issues in THREEJS with converted GLTF 2.0 models

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?

Upvotes: 1

Views: 1962

Answers (1)

Don McCurdy
Don McCurdy

Reputation: 11960

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.

Upvotes: 2

Related Questions