2D Mask that does nothing but hide content

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

Is there a way to make a mask, perhaps as a child of a 2d image/sprite, that does nothing but hide portions of it? either through making an entire node used as a shader, or using a singular node.
I tried the SpriteMask.zip here and it is not what I’m looking for. I also tried finding tutorials on this subject but came up blank.
The SpriteMask.zip’s shader applies a global shape to an image, while I just want to manipulate images/sprites while under a mask.
I tried demonstrating it with basic polygons and shapes:
enter image description here

enter image description here

The image isnt being hidden, more like the pixels of the viewport or the parent, the red being the mask, hiding the orange bar.

I feel like this would be incredibly useful in the long term, so if there is a way to do this, that’d be wonderful.

:bust_in_silhouette: Reply From: Gluon

I dont know if there is a mask to hide part of a node but I can suggest another alternative. You could create a scene of the polygon shape made up of several different polygons. Then you can control it but turning the visibility of the specific parts of the polygon shape off.

If i wanted to be non-flexible with how the mask is represented, that is definitely an alternative. I’m thinking more along the lines of how a control’s rect size + clip content can be used to obscure it’s content when outside the bounds. Though, obviously, instead of a control it is a polygon/image that can be changed to the user’s will, as a square won’t help much in the grand scheme of things.
Perhaps a polygon container of sorts?
enter image description here

Nathan R. | 2021-11-28 21:54