• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Legacy GM 'Screen' blend mode in Gamemaker

Hello everyone,

What blend mode in Game maker would be considered the technical equivalent of 'Screen blend' in say, Photoshop?

Cheers,
Nathan
 

Tthecreator

Your Creator!
There doens't seem to be any. What screen does it it inverts the 2 given pixels, multiplies them and then inverts that answer again.
Like this:
c=1-((1-a)*(1-b))

One solution is to draw both images to a surface using different blendmodes like: bm_inv_src_colour, bm_inv_dest_colour, bm_multiply. Those are probably the one's you will need.
However this will require a lot of copying over from surface to surface and thus a shader approach would be the best.
Just pass in your two textures and you should be able to get it to work.
 
The shader approach does sound better.
This is for parallax scrolling backgrounds, and I am unsure of the approach.

Step 1: Pass background texture into shader, invert then multiply then invert all the pixels.

Step 2: Pass foreground texture into shader, invert then multiply then invert all the pixels.

Step 3: Mix texture 1 and texture 2, reset shader? (draw)
 
R

renex

Guest
in this case you'd pass texture 2 as a sampler and then draw texture 1. this would give you both textures in the shader, then you can sample and mix them with simple math and output the finished color to gl_fragColor. no other steps required.

now, if you want to use whatever's behind in the math, then you gotta figure out how to do that with blend modes... because you can only do up to that with the shader before the blend mode finishes it (blend modes are actually hard coded and run after the shader is finished). it might be impossible with that complex formula.
 
Top