aframevr / aframe

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

aframe is causing images to shake rapidly (see the video attached) #5036

Closed Fede-viale closed 1 year ago

Fede-viale commented 2 years ago

On Android devices, across all browsers, some aframe examples shake like crazy at the smallest movement. We experimented this issue even when the mobile devices were totally still.

https://user-images.githubusercontent.com/98468287/162217230-3a385be8-b0d9-455a-97af-fb1c5649f794.mp4

dmarcos commented 2 years ago

It could be sensor noise / drift. I don’t think much can be done on the A-Frame side.

It doesn’t seem to be affecting normal operation once you grab the phone in your hand, correct?

Fede-viale commented 2 years ago

when you grab the phone in your hand it's almost imperceptible to see. But if you looking for it, you'll see it.

Are you sure there is nothing to do on A-Frame side?

dmarcos commented 2 years ago

FWIW I cannot reproduce the issue on a Pixel 3 and the examples on the site

https://aframe.io/aframe/examples/

I noticed the report is filed against 1.1.0. You should be using 1.3.0

Do you have any more specific steps to reproduce? I’m loading the sites on the link above and tracking works as expected. I occasionally see some drift / noise when laying the phone flat on a surface but tracking resumes as expected when picking the phone back.

I tested on Chrome 100

dmarcos commented 2 years ago

Tracking is functional for me. there might be some drift / noise in certain phones but those are barely perceptible in normal operation as you mentioned.

Fede-viale commented 2 years ago

When we tested we used the example in the following link -> https://aframe.io/examples/showcase/sky/

We opened the link using chrome 100 and the only thing we did was opened the link in the browser.

We're testing right now in a Samsung Galaxy S10 now on Chrome 100. The result is the same. The experience shakes.

dmarcos commented 2 years ago

Is the experience functional? you mention noise is imperceptible on normal operation right?

Fede-viale commented 2 years ago

Yes, It's imperceptible when you're on movement. but, if you pay attention you could see it anyway!

And, what do you mean about Experience functional?

dmarcos commented 2 years ago

Thanks. By functional I mean a user will be able to use the experience without issue or discomfort.

dmarcos commented 2 years ago

This is probably not a super high priority. The tracking logic is here:

https://github.com/aframevr/aframe/blob/master/vendor/DeviceOrientationControls.js

You’re welcome to have a look and explore solutions. Maybe implementing some kind of filter is possible to reduce noise.

dmarcos commented 2 years ago

Some filter code could be useful to learn from:

https://github.com/immersive-web/cardboard-vr-display/blob/main/src/sensor-fusion/complementary-filter.js

If googling for info probably look for “quaternion low pass filter” that could be applied to the data coming from the deviceorientation events

dmarcos commented 2 years ago

Interesting reference https://stackoverflow.com/questions/25744984/implement-a-kalman-filter-to-smooth-data-from-deviceorientation-api

I think filtering the deviceorientation data is the only thing it could be done on the A-Frame side. Interesting that data is cleaner on Safari iOS.

dmarcos commented 1 year ago

I'm not sure we can do much on the A-Frame side. This doesn't affect normal operation. I'm open to suggestions if someone has more insight and ways to improve. I'm closing for now and can reopen if necessary