• Godot Help
  • Automatically use the correct custom materials on obj / mtl meshes

Sometimes I download a package containing multiple models meant to use common materials on various surfaces, usually in obj + mtl format for most stuff I find on OpenGameArt. Obviously I need to create a material for each surface in Godot itself. What I wish I could avoid is manually having to set it on each model, instead of each obj automatically knowing which material I want when I drop it into the scene. As it stands I always need to use the Surface Material Override section, which also makes me feel like I'm doing it wrong as the proper materials should be in use by default... the basic materials defined with the mesh have their properties grayed out.

Is there a way of telling Godot to always map a material name in an obj / mtl to my material resource whenever one is detected? Or can I replace the entry in the obj / mtl in a text editor to automatically point it to the material in Godot, in which case which fields do I want to replace and how? I take it I want to edit each usemtl line in the obj and point it to my tres, though I imagine it's probably not that simple.

I tried removing the mtl but that doesn't help, only adds an additional error about it missing. As you can see on the right panel, both the Name and Material of each Surface # section are grayed out, which makes sense as they're a property of the obj which is a resource that shouldn't get edited by Godot. Still is there no way to automatically point them to a material in my project instead of the builtin mtl, even by editing the obj in a text editor to batch-replace the material references?

The Godot importer for 3D assets is pretty bad honestly. It never does what you want.

The way to fix this, is to double-click on the asset, choose "Open Anyway" and then save it as a new Scene. In this scene you will be able to edit the material or change settings.

Then in the material, click the Save As button, and save it with a name. This is required, as you will have to reapply it if you reimport the asset.

Honestly, it seems like no artist ever used Godot or even tested this stuff, because the workflow makes no sense at all.

    cybereality I noticed that functionality yesterday. The mesh will no longer be an obj in that case but stored directly as a tres / scene... does that matter though? It would be interesting if there was a basic model editor in Godot so this stuff could be made directly, of course we don't want to turn Godot into Blender by going too far so I understand if not.

    Does the importer at least currently let you batch convert a directory of obj models to tres or tscn scenes? Or is the only way to do it for each one manually? Or by using a script, in which case does anybody know of one that will work? tres / tscn are also text formats IIRC, so if the conversion process is done I can easily grep and replace to point them to the right material.

    cybereality Honestly, it seems like no artist ever used Godot or even tested this stuff, because the workflow makes no sense at all.

    Rather not enough of them have complained on the tracker about it.