google-ar / WebARonARCore

An experimental Chromium modification in the form of an app for Android that lets developers build Augmented Reality (AR) experiences using web technologies on top of Google's ARCore.
https://developers.google.com/ar/develop/web/getting-started
Apache License 2.0
756 stars 115 forks source link

It shows stretched/warped image especially when turning the phone diagonally. #47

Closed robertjuh closed 6 years ago

robertjuh commented 6 years ago

I show some examples in this thread: https://stackoverflow.com/questions/48004018/three-ar-js-bad-aspect-ratio-creating-stretched-image/48053103#48053103 And i use a Samsung Galaxy s8 And i am using an older commit that was suggested in this issue thread: https://github.com/google-ar/WebARonARCore/issues/44 which is the commit: https://github.com/google-ar/WebARonARCore/commit/22b75c18d4aeb4232e47556cc27f067f4115c75b

robertjuh commented 6 years ago

Question: which SDK does this browser use? ARCore Preview 1 or Preview 2?

jsantell commented 6 years ago

Do you have this issue when viewing the examples? Are you handling window resize events (handles orientation changes)?

robertjuh commented 6 years ago

I took most from the sample project, it's just moved to another domain and it has been rebuilt into a class. But at first glance most code would look the same. In the stack overflow i provided pictures of the example project working correctly and my project showing warped imagery. Below you'll see the window resize functions from the example first and then from mine.

 function onWindowResize () {
              camera.aspect = window.innerWidth / window.innerHeight;
              camera.updateProjectionMatrix();
              renderer.setSize(window.innerWidth, window.innerHeight);
}
arOnWindowResize: function() {
        this.camera.aspect = window.innerWidth / window.innerHeight;
        this.camera.updateProjectionMatrix();
        this.renderer.setSize(window.innerWidth, window.innerHeight);
}

and add them like this: window.addEventListener('resize', onWindowResize, false); window.addEventListener('resize', this.arOnWindowResize.bind(this), false);

i use an older commit from the browser so later today ill try it again with the newest versions (if it doesnt crash this time) and check out if it made any difference, although it's still weird that on the old commit it shows the example just fine

robertjuh commented 6 years ago

I downloaded the newest webaronarcore.apk today and installed it after cleaning my phone from all AR stuff. Unfortunately it doesnt work with arcore preview 2 and it keeps crashing after opening the example page for a second or 2. I'll have to go back to the older commit to get the examples and my project working again

judax commented 6 years ago

The current version of WebARonARCore uses the old ARCore APK. Please, follow the instructions in the README.md, where the link to the ARCore APK is still the correct one (the initial version).

robertjuh commented 6 years ago

yes that's the one i used

judax commented 6 years ago

So I am assuming that the stock examples from three.ar.js are working just fine right? Would it be possible to have access to the code of your example somehow even if it is just a simplified version you could share?

robertjuh commented 6 years ago

yes the stock examples are just fine. It's about 150 lines, shall i post it here?

It looks a bit different because it is called as a class from another domain, in the browser i enter the link to that domain. It initialises the AR elements first but doesnt do anything yet untill it calls the show() function. It gives me their THREE.js elements and somewhere in the remote code the elements are replaced by the ARPerspectivecamera and VRControls. But the same 'warping' issue did exist before we went fiddling with the controls and camera

robertjuh commented 6 years ago

'Code removed for confidentiality purposes'

robertjuh commented 6 years ago

By the way i can also message you the URL but i maybe it's better to do this in private message?

judax commented 6 years ago

Thanks! Yeah, that would be more helpful even. ijamardo at google dot com. I won't be able to test it right now as I am out of the office but we will try to review it asap.

robertjuh commented 6 years ago

Alright i sent it to you, good luck and have fun ;) And thanks for taking the time!

robertjuh commented 6 years ago

Maybe i can just wait for the DP2 version to arrive and leave this for now? No one else seems to be experiencing this problem?