Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: mode7 on Mon 13/12/2010 12:10:04

Title: Screen and Multiply drawing - is this possible?
Post by: mode7 on Mon 13/12/2010 12:10:04
Is there any way to draw a dynamic sprite in a different blending mode? Like screen or multiply? Or is there at least a function to change color values per pixel when drawing sprites, so I could do the calculations myself?
Title: Re: Screen and Multiply drawing - is this possible?
Post by: Dualnames on Mon 13/12/2010 13:42:03
There's AGSBlend that offers that, not sure how much it resembles the photoshop effect. I haven't tested it, but go ahead and tell us if it actually works.
Title: Re: Screen and Multiply drawing - is this possible?
Post by: Calin Leafshade on Mon 13/12/2010 14:00:32
yea, AGSBlend can draw onto sprites in different blending modes with some caveats (must be 32-bit sprites for instance)

AGSBlend also provides GetAlpha and PutAlpha which allows you to alter the alpha channel of an image like GetPixel and PutPixel lets you change the other three channels.

It's not super quick though.. remember this is allegro and so everything is all DirectDraw compatible.
Title: Re: Screen and Multiply drawing - is this possible?
Post by: DoorKnobHandle on Mon 13/12/2010 14:10:33
I have written a plugin that actually uses Direct 3D 9 that achieves the same effect. It runs extremely fast (I tested like 6-8 layers of "add" layers at 1024x768 and it didn't not slow down at all) but it forces your players to use the D3D9 driver instead of Direct Draw (which means they have to have a graphics card that supports pixel shaders). Also, your layers have to be power of two-sized (ie. 512x512 or 1024x1024 for example), but they will be stretched across your room properly of course. The plugin will be used in Fountain of Youth and it is still being tested, might be released pretty soon though depending on how much time I get and how many people are interested. Oh yeah, it currently only supports the Photoshop blend mode "add", too, not quite sure if the others are possible in D3D9.
Title: Re: Screen and Multiply drawing - is this possible?
Post by: Knox on Tue 14/12/2010 01:44:44
Count me as one person interested in that plugin :)
Title: Re: Screen and Multiply drawing - is this possible?
Post by: mode7 on Tue 14/12/2010 20:47:54
First of all, thanks for the help - fall I'm not sure if this is what I need.

I was trying to write an anaglyph module for AGS.

The idea is drawing the screen twice simultaneously by having a doublesize background. And then blending screen 1 and two via additive blending by drawing a dynamic sprite.