# iOS Anti-aliasing issue April 2023

**URL:** <https://forum.babylonjs.com/t/ios-anti-aliasing-issue-april-2023/39886>\
**Category:** Bugs\
**Tags:** mesh, antialiasing\
**Created:** [April 14, 2023, 10:01am UTC](https://forum.babylonjs.com/t/ios-anti-aliasing-issue-april-2023/39886 "2023-04-14T10:01:31Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![Somenath\_Mondal1](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/somenath_mondal1/32/21394_2.png) [@Somenath\_Mondal1](https://forum.babylonjs.com/u/Somenath_Mondal1)\
**Post date:** [April 14, 2023, 10:01am UTC](https://forum.babylonjs.com/t/ios-anti-aliasing-issue-april-2023/39886/1 "2023-04-14T10:01:31Z")

</div>

Hi devs/ @Deltakosh ,

We recently observed antialiasing issues on iOS devices since this week.  
Works fine on desktop and Android.

Refer to screenshots below.

Is there a specific flag we need to enable/disable to fix this?

![AA_iOS_1](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/e/5/e5bf032714abdd6df6001fe8ea4580d73ff83686.jpeg)  
 ![AA_iOS_2](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/6/2/6279273253d80c271eec91ca2542f669bd42558c.jpeg)

---

<div class="post-metadata">

**Author:** ![carolhmj](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/carolhmj/32/25918_2.png) [@carolhmj](https://forum.babylonjs.com/u/carolhmj)\
**Post date:** [April 14, 2023, 10:42am UTC](https://forum.babylonjs.com/t/ios-anti-aliasing-issue-april-2023/39886/2 "2023-04-14T10:42:29Z")

</div>

cc @sebavan @Evgeni_Popov

iOS iOSing… 😩

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [April 14, 2023, 11:30am UTC](https://forum.babylonjs.com/t/ios-anti-aliasing-issue-april-2023/39886/3 "2023-04-14T11:30:34Z")

</div>

Ohhhhhh Shoooot you are right I can repro in the playground !!!

CC @Deltakosh

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [April 14, 2023, 1:09pm UTC](https://forum.babylonjs.com/t/ios-anti-aliasing-issue-april-2023/39886/4 "2023-04-14T13:09:55Z")

</div>

Looks broken for all WebGL not just babylon [https://codepen.io/sebavan/pen/PoyZMMo](https://codepen.io/sebavan/pen/PoyZMMo)

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [April 14, 2023, 1:17pm UTC](https://forum.babylonjs.com/t/ios-anti-aliasing-issue-april-2023/39886/5 "2023-04-14T13:17:08Z")

</div>

It is broken in the new metal backend only on IOS

---

<div class="post-metadata">

**Author:** ![Skeleton](https://avatars.discourse-cdn.com/v4/letter/s/b5ac83/32.png) [@Skeleton](https://forum.babylonjs.com/u/Skeleton)\
**Post date:** [May 7, 2023, 9:54am UTC](https://forum.babylonjs.com/t/ios-anti-aliasing-issue-april-2023/39886/6 "2023-05-07T09:54:13Z")

</div>

I’ve been having this problem too and I have several iOS devices to test with.  
iOS 16.4.0 and 16.4.1(a) have this issue. 15.7 doesn’t.

@sebavan Looking at other Three.js projects they don’t have this issue, and I think it’s because the codepen you posted above didn’t call:

`renderer.setPixelRatio(window.devicePixelRatio);`

For BabylonJS, if I use the Safari Inspector and double the resolution of the canvas, it aliases properly. If I try:

`engine.adaptToDeviceRatio = true;`

that didn’t make a difference but if I force this:

`engine.setHardwareScalingLevel(0.5);`

It looks good. Yet doing that without any catch for it being iOS means I’ll be doubling the pixel rendering of the canvas for all devices so I can code that in, yet I’m guessing that BabylonJS will update their own system so it does compensate for ‘retina’/@2x screens correctly by default in the longer run?

---

<div class="post-metadata">

**Author:** ![DRLeria](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/drleria/32/50928_2.png) [@DRLeria](https://forum.babylonjs.com/u/DRLeria)\
**Post date:** [May 7, 2023, 9:35pm UTC](https://forum.babylonjs.com/t/ios-anti-aliasing-issue-april-2023/39886/7 "2023-05-07T21:35:18Z")

</div>

I confirm it  
In my case I had to try different alternatives to get it to look correct, finally this has been my choice:

1- Activate DeviceAspectRatio (in my case it works with version 16.4.1)

```auto
var engine = new BABYLON.Engine(canvas, true, { stencil: false }, true);

```

2- Add Rendering Pipeline with FXAA activated using 1 sample.

```auto
var pipeline = new BABYLON.DefaultRenderingPipeline(
   "defaultPipeline",
   right,
   scene,
   [scene.activeCamera]
);
pipeline.fxaaEnabled = true;
pipeline.samples = 1;

```

This is the main Setup i´m using in this demo:

[TAKI Mini Game](https://viseni.com/taki2/)

---

<div class="post-metadata">

**Author:** ![DRLeria](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/drleria/32/50928_2.png) [@DRLeria](https://forum.babylonjs.com/u/DRLeria)\
**Post date:** [May 7, 2023, 9:43pm UTC](https://forum.babylonjs.com/t/ios-anti-aliasing-issue-april-2023/39886/8 "2023-05-07T21:43:52Z")

</div>

I don’t want to get into conspiracies (ironic), but so many errors and so many complications in Safari (WebGL, Audio, WASM…) make me think that the Big Apple doesn’t really like this WebApp world

And honestly, in my professional experience, for a long time I verified how more and more customers want their apps outside of Stores and avoid unnecessary downloads, which in many cases are a wall of entry for their clients.

Finally I want to add that without a doubt the BabylonJS team is taking the best development direction using generic code, easy, intuitive and focused on performance.

My experience with other tools such as Unity or Unreal for the development of WebGL apps has been crazy, they still don’t offer a good support and the compilations are very inefficient, especially on mobile.

If we also take into account that web traffic has become more than 80% from mobile devices, it’s more absurd.

---

<div class="post-metadata">

**Author:** ![DRLeria](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/drleria/32/50928_2.png) [@DRLeria](https://forum.babylonjs.com/u/DRLeria)\
**Post date:** [May 10, 2023, 9:58pm UTC](https://forum.babylonjs.com/t/ios-anti-aliasing-issue-april-2023/39886/9 "2023-05-10T21:58:03Z")

</div>

I’ve found a simple trick to get the anti aliasing working again  
It should be something with Metal and WebGL

Go to Settings — Safari — Advanced — Experimental Features  
And disable WebGL via Metal

The second capture is disabling Metal WeGL

 ![IMG_8856](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/f/e/fe35715162d57d0104d57332bfedb2d57421c35a.jpeg)  
 ![IMG_8855](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/a/9/a9ff753e6c28b4bb63035eef161dd1a4e5b39066.jpeg)  
 ![IMG_8854](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/7/c/7c05e0912b3e166528a5c53b65db2b8acd37b649.jpeg)

---

<div class="post-metadata">

**Author:** ![Skeleton](https://avatars.discourse-cdn.com/v4/letter/s/b5ac83/32.png) [@Skeleton](https://forum.babylonjs.com/u/Skeleton)\
**Post date:** [May 13, 2023, 7:10am UTC](https://forum.babylonjs.com/t/ios-anti-aliasing-issue-april-2023/39886/10 "2023-05-13T07:10:01Z")

</div>

@DRLeria Thanks for looking into this more, your solutions helped. And yeah, it does seem like Apple has a lot of reasons to not want WebApps to be successful.

---

<div class="post-metadata">

**Author:** ![mikeysee](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/mikeysee/32/27714_2.png) [@mikeysee](https://forum.babylonjs.com/u/mikeysee)\
**Post date:** [May 19, 2023, 5:47am UTC](https://forum.babylonjs.com/t/ios-anti-aliasing-issue-april-2023/39886/11 "2023-05-19T05:47:12Z")

</div>

Ooof… just ran into this too… is there an official apple bug tracking this issue anywhere?

---

<div class="post-metadata">

**Author:** ![carolhmj](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/carolhmj/32/25918_2.png) [@carolhmj](https://forum.babylonjs.com/u/carolhmj)\
**Post date:** [May 19, 2023, 12:46pm UTC](https://forum.babylonjs.com/t/ios-anti-aliasing-issue-april-2023/39886/12 "2023-05-19T12:46:55Z")

</div>

@sebavan do you know if there’s one?

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [May 19, 2023, 8:54pm UTC](https://forum.babylonjs.com/t/ios-anti-aliasing-issue-april-2023/39886/13 "2023-05-19T20:54:42Z")

</div>

Can not find it but I am pretty sure there was one ☹

---

<div class="post-metadata">

**Author:** ![DRLeria](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/drleria/32/50928_2.png) [@DRLeria](https://forum.babylonjs.com/u/DRLeria)\
**Post date:** [May 19, 2023, 11:13pm UTC](https://forum.babylonjs.com/t/ios-anti-aliasing-issue-april-2023/39886/14 "2023-05-19T23:13:56Z")

</div>

Every Apple update on WebGL support

![IMG_9210](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/7/2/7215076a5ec643f90ed27ca272a498f92bdeee8b.gif)
