aframevr / aframe

:a: Web framework for building virtual reality experiences.
https://aframe.io/
MIT License
16.58k stars 3.93k forks source link

Bad performance on Firefox Reality (Vive Focus / Oculus Go) on master vs 0.9.2 #4347

Open IvoJager opened 4 years ago

IvoJager commented 4 years ago

Description:

Performance is choppy, stuttery on both headsets in Firefox Reality on latest master (as of 2019-12-05) vs 0.9.2.

EDIT: I just noticed there is a subtle quality difference between the two versions; 0.9.2 shows more aliasing when looking at specular lights/reflection, whereas the master version seems to be applying some sort of super-sampling. Could it be the master version is rendering at a higher resolution?

dmarcos commented 4 years ago

Link to reproduce?

IvoJager commented 4 years ago

This is an (intentionally) heavy scene; https://glitch.com/~chambray-amusement

It performs worse with the latest master on Oculus Go and Vive Focus w/FFR7 than 0.9.2. Also notice the specular highlights look much better on master than on 0.9.2.

I wonder if the two are related (specular highlight quality and slower performance)?

dmarcos commented 4 years ago

We bumped THREE to r111 (from r101 in 0.9.2) so probably some change on standard shader and how shadows are handled? I see you participated on https://github.com/mrdoob/three.js/pull/15591

IvoJager commented 4 years ago

If anything the shadow tweak should make THREE more performant, not less. But to take those changes out of the equation, I actually set shadows to PCFSoft in the Glitch example (as its shader has remained the same - only PCF has changed).

It's possible that the standard material shader has changed... Certainly, some sort of sampling appears different as evidenced by the reduced shimmer in the specular highlights.

Regardless, whatever changed has had a pretty significant effect on performance in our use case, to the point of being uncomfortable to use; we try to fine-tune our scenes to meet minimal refresh rates on all headsets.

I'm not sure if there is a policy regarding frame rate consistency between A-Frame versions? Or is it a case of having to retune for a new version of A-Frame?

I will look for any standard material shader changes in the meantime.

IvoJager commented 4 years ago

I can see a number of changes to the standard ("physical") material shaders, including specular highlights between r101 and r111.

I'd suggest now is probably the time to "fork" an A-Frame shader version of the "standard" material. As @ngokevin commented in an old issue (#2709), "standard" (which maps to "physically correct" is usually overkill. Yet "flat" is far too basic for general use. I cannot get phong or lambert to work in A-Frame (unless I'm missing something obvious?).

What will A-Frame's solution to this be? E.g. should I start maintaining our own shaders, or will there be a locked/friendly VR-friendly "standard" shader?

dmarcos commented 4 years ago

Switching to a different shader by default, offering more options or maintaining a fork are all options. Preference goes for identifying what makes standard shader slow and fix it upstream in the THREE repo

IvoJager commented 4 years ago

While I understand the preference to have this "fixed" for us upstream, from the perspective of THREE there is nothing to fix. As far as I can tell it is a definite visual improvement to the physical material shader. Unfortunately, for our purposes, it kills performance on mobile headsets (Go/Quest/Focus/Cardboard).

I suspect the THREE maintainers will - rightfully - push back and tell us to create our own alternative shader(s). Going by other comments and experience with A-Frame this is probably something that is, frankly, overdue.

Regardless, do let me know what direction you feel is best for A-Frame, so we can adapt accordingly. Thanks!

ngokevin commented 4 years ago

i’d lean towards lambert or phong by default since i’ve yet to see anyone use PBR workflow. supercraft is phong and we saw bad perf using standard in night sky. in unity for standalone vr, people often use the mobile diffuse over the standard shader

aframe hello world can remain standard

IvoJager commented 4 years ago

@ngokevin We actually do attempt a measure of PBR, as we try to mix 360 photography and scenes with an interface that blends in with the scene/world. We analyse the 360 photography for light sources, set shadows correctly, synthesise materials on the fly, etc. (hence my interest/contribution for improving performant PCF shadows in three.js.) This PBR-lite approach has been working working well enough on mobile VR up until now.

Being able to mix Phong and Lambert with Physical would be fantastic (if there is a way to get this to work in A-Frame already, please do let me know!). That or a "good enough" physical/standard shader that is performant enough for mobile VR.