I've tweaked the lighting system a bit
Old Version
New Version
I think the new one has better blending? It's kinda hard to tell with the gifs. Tomorrow I'll see about making a video or maybe just zooming in before recording the gifs.
#GameDev Support me with biscuits ;)
Last Progress Post (July):
https://www.patreon.com/posts/85745632
DevAccount: @thrallgames
Thrall of Time⌛️
I've tweaked the lighting system a bit
Old Version
New Version
I think the new one has better blending? It's kinda hard to tell with the gifs. Tomorrow I'll see about making a video or maybe just zooming in before recording the gifs.
I thiiink the problem is when a light is drawn to the lighting mask, you're using regular blending, not additive.
Here's how I'd expect the mask and final result to look like for a few pure red/green/blue/white lights on a grey background: https://i.imgur.com/wO4AC8x.png
Well I've went through every combination and this is the best I've got. I can get the colours to blend but the white doesn't eat into them.
https://i.imgur.com/WFVPxET.png
Additionally I Increased the alpha for the coloured lights to 1, from 0.5.
Every tutorial I can find for game maker says to use bm_subtract for lighting :S
Great!
Ok so what I was doing was;
draw_set_blend_mode(bm_normal); surface_reset_target(); draw_surface(surf,_cx,_cy);
Now I'm
draw_set_blend_mode_ext(bm_dest_colour,bm_inv_src_alpha); surface_reset_target(); draw_surface(surf,_cx,_cy); draw_set_blend_mode(bm_normal);
I'm not sure things are quite right, over lapping white light seems wrong? They have an alpha of 0.7, so I'm guessing they're being added and an alpha of 1.0 is just way too bright with my current system.
https://i.imgur.com/lsFqnin.png
Also, I seem to have broken rooms being lit up at some point, probably when I was changing depth for my flooring.
Hm yeah it looks like a HDR effect haha ☀
Your new blendfunc looks fine for multiplying the mask to the screen. Your mask shouldn't actually have any transparency though, so honestly the second parameter could be zero and it shouldn't have an effect. You also did (zero, src_color) in a previous comment to me; that should have worked as well. :o
As for drawing the sprites to the mask, (bm_one, bm_one) should normally work, but if it's literally doing HDR, perhaps (bm_one, bm_inv_src_alpha) is better for that.
I'm not sure what else to recommend!
Using zero though gives me total darkness except where the lights are. So unless I'm going to make the light circles much bigger, or give them multiple it's gonna be VERY dark!
That's actually perfect! You can control that by how "black" the mask is to start.
That can be used for lightning flashes, vignettes, etcetc. Think of it as ambient lighting
Hmm, I've been messing with it, and I can't get the black mask to be anything other than solid (except where the lights are) Pfft, I'll figure it out eventually!
Haha! Had to make a white square first, then a black one with whatever level of alpha I want! Now It works.
Hurray! I'm so glad you pushed through 'til the beautiful conclusion.