Three.js: where extensions for materials are not included in the list of all model extensions.

Created on 12 Mar 2020  Â·  1Comment  Â·  Source: mrdoob/three.js

https://github.com/mrdoob/three.js/blob/e3d60b17c0497a08ecb166eae799eb5cf6d9e7f5/examples/jsm/loaders/GLTFLoader.js#L222

if( json.materials ){
  for( const nextMaterial of json.materials ){
    if( nextMaterial.extensions ){
      for( const nextExtensionKey in nextMaterial.extensions ){
        if( json.extensionsUsed.indexOf( nextExtensionKey ) === -1 ){
          json.extensionsUsed.push( nextExtensionKey );
        }
      }
    }
  }
}

In my case, additional parsing of materials helped to avoid errors in case they have extensions that are not considered in the general list.

Most helpful comment

@tnormandao if an extension is used in a material but not included in json.extensionsUsed, then it's an invalid glTF file and we cannot support it here. See glTF Spec → Specifying Extensions:

All extensions used in a glTF asset must be listed in the top-level extensionsUsed array...

You can also check your models using the glTF validator.

>All comments

@tnormandao if an extension is used in a material but not included in json.extensionsUsed, then it's an invalid glTF file and we cannot support it here. See glTF Spec → Specifying Extensions:

All extensions used in a glTF asset must be listed in the top-level extensionsUsed array...

You can also check your models using the glTF validator.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

makc picture makc  Â·  3Comments

scrubs picture scrubs  Â·  3Comments

ghost picture ghost  Â·  3Comments

seep picture seep  Â·  3Comments

konijn picture konijn  Â·  3Comments