three.js icon indicating copy to clipboard operation
three.js copied to clipboard

BatchedMesh example sortObjects bugs on Safari iOS WebGPU

Open Makio64 opened this issue 1 year ago • 6 comments

Description

On iOS it seems BatchedMesh example have 3 bugs :

  • indexing problem (my guess) : always present
  • sorting problem : sortObjects = false reduce the visibility of the bug
  • perInstanceFrustumCulled problem : perInstanceFrustumCulled = false reduce the visibility of the bug

https://github.com/user-attachments/assets/9326e024-0f05-4332-a35c-ceb7e00d1e52

Note : sortObjects = true also lead to a bug on Android Chrome on one of my current mission but I cant figured out whats the condition of the bug as the project is complexe and involve multiple BatchedMesh / custom nodes .. ( but sortObjects=false solve the bugs I got on Android ) I'll dive more on it when i ll got the time.

Note 2 : on the same project on iOS it feels like the index of the BatchedMesh is slowly degenerating, this second one might be related to : https://github.com/mrdoob/three.js/issues/29379 but i prefer to notify it here as it might be linked.

Related to https://github.com/mrdoob/three.js/issues/29041 but I prefered create a new issue.

@mwyrzykowski

Reproduction steps

  1. get iOS 18.0 / 18.1
  2. enabled flag WebGPU on Safari
  3. Open the example with webGPU: https://threejs.org/examples/webgpu_mesh_batch.html

Code

https://github.com/mrdoob/three.js/blob/master/examples/webgpu_mesh_batch.html

Live example

https://threejs.org/examples/webgpu_mesh_batch.html

Screenshots

No response

Version

r169

Device

Mobile

Browser

Safari

OS

iOS

Makio64 avatar Oct 07 '24 19:10 Makio64

@Makio64 it seems fine on ToT WebKit (I tried an iPhone 15 Pro):

https://github.com/user-attachments/assets/a0e8735f-e7d1-4f9c-970c-8cdf67256907

Understandably it would be hard to verify, but if it looks correct on STP, I think the only difference between for WebGPU between an Apple Silicon Mac and some iPhones is lack of float32 filtering support (excludes Apple9+ phones like iPhone 15 Pro).

mwyrzykowski avatar Oct 07 '24 19:10 mwyrzykowski

This should be fixed by https://bugs.webkit.org/show_bug.cgi?id=277465

That fix did not make it into iOS 18.0 or 18.1, which is why you see the behavior on iOS but not Safari Technology Preview. I imagine macOS 18.0 and macOS 18.1 also exhibit the same issue on Apple Silicon as iOS

mwyrzykowski avatar Oct 07 '24 20:10 mwyrzykowski

@mwyrzykowski thanks for your quick answer! I installed macOs 15.0.1 and STP and I do have glitchs on Mac M3 Pro Max , see the recording :

https://github.com/user-attachments/assets/034bdb0f-97cf-4595-a981-88d04f7d3dd9

Makio64 avatar Oct 07 '24 20:10 Makio64

Which version of STP @Makio64 ?

I tried on an M2 Mac Studio with STP 204 and seems ok:

https://github.com/user-attachments/assets/edb3cf31-1a0f-4dda-a44e-1ff9680fc745

mwyrzykowski avatar Oct 07 '24 20:10 mwyrzykowski

Which version of STP @Makio64 ?

I downloaded it today : STP : Release 204 (Safari 18.0, WebKit 20621.1.1.111.3) MacOs : 15.0.1 (24A348) Apple M3 Max, 16-inch, Nov 2023

Makio64 avatar Oct 07 '24 20:10 Makio64

I will attempt to reproduce on an M3 chip, maybe the flicker is due to a race condition

mwyrzykowski avatar Oct 07 '24 20:10 mwyrzykowski

fixed in recent safari version iOS / M3

Makio64 avatar Mar 18 '25 14:03 Makio64