Convert StandardMaterial3D imported from blender to ShaderMaterial and keep it

Godot Version

4.3

Question

How do I preserve shader converted from material imported from blender?

Hey friends, I have some mesh made in blender and imported to Godot. The auto-import works fine except for those materials I need to convert them into ShaderMaterial:

The reason to convert them to ShaderMaterial is that I need to add some additional effect like waving effect (by changing vertex position) for grasses. The problem is, every time the blender file has been changed, the auto-import process override everything including material so I have to not only convert it but also rewrite code (fortunately it is not too much for now) in shader editor again.

One solution what I can think of is disable import once first import is done. But if the mesh changed in blender, I have to manually do import again and the above problem is still there. The only improvement is that the shader will not be replaced unexpectedly.

So is there a better way to preserve the converted shader in this scenario?

Regards,
Azure

You can save your material seperately and either use GeometryInstance3D’s material_override or specify an external material in the advanced importer.

Do you mean ShaderMaterial? I can do it but if the original material gets updated in blender, it will not automatically update my ShaderMaterial. I like how current auto-import pipeline works so I prefer keeping it as long as possible.

I tried material_override and material_overlay but neigher works for me:

  • material_override - it overrides the default material so I lost all albedo and other parameters.
  • material_overlay - while I can do additional shading in fragment(), moving coordinates in vertex() doesn’t work on the orginal mesh. It simply add a ‘new moving mesh’ with grey color.