ErfanAsgari Posted June 1, 2021 Share Posted June 1, 2021 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. Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted June 1, 2021 Share Posted June 1, 2021 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. Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted June 1, 2021 Share Posted June 1, 2021 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 Quote Link to comment Share on other sites More sharing options...
ErfanAsgari Posted June 16, 2021 Author Share Posted June 16, 2021 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 ivan.popelyshev 1 Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted June 16, 2021 Share Posted June 16, 2021 (edited) ? Good luck, ask more! Even re-newing old questions with broken solutions helps us. Edited June 16, 2021 by ivan.popelyshev Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.