Jump to content

Using mask and blendmode


ErfanAsgari
 Share

Recommended Posts

HI, I have read https://www.html5gamedevs.com/topic/44883-using-mask-with-blendmodel-will-result-in-black/ but it didn't help me, mainly because one of the playground codes were changed and had become useless.

My goal is to put a pattern on a t-shirt and mask it (to only be visible in the printable area). The problem is when I use "multiply blendMode" and mask, it results in black. I'm using pixi v6.0.4 and I am limited to use WebGL context only, and I can't access HTML5canvas renderer. I can use both transparent mask and black-and-white mask if needed.

This part of code is for colorizing the t-shirt which the process is explained in the picture.

Here is part of my code:

https://www.pixiplayground.com/#/edit/dUBBbHALppZTZ2Tds4YK_

(NOTE: I have read all of the Q&As about this issue on the internet and they didn't work for me. I don't know whether that's because of the version but I want you to help me with editing my code.)

 

Thanks a lot for this amazing framework.

guide2.jpg

Link to comment
Share on other sites

Alternative: i just released @pixi/picture v3.0.1 , you can use MaskFilter + usual pixi ColorMatrixFilter, that allows to specify more difficult color changes. Its more performance heavy, but is more configurable: any color-changing filter works.

basic example: https://pixijs.io/examples/#/plugin-picture/mask-blur.js

Link to comment
Share on other sites

  • 2 weeks later...
On 6/1/2021 at 6:35 PM, ivan.popelyshev said:

https://www.pixiplayground.com/#/edit/w_S1Ews5nxEDeA99gODTo

SpriteMaskFilter is what mask actually is. If you create it manually, you can set which blendMode it uses to draw result on screen.

Thanks a lot! sorry for the delay I've been busy in recent days. I wasn't used to asking questions in forums, however, after seeing the effort of people like you to answer our questions; It seems that I should rethink of attending Q&A forums.

with respect
Erfan Asgari

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...