olemoritz Posted April 21, 2016 Share Posted April 21, 2016 I've noticed that disabling antialias for WebGL makes a significant difference in performance on a Retina MacBook (30-40 fps vs. 60), and I think that on a high-resolution screen, antialiasing/multisampling shouldn't really make much of a difference visually. However, I'm not sure what the correct way to disable it is in Phaser. Setting game.antialias to false does work, but it has the side effect of also disabling smooth scaling for everything, which is great for pixel art, but not always what I want. I can easily edit phaser.js to modify the _contextOptions, maybe add a "msaa" attribute to game or something like that, but I would obviously prefer not to fork because I'd then have to re-apply this hack for every new version... So, my question is: Is there some "official" way to disable antialiasing for the WebGL context, but still keep smooth scaling for sprites? I've tried setting this.stage.smoothed to true in various state lifecycle methods, but this doesn't seem to have any effect. Link to comment Share on other sites More sharing options...
VitaZheltyakov Posted April 21, 2016 Share Posted April 21, 2016 The difference will be noticeable when using the text. Text without smoothing is terrible.Perhaps there is a way to do what you want on your desctop. But it just will not work on mobile devices. Link to comment Share on other sites More sharing options...
olemoritz Posted April 21, 2016 Author Share Posted April 21, 2016 I don't think the WebGL context's antialias option has any effect on text rendering. Link to comment Share on other sites More sharing options...
VitaZheltyakov Posted April 21, 2016 Share Posted April 21, 2016 1 hour ago, olemoritz said: I don't think the WebGL context's antialias option has any effect on text rendering. You can not test it? Link to comment Share on other sites More sharing options...
olemoritz Posted April 21, 2016 Author Share Posted April 21, 2016 Well, I have tested it, and there is no visible difference, nor would I expect there to be one. The antialias option I'm talking about is what you get from <canvasElement>.getContext('webgl').getContextAttributes().antialias As far as I know, this option basically has the effect of rendering the framebuffer at a higher resolution and then downsampling it, which is obviously pretty expensive. It's not even supported on iOS (not sure about Android), and the effect of this should rarely be visible when rendering in 2D. From my understanding, WebGL doesn't really deal with text rendering at all. Text is basically rendered into an image/texture (usually with antialiasing) before being rendered by WebGL. The problem is basically that Phaser conflates two different options into one. Link to comment Share on other sites More sharing options...
VitaZheltyakov Posted April 21, 2016 Share Posted April 21, 2016 WebGL and Canvas engines are connected and influence each other.You can say that mobile anti-aliasing settings are only globally Link to comment Share on other sites More sharing options...
Recommended Posts