Exporting a model with ShaderMaterial

Hello everyone,

I was trying to export a model which uses a ShaderMaterial in three js. The first idea was trying to do it with GLTFEXporter, but since this method doesn’t support ShaderMaterials, (and thanks to the answer at this thread: Why doesn't GLTFExporter support ShaderMaterials?), I found that using JSON format It is a good alternative.

So I did It, once I exported all the data the loading was working fine for me. But the size of the JSON file which contains all the data of the model It is very huge (~ 80MB), and for the kind of purpose that I need this data It is not very useful for me.

I tried various JSON compression methods and I’ve found not much difference between the sizes of the results (the best one was like 65MB, and I need that the file should have less size).
I also tried to split the model in order to have various JSON models and load them at the same time, in order to parallelize the process, but that give me not much gain, and the results were worthless.

I’ve been considering the idea of ​​splitting the ShaderMaterial and the Object and then load It, but since I’m using a ShaderMaterial I can’t export an .mtl file. Can I export this data as it is mentioned here? three.js - exporting threejs ShaderMaterial as mtl file? - Stack Overflow
(Exporting the entire frag + vert shaders).
How can I apply this method? The resulting data will have the values ​​for my uniforms and all the data that I need? What alternative is left for me to try?

Thank you!

Have you considered to just call material.toJSON() and then use MaterialLoader to load the JSON back into your application?

BTW: Have you already tried to zip your JSON?