Resize shader mask to match sprite region_rect parameter

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

I need to use the Region Rect parameters to config the size of a sprite/shader. I cant use the scale property because it results in an ugly stretch. Using the region_rect the shader repeats the effect not stretching the image, which is good.

However, when reaching the limits of the region, i want the texture to softly be transparent. I was trying to do that using a mask, but when i add the mask to the shader i got this result:

Clearly i need to resize the mask to match the region_rect width/height parameter, but i don’t know how to do that.

If the path i’m taking is wrong, i appreciate if someone knows the correct way to do it.