googlevr / cardboard

Open source Cardboard SDK and samples
Other
1.48k stars 255 forks source link

Support Optimized Frame Pacing on Android devices with Unity #245

Open agalbachicar opened 3 years ago

agalbachicar commented 3 years ago

Cardboard XR Plugin does not play well with "Optimized Frame Pacing" option. In Unity 2019.4 it is not enabled by default but it is in 2020.1+

This option works with Android devices, the render pipeline changes to use SwappyGL which buffers some frames and blocks the render thread to reduce the frame rate variance.

Behavior: when enabling this option ( File > Build settings > Player settings ... > Player > Resolution and Presentation > Optimized Frame Pacing ) the camera pose gets discrete pose jumps which makes a game impossible to play. Those jumps are in the order of hundreds of milliseconds to seconds.

Connected to #99 and #165

agalbachicar commented 3 years ago

We have worked internally with the team that implemented the pacing feature and we could not find the issue yet.

For increased transparency, we traced the application and inspected the trace outputs with Perfetto. The SDK had to slightly change to load the trace library and inject traces on every SDK API. Code and functionality remained the same as Cardboard v1.4.1 . Also, for your reference, we enabled debug options in Unity sample app (File > Build settings > Deep profiling support and Script debugging).