Application surface - Alpha issues

A

AlmostOutspoken

Guest
Hey there!

I'm having some issues with rendering the application surface to a separate surface, related to alpha values carrying over. I've read the YoYo Games tutorial related to this issue but am having trouble solving the issue myself.

The problem that I'm encountering is the following:



In the above image, you can see that the lights and player shadow are solid and blending properly. This is how the game looks normally while playing.



In the above image, you can see the results of me drawing the application surface to another surface, and then saving it to a file. The area around the player shadow and lights is partially transparent, having carried over the alpha values from the sprites themselves.

I would like to prevent this from happening; ideally the new surface should be 100% opaque so that it looks exactly like the player sees it. The code that I'm using to create this surface is:

Code:
if (!surface_exists(screenshotSurface))
    screenshotSurface = surface_create(view_wview[0], view_hview[0]); 
           
surface_set_target(screenshotSurface);
           
draw_set_alpha(1);
draw_clear_alpha(c_black, 1);
draw_enable_alphablend(false);
           
draw_set_blend_mode_ext(bm_one, bm_zero);   
draw_surface(application_surface, 0, 0);
           
draw_enable_alphablend(true);
draw_set_blend_mode(bm_normal);
           
surface_reset_target();
As you can see, I've tried a couple of solutions already (and at this point am potentially mixing fixes). Any help would be appreciated!
 

jo-thijs

Member
Hi and welcome to the GMC!

I think you should just get rid of the draw_enable_alphablend functions in that code to fix the issue.
Did that do the trick?
 
A

AlmostOutspoken

Guest
Thanks! I've been around for years, but just now got around to making a new account :)

Getting rid of the draw_enable_alphablend functions doesn't appear to change the result; parts of the surface are still semi-transparent.
 
A

AlmostOutspoken

Guest
The result I get now is:



Seems like the transparency is now partially black.
 
A

AlmostOutspoken

Guest
It looks like the (bm_one, bm_one) blend mode solved my problem! I appreciate the help :)

Is there any way to accept an answer on the new forums?
 
Top