material.set_shader_param("mask", preload("pathtoyourtexturehere"))
It is in built-in documentation ;). The only problem is referencing the material. Take a note what material path You are using - it can be mesh.material or surfacegetmaterial(surface) or materialoverride or even drawpass.material