Disable Anti-alias through code

I was looking for a solution on how to disable anti-aliasing by default through code editor, but was not successful. I am looking for a way to disable anti-aliasing as you would in Playcanvas editor on Render tab, but done via code (e.g. in initialize function of some script).

Any ideas to where to find this in code? I thought it would be simple as it is “just a checkbox” in the editor, but found nothing in API/GIT/Forums. Thanks!

Found the line that stores that ‘checkbox’: https://github.com/playcanvas/engine/blob/master/src/graphics/device.js#L672

Setting that flag to false should be enough.

Yeah I also tried that, setting this.app.graphicsDevice.supportsMsaa = false, but sadly this does not work.

Ah, I’m looking at the code again and it looks like it is something that needs to be set during the initialisation of the app as it’s used during the creation of the post effect layer pass here: https://github.com/playcanvas/engine/blob/master/src/framework/components/camera/post-effect-pass.js#L235

To do this at runtime, you may have to remove and readd the layer or somehow reinitialise it.

Yo @yaustar … Hey Steven… How do i enable Anti-Alias and Device Pixel Ratio via Code using Engine only… I am having trouble finding docs or info for the Engine Only folks

I believe if you set this to 1, that disables device pixel ratio: https://github.com/playcanvas/engine/blob/master/src/graphics/device.js#L2833

Or can tune the value to make it somewhere in-between ‘off’ and the best quality. Some examples in the example folder have it on the devices pixel ratio if you want to see how to ‘enable’ it.

Not sure about about anti alias.

My best guess is that supportsMsaa has to be set to false on initialisation https://github.com/playcanvas/engine/blob/0b3dbb3fc0b2f7b2b36215d03d919f21522cb0b2/src/graphics/device.js#L650