How to refer to the Shader of Material Overlay of GeometryInstance3D of MeshInstance3D in gdscript? My .gdshader has some parameters and it is being used in the Material Overlay of the aforementioned GeometryInstance3D. I would like to refer to it. How to do that?
func get_shater_resource(This : MeshInstance3D) -> ShaderMaterial:
var Mat : Material = This.get_active_material() # or get_surface_override_material() if its an ovveride
if Mat is ShaderMaterial:
return Mat
else:
print("woops, that material wasnt a shader")
return null
you can use ShaderMaterial.set_shader_parameter(name, value) if you want to set the paramter in code. if you wanted to return the parameters or get the actual shader file itself, you can return ShaderMaterial.shader (as long as the return type is correct) and call get_shader_uniform_list() and it will return you some values you can use