OskarE Posted January 10, 2018 Share Posted January 10, 2018 Hello! I am working on a Phaser project (however, the issue is PIXI related). I was having issues with blend modes not always being set correctly when reloading my page. After a couple of days me and my colleague found that the PIXI.blendModesCanvas was being set to something like ["source-over", "lighter", "source-over", "source-over", "source-over", "source-over"] etc. I don't know if other people have ran in to this bug, but I thought I would document this here at least, and if it still exists in newer versions of Phaser/PIXI, that is what is causing it. To fix it we just set the PIXI.blendModesCanvas to a correct list when we start loading the game. We are using Phaser 2.6.2 at the moment, and the correct list is: ["source-over", "lighter", "multiply", "screen", "overlay", "darken", "lighten", "color-dodge", "color-burn", "hard-light", "soft-light", "difference", "exclusion", "hue", "saturation", "color", "luminosity"] Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted January 10, 2018 Share Posted January 10, 2018 Its phaser-related, because you have to look in phaser source code to solve that issue. Those modes weren't supported in old versions of browsers. https://github.com/photonstorm/phaser-ce/blob/master/src/pixi/renderers/canvas/CanvasRenderer.js#L274 Now you have to find out how does phaser detect whether they are supported. May be its like modern version of pixi - it tries `multiply` and checks if image data is correct. But in some browsers getImageData can be switched off for security reasons (Tor, Mozilla Nightly) I dont know where did they move v2.6.2 in github, it was there a week ago im sure. Quote Link to comment Share on other sites More sharing options...
OskarE Posted January 10, 2018 Author Share Posted January 10, 2018 I see! What was weird was it was happening randomly on Chrome Version 63.0.3239.84. It might be related to Phaser 2.6.2 then (haven't had the time to try out any later versions yet, and we are too far into production to change). I will have to try some different browsers and see if just forcing to array to be specified from us and if it still works then, or if we have to check what browser is being used. Thanks! Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted January 10, 2018 Share Posted January 10, 2018 If you need to fix that thing right now, just assign correct array there. Quote Link to comment Share on other sites More sharing options...
OskarE Posted January 11, 2018 Author Share Posted January 11, 2018 That's what I am doing at the moment. We will look to upgrading to whatever Phaser version is applicable for our next projects and also see if the problem persists by then. Thanks. 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.