From what I can tell from my tests, it appears the alpha channel of the material/shader doesn't apply with the mix
/sub
/etc modes. I'm not totally sure why, but my guess is that the alpha channel is processed differently than the color.
You might need to write a custom shader and use a Viewport texture as the input. I wrote a tutorial on RandomMomentania that might help as a reference.
@Ephemeral said:
How would feeding an empty viewport texture to the draw_cirle(...) be different than just feeding it a Color with 0 alpha? The cache it draws to seems to operate in MIX mode with no way of changing that, so it just wouldn't draw anything.
You wouldn't be feeding an empty Viewport
node the texture, you'd instead render what the Viewport sees and use that as an input for the Shader. All of the shapes/things you want to use for removing pixels would be in the Viewport
node.
That way you could selectively mask/remove pixels in the main scene through a simple shader. That said, you'd need to separate the code that draws the scene and the code that uses draw_circle(...)
into separate nodes so the node that uses draw_circle
can be a child of the Viewport node.
The tutorial I linked above shows how this works in 3D. The same principles could be applied to 2D as well, you'd just need to make some minor modifications. I could probably make a quick example if you need.
That said, if you need layered rendering, where you draw one layer and remove pixels before drawing the next layer that (potentially) overlaps the first, then I'm not totally sure on what the best way to go about it would be. The easiest way I can think to work around it is to either draw each layer using separate Node2D
nodes, or find a way to not draw the pixels you are wanting to remove altogether.
You mentioned that Game Maker Studio 2 can do what you are wanting to achieve, right? Do you mind linking to the Game Maker Studio 2 feature so we can look at it? It might help us understand what you are trying to achieve, which may help us find a potential solution.