How do I change the material on an imported FBX mesh to a ShaderMaterial?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By indiejames

I am trying to change the material on an imported FBX file to a ShaderMaterial so I can add effects to it at runtime. This is the approach I have tried so far:

  1. Open the imported file and select ‘New Inherited’ when it warns about opening it
  2. Save the inherited file under a different name
  3. Select the MeshInstance and then click on the dropdown menu next to the Material entry and select ‘ConvertToShaderMaterial’
  4. Select ‘Edit’ from the material dropdown menu
  5. Select ‘Edit’ again for the material after it opens
  6. Edit the shader code and save it.

At this point I see the mesh in the window rendered correctly, but when I add the scene to my main scene and run the game the model uses the original material.

:bust_in_silhouette: Reply From: Inces
  1. Material property is tricky, You can find it in 3 places for single instance and they override each other. Lowest in hierarchy is mesh material, above it - mesh instance surfaces material, and highest - material override of mesh instance. You must have edited material that is lower in hierarchy. Check all of these 3 properties or simply add your shader to “material override” property.

  2. I only use GLTF, so I don’t know how FBX work. It may be, that You exported materials as built-ins and they might not be separated from model. In that case open your imported file in Godot and choose Import Tab menu, You will find several options there, including separating materials from mesh into individual resources.

  3. Or You did everything correctly, but in the end mistook imported scene for modified inherited scene. Whatever You do to .glb file does not get saved, even if it changes visually in editor

Thanks for your reply. I’m editing the Material property under Surface1 of my mesh instance, so the second level one in your list. The “material override” was not set so I set it to my shader and that worked. Thanks again.

indiejames | 2022-02-04 22:31