44. Materials, shaders, animation and resource sharing
func make_material() -> StandardMaterial3D:
var material := StandardMaterial3D.new()
material.albedo_color = Color("caa46d")
material.roughness = 0.2
material.metallic = 0.8
return materialfunc run() -> float:
return make_material().metallicA loaded material/resource can be shared by multiple instances. Duplicate it before a local edit when other objects must keep their original appearance. material_override applies to the whole MeshInstance3D; per-surface overrides target a particular surface.
For ShaderMaterial, use set_shader_parameter with the exact uniform name from the shader. For AnimationPlayer, check has_animation before play; animation_finished is useful for a finite clip. A looping animation does not naturally emit a final completion you can wait for.
PCA can manage actor animation state, lip-sync, glow and materials itself. Direct writes can be overwritten by that system. Choose the PCA route for ordinary actor behavior; reserve direct Godot edits for a feature that owns that portion of the model.
Metallic/low roughness makes a reflective material response. A recognizable live character reflection needs the relevant rendering/reflection system; a material number alone does not construct a mirror camera.
