• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Surface Transparency Issue

Mottafier

Member
Hello! I'm currently working on a local multiplayer game that utilizes dynamic splitscreen. When the players are close together, you both share one view, but when you move far apart enough, the view splits into two and they each follow a player.
gamemaker 1.PNG
The view on the left follows player one, and it really takes up the whole screen, it just gets covered by player two's view. The player two view (right) is a surface that gets drawn OVER the player one view, and uses blend mode subtract to take out the area where player one's view should be.
gamemaker 2.PNG
The image above shows just the surface that holds player two's view. The issue is, that anything transparent thats on screen when this surface is made seems to stay transparent, even with a solid color beneath it! The large green square here is transparent just to illustrate the issue better. The issue this creates is that when the second view gets drawn, anything transparent makes the surface partially transparent, and so anything in player one's view (left) bleeds through this surface. If you look close enough, you can see a "ghost" of player two to the right of the player in player Two's view in the first picture. I figured out this is due to the transparent surface showing player one's view beneath it. And for four brutal days I've been trying everything to fix it but nothing has worked.

This was a little tough to explain, so if I need to be more clear please let me know! Also I could post code, but I don't think it's necessary in this situation, however that can change if you'd like to see it.

Ideally, if there were a way for me to set the surface's alpha to 1 and THEN subtract the triangle where view one should be, that would work, but currently the best I can do is draw_enable_alphablend(false) and then draw player two's surface, which makes the whole surface opaque, which then covers up player one's view beneath it.

Thanks in advance, I hope this isn't unsolvable!
 
A

Annoyed Grunt

Guest
I'll be honest with you, your explanation of the issue is a bit confusing and I didn't understand it fully, so I'll just refer to your suspected solution:
Ideally, if there were a way for me to set the surface's alpha to 1 and THEN subtract the triangle where view one should be, that would work
You actually can do this by setting the blend mode to bm_add and drawing a black fill with 1.0 alpha. Since black has RGB (0, 0, 0) it won't change the color itself but it will max out the alpha.
 

Azenris

Member
not sure I udnerstand the question.

could you gpu_set_colourwriteenable(true,true,true,false); first, then draw to the surface.
then re-enable all, then do the subtract thing, then draw the surface to your app
 

Mottafier

Member
I'll be honest with you, your explanation of the issue is a bit confusing and I didn't understand it fully, so I'll just refer to your suspected solution:


You actually can do this by setting the blend mode to bm_add and drawing a black fill with 1.0 alpha. Since black has RGB (0, 0, 0) it won't change the color itself but it will max out the alpha.
IT WORKS thank you so much!!! I can enjoy life again!!!!!
 
Top