I use Pixi.js for my work project to draw simple shapes — circles and segments, and make some interaction between them. I work on Mac running El Capitan and test my prototype in Google Chrome. I use PIXI.autoDetectRenderer()
method to set renderer and usually it is set to WebGL in latest browsers. I don't have any experience in WebGL, so might not know some important details.
When testing my application in Firefox I've noticed thin black border around shapes.
Turned out that antialias
property set to true
caused this effect:
renderer = new PIXI.autoDetectRenderer(width, height, {backgroundColor: 0xffffff, antialias: true})
I've done some investigation. On Pixi.js forums and on some other resources it's said that PIXI.Graphics()
objects do not support anti-aliasing because of using the stencil buffer. On practice they do support anti-aliasing. Guess, something has changed since discussions took place.
I don't like the result I get with switched off anti-aliasing, here it is on images below.
I and my colleague had a talk about that, and we discovered that when any other graphic object lays behind, there is no black border around original one. So we added white rectangle behind other elements in case Firefox browser is used.
That solved problem of black border. Still I get far neater image in Google Chrome. There are lots of artifacts around segments and circles in Firefox.
They become more visible once elements get smaller.
In console I get following warning:
FXAA antialiasing being used instead of native antialiasing.
Is there a way to improve anti-aliasing quality in this case?