AR.js icon indicating copy to clipboard operation
AR.js copied to clipboard

changing resolution affects images rotation

Open giaaaacomo opened this issue 3 years ago • 14 comments

Do you want to request a feature or report a bug? Bug report

What is the current behavior? When i set a custom resolution, the images shown over the marker get tilted left or right of like 40 degrees, even if the rotation is set to -90 0 0 . with bigger markers the image tends to stay tilted in that direction, while with smaller markers it tends to swap the direction of the inclination. disabling sourceWidth:2560; sourceHeight:1920; displayWidth: 2560; displayHeight: 1920; fixes it, but i did not find a resolution better than the default 640*480 that doesn't affect the image in this way.

If the current behavior is a bug, please provide the steps to reproduce. changing the resolution in <a-scene> tilts the image left or right, reverting to orginal fixes

code https://glitch.com/edit/#!/petal-silky-guilty

live website https://petal-silky-guilty.glitch.me

screenshot from pc (moved down the image a bit so it's easier to notice the different inclination) image

Please mention other relevant information such as the browser version, Operating System and Device Name tested in: Windows 10 - edge Android (galaxy s9+) - chrome, firefox iOS (iphone XR) - safari

What is the expected behavior?

it just shouldn't happen

If this is a feature request, what is motivation or use case for changing the behavior?

giaaaacomo avatar Feb 23 '22 23:02 giaaaacomo

tonight or tomorrow i'll test older arjs versions to know if the bug is just related to the latest builds. do you have any specific builds to start from, @kalwalt ?

giaaaacomo avatar Feb 26 '22 18:02 giaaaacomo

update: tried both many versions of ar.js (even from the old repo) and a-frame without success. changing the resolution for some reasons still behaves the same (even with the sourceWidth:1280; sourceHeight:960; displayWidth: 1280; displayHeight: 960; suggested in the medium article by @nicolocarpignoli ). even geometries (tried a-box ) and gltf models (tried the official trex model) are tilted. i really can't understand why

giaaaacomo avatar Feb 27 '22 14:02 giaaaacomo

tonight or tomorrow i'll test older arjs versions to know if the bug is just related to the latest builds. do you have any specific builds to start from, @kalwalt ?

Sorry @giaaaacomo i'm very busy with my job, haven't the time to answer.

update: tried both many versions of ar.js (even from the old repo) and a-frame without success. changing the resolution for some reasons still behaves the same (even with the sourceWidth:1280; sourceHeight:960; displayWidth: 1280; displayHeight: 960; suggested in the medium article by @nicolocarpignoli ). even geometries (tried a-box ) and gltf models (tried the official trex model) are tilted. i really can't understand why

Have you also tried the dev branch? Maybe i am wrong, but i think that probably this happens because the on Resize function apply strictly rules to the ratio between width and height. We should solve this in a future. Probably the best solution will be to provide a custom onResize in which the user can choose to apply or not.

kalwalt avatar Feb 27 '22 16:02 kalwalt

Have you also tried the dev branch? Maybe i am wrong, but i think that probably this happens because the on Resize function apply strictly rules to the ratio between width and height. We should solve this in a future. Probably the best solution will be to provide a custom onResize in which the user can choose to apply or not.

tried https://raw.githack.com/AR-js-org/AR.js/dev/aframe/build/aframe-ar.js without success is there something i can do as of now to temporarly fix without lowering the resolution?

btw i know you must have your priorities, no worries!

giaaaacomo avatar Feb 27 '22 17:02 giaaaacomo

hi! is there any news about this? can i help in some way ?

giaaaacomo avatar Mar 28 '22 14:03 giaaaacomo

I'm facing this issue too, looks like in apple devices it doesn't happen so much form me. But in Chrome for Android is happening all the time.

Hiro marker is working fine, looks like for me that custom markers are doing this.

rafelis1997 avatar Mar 30 '22 22:03 rafelis1997

Hiro marker is working fine, looks like for me that custom markers are doing this.

this is really weird 'cause here it's bugged whether it is custom or preset

giaaaacomo avatar Mar 30 '22 22:03 giaaaacomo

Oh, i've found the issue. Looks like for me what is causing it is the landscape orientation change. It happens alot on Android devices, Apple not often

rafelis1997 avatar Mar 30 '22 22:03 rafelis1997

Oh, i've found the issue. Looks like for me what is causing it is the landscape orientation change. It happens alot on Android devices, Apple not often

didn't notice your reply, btw can you go further? how exactly did you manage to fix that?

giaaaacomo avatar May 30 '22 16:05 giaaaacomo

I was not able to fix it, but looks like it related to device witdth and height

rafelis1997 avatar May 30 '22 18:05 rafelis1997

@giaaaacomo @rafelis1997 have you tried also with the latest code in the master branch? Maybe the issue happens because the ratio (width and height relation)? Unfortunately i have not so much time to test, if i find a solution i will let you know.

kalwalt avatar Jun 01 '22 19:06 kalwalt

@giaaaacomo @rafelis1997 have you tried also with the latest code in the master branch? Maybe the issue happens because the ratio (width and height relation)? Unfortunately i have not so much time to test, if i find a solution i will tet you know.

Will try again probably tonight and keep you tuned. Btw back then i also tried to crank the resolution to match both the camera and the display but without success, and the same while keeping the original ratio.

giaaaacomo avatar Jun 02 '22 15:06 giaaaacomo

@giaaaacomo @rafelis1997 have you tried also with the latest code in the master branch? Maybe the issue happens because the ratio (width and height relation)? Unfortunately i have not so much time to test, if i find a solution i will let you know.

sorry for the delay, have been really busy. tried again with the latest code, both in dev and master branch, without any result: the image is still tilted. do you think that there is a way to get this fixed? this bug single-handedly ruins my whole project

giaaaacomo avatar Jun 12 '22 16:06 giaaaacomo

@giaaaacomo i will look deeper into it, i think that could be a couple of things to be fixed. I hope to have the time...

kalwalt avatar Jun 13 '22 14:06 kalwalt