Jump to content

AS3 BlendMode.LAYER


Migi
 Share

Recommended Posts

Hello,

Is it possible to achieve the same effect in Pixi.js as what BlendMode.LAYER does in Flash? Here's a good demonstration of what BlendMode.LAYER does: http://www.zedia.net/2008/blendmodelayer-a-must-when-changing-alpha-of-a-displayobject-containing-other-displayobject/

Drawing transparent objects (like enemies) consisting of multiple components (arms, hands, weapon, etc) looks horrible without this effect.

Thanks in advance.

Link to comment
Share on other sites

This is not working for me. If I go to the masking example on pixijs.com and add "container.alpha = 0.5;", the bgFront, light1 and light2 sprites are clearly visible behind the panda sprite. This is true for both the canvas and webgl renderers, but wouldn't be the case with AS3's BlendMode.LAYER, because the panda sprite would be drawn on top of the bgFront, light1 and light2 sprites at full opacity, completely obscuring those sprites, and then the whole container would get alpha 0.5.

 

Link to comment
Share on other sites

  • 2 weeks later...

No, adding a PIXI.AbstractFilter didn't change anything.

I'm probably just doing it wrong. Could someone share a very simple code example drawing 2 circles at alpha 0.5 where the intersection doesn't have a different color than the rest of the circles?

Link to comment
Share on other sites

Oh, now i understand what are you trying to do. There are problems with both alpha and blendmodes, I dont know a way of doing that easy case in pixi, except may be adding this circles into some container that will be cached with "cacheAsBitmap=true" and than making alpha=0.5 for it or its parent.

Link to comment
Share on other sites

Yes, thank you. CacheAsBitmap=true works and achieves the desired effect.

Coming from AS3/Flash, I was pretty surprised by this because in Flash cacheAsBitmap has no effect on how an object looks, it only affects the performance of the rendering. But here in Pixi, that's evidently not the case, not only because cacheAsBitmap changes the outcome when 0 < alpha < 1, but it also makes it stop updating when the children update.

I'd go so far as to call this a bug, or at least a serious misuse of the term "caching".

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...