|
Is it possible to acheive "screen" blending with al_set_blender()? |
Tumlee
Member #15,061
April 2013
|
I want to set a certain blending mode that I have used in previous games, called "screen" blending, which results in a color that is always at least as bright as the input colors, but is not the same as additive blending. More details about it can be found here. Basically, I want the resulting color to be the following: r = 1 - ((1 - sr) * (1 - dr)); g = 1 - ((1 - sg) * (1 - dg)); b = 1 - ((1 - sb) * (1 - db)); Is this at all possible using al_set_blender() or am I going to have to do this sort of stuff with my own code? |
Edgar Reynaldo
Major Reynaldo
May 2007
|
Rearrange your formula a bit to see which blender you need : r = 1 - (1-sr)*(1-dr) so r = sr(1 - dr) + dr or r = sr + dr(1 - sr) So, use al_set_blender(ALLEGRO_ADD , ALLEGRO_INVERSE_DEST_COLOR , ALLEGRO_ONE); or That should get you your 'screen' blending back. My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
Tumlee
Member #15,061
April 2013
|
Thank you very much! It's amazing how I can pass calculus and then trip over my own feet on basic algebra. |
Arthur Kalliokoski
Second in Command
February 2005
|
It takes constant practice to maintain. They all watch too much MSNBC... they get ideas. |
|