[SOLVED] Is this possible to extract materials from a GLB?

@yaustar: At this stage, outputing a large JSON string at runtime is your best bet.

I think I may got something. I still need to test it with more materials…

  1. In code, I create a clone of the desired material like this:
var mat2 = this.pc_entity.model.meshInstances[0].material.clone();
  1. I remove all parameters related to maps, meshInstances and chunks, because this generate big or strange values. In this case, this material was linked with a diffuse map and an opacity map:
mat2.meshInstances = null;
mat2._diffuseMap = null;
mat2._opacityMap = null;
mat2._chunks = null;
  1. I print the Json in string format into the console like this:
console.log(JSON.stringify(mat2));
  1. Based on Leonidas trick from here, I can copy paste the string from my console and recopy that in the console in the editor and generate a new material.

  2. I have a new material in my project!

What do you think of this?