GS handles 'Multiply' blend mode incorrectly.

SocksSocks London, UK.Member Posts: 12,822
edited February 2013 in Tech Support
I'm struggling to work out a way around this one . . .

me: 8-X

Basically when using 'Multiply' (blend mode) GameSalad screws up the alpha channel and renders it as black:

What I am doing is fairly straightforward - I am trying to place an image with an alpha channel on top of another using the 'Multiply' blend mode, like this:

image

This is basically what you should get:


In Photoshop:

image

In AfterEffects:

image

In Sumopaint:

image


. . . . etc etc, basically whatever software you use they all handle multiply + alpha channel identically.

But this is what GameSalad does:

image

Usually there's some sort of way around these problems, but I'm completely stumped, can't work out how to get a multiplied image with an alpha channel to work in GameSalad.

Any input appreciated !
«1

Comments

  • DoguzDoguz Member Posts: 500
    Could this be achieved with no blend mode? And just using png transparencies?
  • SocksSocks London, UK.Member Posts: 12,822
    Could this be achieved with no blend mode? And just using png transparencies?
    Unfortunately not, ignore the images above, they are just there to illustrate the issue, with the actual images I am using I need to be able to use multiply.
  • POMPOM Member Posts: 2,599
    edited February 2013
    @Socks

    Yeah GS handle it in its own way, if your image background will be white instead of alpha channel i think youll get the desired result (from my testing few months ago with blending modes)

    Also, sent them reports about this, and yet again, no respond.. ;)

    Roy.
  • SocksSocks London, UK.Member Posts: 12,822
    @Socks

    Yeah GS handle it in its own way . . . .
    That's one way of putting it ;)
    if your image background will be white instead of alpha channel i think youll get the desired result (from my testing few months ago with blending modes)
    Yeah, that was one of my first experiments trying to resolve this, but it screws up the antialiasing on the edges of my actor (the 'multiply' actor is layered over another actor the same size) - it also doesn't allow you to control transparency, when you change the alpha to 0.5 (for example) the actor doesn't become more transparent, it become more black ! So making the actor's alpha=0 results in a solid black actor - instead of a transparent actor.

    :((
    Also, sent them reports about this, and yet again, no respond..
    Yep, there's a reason I posted this in tech support rather than sending in a bug report, posting it on the forums might generate a few ideas/workarounds from people - going through the bug reporting system is the same as writing out the issue on a piece of A4 paper, folding it up, placing it in the toilet and pulling the 'send' chain. 8-X :))
  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922
    Ah socks I see I inspired you 8->
  • capitalcarnagecapitalcarnage Member Posts: 371
    Off topic but.... Whats the elephant lieing about?
  • SocksSocks London, UK.Member Posts: 12,822
    Ah socks I see I inspired you 8->

    ?

  • SocksSocks London, UK.Member Posts: 12,822
    Off topic but.... Whats the elephant lieing about?
    It's a random image off he Internet, but I expect it's something to do with anthropology / ethology or gambling debts.
  • cerealcereal Member Posts: 6
    Actually screen mode is different from photoshop too (brighter in gs iirc), Ive gone back to just using normal blendmode now.
  • capitalcarnagecapitalcarnage Member Posts: 371
    Typical elephant always betting on red
  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922
    edited February 2013
    I made the video tutorial about blend modes to answer your "?"
  • SocksSocks London, UK.Member Posts: 12,822
    I made the video tutorial about blend modes to answer your "?"
    Ah yes ! It's all coming back now ! :)

    Unfortunately the multiply is bust !
  • SocksSocks London, UK.Member Posts: 12,822
    Actually screen mode is different from photoshop too (brighter in gs iirc), Ive gone back to just using normal blendmode now.
    Yep, they are all a bit off, they really shouldn't be as they are specific mathematical operations based on pixel values.
  • SocksSocks London, UK.Member Posts: 12,822
    Typical elephant always betting on red
    Never trust anyone with a nose longer than their arms.
  • BlackCloakGSBlackCloakGS Member, PRO Posts: 2,250
    edited February 2013
    We use the OpenGL default blending mode equating
    "Cf = (Cs * S) + (Cd * D)
    Here, Cf is the final computed color, Cs is the source color, Cd is the destination color, and S and D are the source and destination blending factors. "
    For GameSalad Multiply blending mode S= GL_ZERO (which is 0) and D = GL_SRC_COLOR (which is Cs)
    For more info on OpenGL blending equations see link above
    There is also a cookbook page describing the different blend modes
    Hope this helps
  • PixelMetalPixelMetal Member Posts: 283
    edited February 2013
    We use the OpenGL default blending mode equating
    "Cf = (Cs * S) + (Cd * D)
    Here, Cf is the final computed color, Cs is the source color, Cd is the destination color, and S and D are the source and destination blending factors. "
    For GameSalad Multiply blending mode S= GL_ZERO (which is 0) and D = GL_SRC_COLOR (which is Cs)
    For more info on OpenGL blending equations see link above
    There is also a cookbook page describing the different blend modes
    Hope this helps
    If this is the case, why does an image with areas that are 100% transparent render as solid black when it shouldn't render at all? Is the alpha being ignored/discarded? Why does white render at all, when Multiply should make white 100% transparent, including in the standard OGL blending modes?
  • HoneyTribeStudiosHoneyTribeStudios Member Posts: 1,792
    Makes things a bit more... human... round here when the GS devs post stuff.

    Although granted you'd need a high patience threshold and thick skin to do it regularly.
  • BlackCloakGSBlackCloakGS Member, PRO Posts: 2,250
    from coookbook
    multiply: multiplies the color values of the actor's pixels with the background. This tints or darkens the background image, and is useful for gradient overlays, tinted windows, shadow effects, or masking. Using transparency combined with multiply will have strange results, and should usually be avoided.
  • SocksSocks London, UK.Member Posts: 12,822
    edited February 2013
    We use the // OpenGL default blending mode . . .
    Thanks for the reply.

    The way multiply is implemented differs from every other implementation of multiply out there, Shake, After Effects, Sumopaint, Cinema 4D, Photoshop, Lightwave . . . etc etc

    The way it's implemented in GameSalad makes it enormously less useful than it could be, on first glance it appears to be a bug, but you say it's actually designed this way ?

    From what I can see rendering the alpha channel as solid black offers no advantages over the way multiply is implemented everywhere else - and brings with it significant disadvantages.
  • SocksSocks London, UK.Member Posts: 12,822
    from coookbook
    multiply: multiplies the color values of the actor's pixels with the background. This tints or darkens the background image, and is useful for gradient overlays, tinted windows, shadow effects, or masking. Using transparency combined with multiply will have strange results, and should usually be avoided.
    Are there any plans to address this in the future ?
  • SocksSocks London, UK.Member Posts: 12,822
    If this is the case, why does an image with areas that are 100% transparent render as solid black when it shouldn't render at all?
    Yep, agreed, by any definition of 'multiply' (including, from what I can see, the one linked to in BlackCloakGS's post) transparent pixels should render as transparent - even when using 'multiply'.
    Is the alpha being ignored/discarded?
    It does look like when using 'multiply' the alpha channel is simply ignored.
    Why does white render at all, when Multiply should make white 100% transparent . . .
    Actually that part works fine, white is rendered as transparent with GameSalad's multiply mode.
  • PixelMetalPixelMetal Member Posts: 283
    edited February 2013
    If only that were the case. On Windows, 100% white (255,255,255) still darkens what's behind it, and on Android the same happens (at least, on nexus/nexus 7/tf101/mk808/evo 4g/htc oneX). I'll poke around more and see if maybe GS just doesn't like my PNG files run through PNGGauntlet for optimization/Photoshop optimized files...couldn't hurt to try.
  • SocksSocks London, UK.Member Posts: 12,822
    edited February 2013
    If only that were the case. On Windows, 100% white (255,255,255) still darkens what's behind it . . . .
    I see, I wasn't aware of that, it sounds very much like a non-standard implementation of 'multiply' is at play here - even given the technical reference made by BlackCloakGS I'd still say it's screwed - or at the very least the interpretation of how the alpha channel data should be handled is screwed.
  • BlackCloakGSBlackCloakGS Member, PRO Posts: 2,250
    edited February 2013
    @Socks I agree with you, some thing is weird with the alpha (You can ever reproduce this with out an image on the actor). I think you should file a bug report and at the very lest we should revisit what the multiply blend is supposed and how it works on each platform.
  • POMPOM Member Posts: 2,599
    edited February 2013
    @Socks whats the problem fill up a bug report :))

    Roy.
  • mrpacogpmrpacogp Member Posts: 400
    Then, why when you use a background colour, you have a value on iPhone 4 and another on iphone 5?
    I have tested with a real device, and trying to make the same color of background and one actor. On all devices lower than iphone 5 works, but this last differs a little.

    Apologyze about to use that thread, but i have see there is speaking too how GS use colours.
  • SocksSocks London, UK.Member Posts: 12,822
    edited February 2013
    @Socks I agree with you, some thing is weird with the alpha (You can ever reproduce this with out an image on the actor).
    I've found that when using 'multiply' on a blank (imageless) actor changing the alpha channel has no effect whatsoever, it doesn't fade when the values lower towards 0 nor does it turn black (as when you have an image is applied to the actor). Basically, yes, agreed, there's something odd going on down in the engine room.
    I think you should file a bug report . . .
    :)

    Honestly !?

    and at the very lest we should revisit what the multiply blend is supposed and how it works on each platform.
    Ideally multiply (and all the blend/transfer modes) would mirror the same functionality found on other applications like Photoshop.

    Anyhow, cheers for the reply, appreciated.
  • SocksSocks London, UK.Member Posts: 12,822
    edited February 2013
    @Socks whats the problem fill up a bug report :))

    Roy.

    Done ! (I took a picture in case you didn't believe me):

    image
  • BlackCloakGSBlackCloakGS Member, PRO Posts: 2,250
    edited February 2013
    @Socks After reading through the Opengl ES 1.X spec sheet it turns out that OpenGL does not guarantee the framebuffer to have an alpha channel. It is optional. So for Creator and at lest the iphone (I have not tested android) the framebuffer does not have an alpha channel. Any alpha value calculated is thrown away and 1(opaque) is used (as per OpenGL spec). That is why you can not rely on blending the alpha channel when using blend modes.
    Hope this helps.
  • SocksSocks London, UK.Member Posts: 12,822
    edited February 2013
    @Socks After reading through the Opengl ES 1.X spec sheet it turns out that OpenGL does not guarantee the framebuffer to have an alpha channel. It is optional. So for Creator and at lest the iphone (I have not tested android) the framebuffer does not have an alpha channel. Any alpha value calculated is thrown away and 1(opaque) is used (as per OpenGL spec). That is why you can not rely on blending the alpha channel when using blend modes.
    Hope this helps.
    Cheers for looking into it, much appreciated, is there a way around this or are we stuck with it like this ?
Sign In or Register to comment.