What's the difference between a Mesh's Material & Surface Material Overide

Godot Version

4.3

Question

Learning How to write shaders and saw people were using either the Mesh’s Material or the “Surface Material Override property” without explaining why or what the difference was. Tried looking it up in the docs but couldn’t find any explanations. Could someone let me know if/what the difference between the two is?

From GeometryInstance3D’s class reference:

The difference between a Mesh’s material and the associated material_override are hierarchical; the former is for the source mesh, and the latter is for the instance of that mesh. You can imagine a setup where you have multiple objects using the same mesh. If you wanted to change the material for one of the objects, you can’t simply change the material for the mesh that it’s using since that would affect all the objects – you have to override the material on the mesh for that specific instance.


Let me know if that clears it up for you.

To add to what @Sweatix said, it also depends on the import settings you use for your models. You cannot replace the Material of a MeshInstance3D object that you import from a .gltf or .glb (etc) unless you go to the Import tab, click the Advanced button, and set Mesh Save Paths. So if you don’t do that, Material Override is your only option.

Also, meshlibraries do not use the Surface Material Override property or the Surface Material Overlay property. They do have their own version you can use for override, but not overlay - and you have to edit that in the meshlibrary after you create it. There may be other gotchas in the system like that.

Finally, I will say that I have found it useful to add an “Original Texture” input in some of my destructive 3D visual shaders (like dissolves) so that I can show both the original texture and whatever effect I want on top. (2D visual shaders allow you to use the texture input, but it doesn’t exist for the 3D visual shaders.)

Ah that makes a lot of sense. Thank you

1 Like