Changing the color scheme of an imported GLB file

Godot Version

4.3

Question

Hey all,

I have been creating some simple models using AssetForge (Asset Forge · Kenney) for my game. Here is an example airplane (it’s very simple):

AssetForge allows exporting these models in various file formats. I have chosen the GLB format since it is highly compatible with Godot.

Anyway, I’d like to allow the player of my game to be able to choose the “color scheme” for these models. So, for example, the default color scheme as shown in the image is purple/white/black. I’d like to allow players to switch those up. For example, they may want to change the purple to orange or blue or green.

How am I able to identify and modify the material/color of a piece of an imported GLB 3d model programmatically / in code? I am using GDScript.

Any help would be appreciated. Thank you!

Depends on what asset forge does to make these models. Overall you will be using a surface material override, if it’s a swatch texture then only one material will need overriding, otherwise you may have to find out which surface material slot needs overriding for each color.

You can make an Inherited scene from a GLB, or add the GLB to an existing scene and select “editable children” to poke around at the present mesh instances and their materials.