google / model-viewer

Easily display interactive 3D models on the web and in AR!
https://modelviewer.dev
Apache License 2.0
6.68k stars 799 forks source link

WebXR Postprocessing #4264

Open Beilinson opened 1 year ago

Beilinson commented 1 year ago
          Thanks @elalish

I did checks on https://modelviewer.dev/examples/postprocessing/ Is it possible to have the bloom effect working on AR viewer as well like it’s the case now for 3D viewer please?

Thank you

55114183-4B09-45F8-A30A-AC66AC499042

Best

Originally posted by @zelghrabi-edu in https://github.com/google/model-viewer/issues/3948#issuecomment-1523004064

Beilinson commented 1 year ago
  1. For the native WebXRRenderer for three.js, it requires some tinkering with the renderers that isn't fully supported yet by pmndrs/postprocesssing, which maybe shouldn't enter model-viewer as it is meant to be a fully stable API.
  2. On most mobile devices <model-viewer> actually defaults to the native AR viewer, meaning <model-viewer-effects> actually has no control over the rendering. On IOS for example, this is because WebXR is mostly unsupported.

More on WebXR iOS support:

It is currently in an "experimental state", which is accessible through: Settings -> Safari -> Advanced -> Experimental Features and all the way at the bottom:

image

It is disabled by default, and I am not sure how well it will work in the case of model-viewer, though it might be interesting to test.

Additionally, apple has the RealityKit API for AR experiences on IOS, which does allow for custom postprocessing, however this is only for c/swift IOS apps, while browsers are limited to quick look which is not customizable.

elalish commented 1 year ago

Indeed, this would be an Android-only feature for now, since iOS doesn't yet support WebXR. We don't actually use three's WebXRRenderer currently, so hopefully it's a bit simpler.

zelghrabi-edu commented 1 year ago

Hello, Thanks guys for your answers It doesn't work for Android as well

image

elalish commented 1 year ago

That's actually SceneViewer on Android, which also can't support this, since like QuickLook, it's a separate app. Only WebXR mode can be made to work (though I don't think it does yet).

mahdavifar2002 commented 10 months ago

@elalish Hello. I'm looking for applying some custom postprocessing effects on AR mode (webxr). Could you please give me a hint on how I may achieve this goal?

elalish commented 10 months ago

It's hasn't quite been implemented yet, but I don't think it should be too hard. Basically we need a similar update to the render loop in ARRenderer.ts as we now have in Renderer.ts. @Beilinson would be good to ask for review, and I'll certainly help with any PR as well.