google / filament

Filament is a real-time physically based rendering engine for Android, iOS, Windows, Linux, macOS, and WebGL2
https://google.github.io/filament/
Apache License 2.0
17.8k stars 1.89k forks source link

Increasing rendering priority of camera stream to make occluder mat to work, causes performance issue #2637

Closed balarayen closed 4 years ago

balarayen commented 4 years ago

Describe the bug As suggested in #1994, increased the rendering priority of the camera stream to first(0) in sceneform sdk. Occlusion works but causes a performance issue like when moving my device around the AR object causes the whole video(AR experience) to stutter.

Just changing the camera stream render priority back to last (7), the video stuttering is not happening but causes the occluded material to appear black.

Smartphone (please complete the following information):

Please suggest how to overcome this video stuttering issue.

Rendering priorities:

  1. Camera stream : 0 (first)
  2. Occluded object: 1 (second)
  3. Other objects: 4 (third)
    • Other objects are like some glb objects and two plane objects rendering video.

Note: I'm using filament version 1.4.5 with cherry-picked merges(#2582) compatible with sceneform v1.16.

romainguy commented 4 years ago

Drawing the camera stream first means there will be overdraw, and that's the main reason why it does not have a priority of 0 by default. I would suggest lower your rendering resolution or turning on dynamic resolution.

vortice3D commented 4 years ago

Hi @balarayen:

One question, being that setCameraStreamRenderPriority is not more part of ArSceneView declaration in Sceneform 1.16.0 (as apparently it was under Sceneform 1.15.0 if you read that version's docs), is now not possible to call:

...
arFragment.getArSceneView().setCameraStreamRenderPriority(Renderable.RENDER_PRIORITY_FIRST);
...

So how did you manage to set camera stream priority to 0?

Are you calling instead some Filament API?

Best regards.