gkjohnson / three-gpu-pathtracer

Path tracing renderer and utilities for three.js built on top of three-mesh-bvh.
https://gkjohnson.github.io/three-gpu-pathtracer/example/bundle/index.html
MIT License
1.38k stars 133 forks source link

Broke on MacOS Sonoma: Chrome + Safari #450

Closed bhouston closed 10 months ago

bhouston commented 1 year ago

Describe the bug

I am testing with this URL: https://gkjohnson.github.io/three-gpu-pathtracer/example/bundle/index.html

There is now a very long pause after the WebgL displays because it tries to show the ray traced image. This occurs on all machines, but on MacOS M1 and M2 devices both Safari and Chrome crash hard.

When trying to rendering, it just crashes with a ContextLost on Safari, screenshot here:

Screenshot 2023-09-06 at 6 48 56 AM

On Chrome it goes white when it crashes - takes about 30s after it finishes loading before it crashes hard:

Screenshot 2023-09-06 at 6 51 11 AM

LGL Tracer works on hthese machines fine .

I am running the betas of MacOS Senoma - this is an advanced beta and maybe what is eventually released. I believe it also crashes on other versions of MacOS as well, but I haven't been able to confirm.

Expected behavior

It should work and there should be no pauses during loading.

Screenshots and Repro Model

Just the base renderer with default models crashes.

Platform:

bhouston commented 1 year ago

I was able to work around the bug on Safari and Chrome - I just had to disable MIS. Then it works. So something in the MIS code is causing the crash.

gkjohnson commented 1 year ago

Hey Ben! If you use the latest version of three-mesh-bvh (v0.6.7) and update three.js, as well, then this works on Chrome. I'm not sure about Safari, though. I'm wondering if something changed in Safari and it has to do with trying to compile such a large shader that it fails.

But with this fix I'm able to load and render path traced models in Chrome on my M1 Macbook without artifacts.

It should work and there should be no pauses during loading.

Unfortunately depending on the platform shader compilation can be extremely slow and halt the page. On Chrome on Windows with the DirectX backend it can take 10s of seconds. Using OpenGL it's much faster.

gkjohnson commented 10 months ago

Fixed in #483!