How can i have a shaderscript edit existing surface materials of a mesh without overwriting them completely?

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

for the purpose of seeing my map from a top-down perspective in 3D and the map’s interiors not being obstructed by the roofs of buildings; i have a script for cutting off the alpha of all materials in my map above the height_uniform value like this:

(using render_mode world_vertex_coords;)

uniform float height_uniform = float(6.0);

void vertex() {
world_vertex = VERTEX.y;
}
void fragment() {
    if (world_vertex_y > height_uniform){
	    ALPHA =0.0;
    }
}

but it needs to be re-implemented across all my map materials, and all my map’s materials need to be in the shaderMaterial format to support it which is tedious as heck.
Is there no convenient way to apply this script across all materials?

if there’s a way to Convert To ShaderMaterial via gdscript, then i could create a script for automatically implementing this functionality if there’s no way for a script that overrides only the alpha value of the existing surface materials. but that’s the final option.