• Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

Question - Code Problems with bm_add

IGameArt

Member


So I'm hoping the image is self explanitory. My flare sprites have a box around them when being drawn with
Code:
gpu_set_blendmode(bm_add)
The backgrounds are black. The only "fix" I've found for this is to hard code the transparency into the image, but this shouldn't be happening in the first place. Does anyone know what could be causing this?
 

Joe Ellis

Member
They will add alpha, so if theres something blending with alpha..
Can you make a shader output 0.0 alpha, while all rgb still goes through?
I think I did that with bm_subtract before
 

IGameArt

Member
If that were the case couldn't I just set the sprite alpha to zero and draw it with bm_add then? or am I mistaken in understanding how this works?
 

Joe Ellis

Member
No I think everything needs alpha, so normally when you draw something in additive mode it already has alpha and caps at 1, so most things will appear normal, if you set alpha to zero (in add mode) it will add zero alpha, resulting in completely transparentness, it could depend what alpha has been set before hand to those pixels, so if your using a surface\layer thats filled with zero alpha, (like when you do draw_clear_alpha(0, 0) no alpha gets added, the rgb values still might, but they wont show up without some alpha added, I was gonna say the solution would be to do draw_clear(c_black) so its got full alpha, but it seems like that surface your using needs alpha, I don't know tho, I don't know what your setup is like,
I just know that if you've got a zero alpha surface to begin with: draw_clear_alpha(c_black, 0), and in additive mode, your gonna need to add some alpha to the pixels before they show up anything, that still doesn't explain the problem with the highlighted squares, sorry! but I feel its something to do with those things I mentioned
 

IGameArt

Member
I'm not drawing to a surface though. I'm just drawing these normally, then taking sending a copy of the application surface through a few shaders. But regardless, this very likely isn't surface related.

My fix for the time being is to filter all of my flares and glows and whatever sprites need to be drawn additiviely and converting them from full alpha to transparency using the brightness of each pixel to determine the alpha value. This seems to be solving the problem for me quite well, but it's a hassle when you can just draw an image with a black background and it would work normally.
 

Nocturne

Friendly Tyrant
Forum Staff
Admin
Can you share the sprite being used? Looking at that, it would appear that the "glow" of the sprite is larger than the size it's been cropped to.
 
Top