Import and export of materials

I have started looking into the collada import and export for blender 2.8. In particular i am setting up the Material exporter and importer. Here i need some help to understand what users actually need and how we could support this best.

Import
For Import i have decided to use a principled bsdf shader since that is the default anyways.
For simple material definitions i can do something like this:

  • Set the default values for diffuse color and specular color directly inside the Shader
  • For Transparency i can add a “Transparent bsdf” shader
  • For Emmission i can add an “Emission shader”

So here is my first attempt. This node tree is actually already created by the Collada Importer:

Texture support is not yet implemented but its in the todo list :wink:

Question: How to handle Phong, Blinn and Lambert ?
Export
For export i have other issues. Especially from where shall i get the data? For now i search for a principled
bsdf shader in the material. If there is none i fallback to the material definitions for when use nodes is disabled. But that looks like not very useful?

Any advise for where to proceed with that is very appreciated :slight_smile:

I suggest to try to match Python helper module as closely as possible, for consistent result:
https://wiki.blender.org/wiki/Reference/Release_Notes/2.80/Python_API/Modules#Shader_Node_Import_.2F_Export

For export of emission and transparency the situation is weak still. We need to add support for those to the Principle BSDF to make this easier, but I’m not sure exactly when it will happen. You could try to automatically detect a similar node setup as you are creating for export, I don’t have a better suggestion until we extend the Principled BSDF.

I would recommend looking at the new and official GLTF plugin for blender as it supports already material export and imports.

Sketchfab have been using the addon as well for theor sketchfab addon which imports PBR materials into the eevee viewport.

Good luck

1 Like

Any suggestions for import/export of Shadeless (Unlit) materials?

We’re looking at how to implement that in the glTF importer/exporter (see https://github.com/KhronosGroup/glTF-Blender-IO/issues/220) and have considered using Background, Emission, or Image Texture and RGB nodes, but none seem quite appropriate or intuitive. Is something like a Shadeless checkbox likely to return in 2.8, or should we go with another option?