GLTFExporter not export all MeshPhysicalMaterial values

I’ve created a scene including MeshPhysicalMaterial. On exporting with GLTFexporter, some material values are not exported. Only…

"materials": [
    {
      "pbrMetallicRoughness": {
        "metallicFactor": 0.32,
        "roughnessFactor": 0.67
      }
    }
  ], 

are in output file. Need reflectivity, clearcoat, clearcoatRougness and so on.

Not all material properties of three.js materials can be represented in glTF. The listed ones are not (yet) supported.

If you want to retain as much properties as possible, consider to save your objects via toJSON() and import them via ObjectLoader.

It’s a good idea. Will do so. Thx @Mugen87.

Additional question for export: GTLFExporter not exports all my data. How can I pass variables to *.glb ?

GLTFExporters support export multiple scenes and objects, but will not add more variables until default ones. Found no properly way to export some additional material values. Do not right understand, how GLTFExporter works. May you can help? Will add array to export file.

@BulliM what do you mean by variables, and what variables are you trying to export in your .glb (glTF) file?

glTF was not invented by three.js, and three.js has many features that cannot be exported to any standard format. Reflectivity and clearcoat cannot currently be put into a glTF file for other applications to see, there is no way around that.

If you want to put totally custom data into the glTF file you can set material.userData.foo = 'my-value' or similar, and that data will be there again when you load the file back into three.js. In your application you could use that to restore reflectivity or other settings. But it’s not possible to tell other applications what to do with that user data.

I know that. I use Blender for rendering later. Blender provide pbr materials. Will use python to extract those data.

material.userData.params = params;

Works! That is great and exactly, what I searched for. Thank you so much. :slight_smile: