#pre-multiply alpha with additional alpha?

1 messages · Page 1 of 1 (latest)

thorn kiln
#

Tagging @sick lava since you're the only one who has been able to help me with pre-multiply alpha rendering in the past. I have this code:

    // pre-multiply alpha!!!
    gpu_set_blendmode_ext(bm_one, bm_inv_src_alpha);
    
    draw_surface_ext(surface, x, y, 1, 1, 0, c_white, alpha);

The pre-multiply alpha is here because I've drawn text to a surface and need to then draw that to the screen without getting weird artifacting -- Juju helped me with this ages ago. Now I'm trying to additionally modify the result with another alpha value (so I can animate the alpha without rebuilding the surface). However it doesn't actually respect it, I'm guessing because of the blend mode shenanigans. Is there any way to actually make this work?

sick lava
#

need to write a shader that multiplies the RGB with A

thorn kiln
#

shaders! shakes fist

sick lava
#

hehehe

#

it's an easy one

#

certainly within your grasp

thorn kiln
#

I used to write shaders for oblivion mods but I've never taught myself to do it in GML land

sick lava
#

never too late to learn!

thorn kiln
#

yeah I just did some hacky shit for now though 😄 (rebuild the surface every frame the animation is going 🤷‍♀️)

teal path
#

I'm glad that threads like this already exist