Export custom ShaderMaterial as material for blender

I am currently using THREE.OBJExporter() to export meshes with their materials in the obj format. But I also have several custom material shaders that I would like to use as well mostly to import in Blender. Is there a way to directly export the instance of a ShaderMaterial in a mtl file like the OBJExporter ? Should the shader be reproduced in Blender?

Thanks

THREE.OBJExporter does not support materials. But GLTFLoader does. Is there a special reason for still using OBJ? glTF is the more modern standard and actually the recommended 3D format of three.js. You can import and export glTF with the latest Blender version.

https://threejs.org/docs/index.html#manual/en/introduction/Loading-3D-models

Exporting ShaderMaterial to any kind of 3D standard will not be supported since this type of material represents custom shaders. There is no guarantee that your (arbitrary) material can be converted to the material definitions of a 3D format.

Is there any example,tutorial,reference on how to code for and export a ShaderMaterial to a material?
If so, I could probably improve these shaders.
For example, would it be possible to save a shader as a texture and export it with the mesh?

1 Like