-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Marker based and Location based elements does not work together #702
Comments
Hi, I gave a look, and two problems turned out:
|
@umutto feel free to give it a look and to open a PR on this :) |
I would like to but after looking into it I'm a bit lost. I'm not very familiar with three.js and 3D calculations so I don't think I would be a great help. Saying that I think the reason is in marker based recognition, camera is set to static (in <0, 0, 0>), never moves and marker object positions are updated accordingly. This is also written in the documentation here (a-marker-camera). Now, there is a So I've looked into offsetting the markers to kinda move together when gps-camera moves by adding the following lines here. if (document.querySelector('[gps-camera]')) {
var cameraPosition = document.querySelector('[gps-camera]').object3D.position;
markerObject3D.position.add(cameraPosition)
} which fixes the positioning, but due to my inexperience in 3D calculations I couldn't offset the camera rotation that happen here. Also this kinda felt a bit hackish way. I think we should adapt geoAR.js to static camera or fix the |
Actually now that I had a second look, setting I'm not sure how to combine compass heading and this camera rotation but solution seems to be that. Sadly I won't have much time to work on this couple of weeks, but I'll try to take a look after that. |
Thank you. I will be busy for nft development of arjs, so our best bet for now is you.😊
|
I'd also love to see this feature implemented, so I had a quick look at the source code. In my opinion with the current implementation this is unfortunately impossible. As @umutto points out, the camera behavior in both "modes" is fundamentally different.
The approach I would suggest is to render both Three.js scenes and then overlay them on the same canvas. Means there are two active cameras, one handling markers, one handling location based objects. Both renderers then render into the same canvas resulting in an overlayed picture. @nicolocarpignoli @umutto Thoughts? Comments? |
@andypotato it's a brilliant idea. Maybe the only that can work without have to rewrite one of the two features. |
@andypotato Yeah good observation and idea! The two features are fairly separated, I don't think they use any common code so it should be most straight forward / quick way to implement it. I doubt it but wonder if that would effect the performance though. Sadly I will not have time to check it out until next month, but would gladly help/test after then. |
added on new repo, we can continue there: AR-js-org/AR.js#29 |
Describe the bug
When using geo based and marker based AR in the same scene only either one of them work. Problem seems to be the camera entity or I am missing something.
When
<a-entity camera/>
is used as advised on arjs docs for multiple marker support, geo based elements are not displayed.<a-entity camera gps-camera rotation-reader/>
does not work either.When
<a-camera gps-camera rotation-reader/>
is used as advised on geoarjs docs, then barcode or pattern marker is found but the overlaying a-element can't be seen (I was able to see it at some weird lucky angles, maybe the problem is due to camera being moved?). Acts as same when<a-camera camera gps-camera rotation-reader/>
is used or when 2 different camera elements used as<a-camera camera gps-camera rotation-reader/><a-entity camera/>
To Reproduce
I have prepared a simple example to reproduce, change the camera elements to see different cases:
Expected behavior
As my understanding of ARjs 2.0, both cases should be able to work at tandem. When a marker is read, it should display an element and when the device orientation changes to a nearby geo-entity-place it should display it's element. (sphere and a box on the example code)
Desktop (please complete the following information):
Smartphone (please complete the following information):
Thank you very much!
The text was updated successfully, but these errors were encountered: