Surface, Blend mode question

L

Lars Karlsson

Guest
Hi there. First I'd like to give thanks to maartenvt for sending me on the right direction and I've gotten really close to my goal. Just one last step that I'm stuck on.
I'm quite bad at explaining so hopefully I'll get my question across.

Game without surfaces. What the game looks like without any surfaces.
Shadow1 A surface generated by a line-of-sight extention.
Shadow1 + Grass The game with the surface applied using draw_set_blend_mode_ext(bm_dest_color,bm_zero).
So far all good.

Now to the hopefully last step.
I want to achieve THIS with the help of either FOG1 or FOG2.
I basically want the 'fog' to only draw where it's black.

My best guess is to create a second surface which combines Shadow1 with either FOG1 or FOG2 and then draw that after the first surface. I've tried many different blend modes and combinations without result.

EDIT: I feel like drawing a second surface with FOG2 should do. But I must be using the blend modes wrong.

EDIT2: Using FOG2 above the first surface in Photoshop using the mode 'Lighten' achieves the right result. Is there a blend mode in GM that work just like the 'Lighten' mode in photoshop?

I'd love to hear any suggestions. I'm just completely stuck on this. So close to achieveing what I want. :mad:

/Thanks
 
Last edited by a moderator:

jo-thijs

Member
Best way is to have Shadow1 as an alpha map, where the black part has alpha 0 and the white part has alpha 1.
You can then draw Shadow1 on the game without surfaces with the blend mode (bm_zero, bm_src_alpha).
Then draw FOG1 to the result using the blend mode (bm_one, bm_inv_src_alpha).
And that should do the trick.

The only question is, how are you going to make the alpha map?
For that, I would need to know how you currently draw Shadow1.
 
L

Lars Karlsson

Guest
jo-thijs thanks for your input! :D Finally managed to figure this one out.
I ended up using drawing the FOG1 ontop of Shadow1 + Grass with draw_set_blend_mode_ext(bm_inv_src_colour, bm_one )

Here's the result. A bit rough atm, but it's definitely working.

SurfaceFog.gif
 

Pkirkby

Member
I'm doing a similar thing with my night cycles, but I can't even figure out how to bm_subtract my "torchlight" from the dark blue surface I draw for my nighttime. I imagine its simple, but Im not sure where to start.
 
Top