I’m trying to export GLTF files in three.js, but all my meshes are using ShaderMateraials and GLTFExporter doesn’t support them.
I would like to know the reasons why this specific material is not supported in order to find an alternative to my problem.
If I can’t fix it via WebGL (Three.js) I was wondering if I could do the exportation using OpenGL, does that make sense? Do you think It may be possible?
glTF has a material specification whereas ShaderMaterials represent custom and thus arbitrary shader code. This code can’t be just exported to glTF and no other 3D standard.
No. three.js is a WebGL engine. OpenGL is totally unrelated.
The only way to retain shader materials is the usage of the three.js JSON format. You can produce this format by using calling scene.toJSON();. The resulting JSON can be loaded via ObjectLoader.
Hi Mugen,
The exportation with JSON seems to work fine for me, but it is huge in size in my model. There’s a way to export the ShaderMaterial (vertex+fragment) and the OBJ Model and then load this data?