-
Notifications
You must be signed in to change notification settings - Fork 69
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
Can't load multiple NFT markers #95
Comments
How many would you want to load? |
Now I'm just trying to load two, but maybe 5 or 6 in the future. I found that if I create another ARController I can load one marker in each controller. If wonder if it is meant to be used that way? Or should I be able to load multiple markers in the same ARController object? |
@nicolocarpignoli had played with it. It is certainly not meant to be by loading ARController multiple times. But I thought @nicolocarpignoli had success with 2. |
Hi @ianmethyst thanks for reporting this. What does it meams Uncaught in the log error? Can you post the entire log in specific the Uncaught part? I think that could be a memory issue.... |
I was able to make it work using AR.js version. Honestly we have to check on that and see differences. I'm sure we can make it work with lean jsartoolkit5 (it should be easier, actually). |
I'll upload the complete log with an example project to replicate the error later. I'm not at home right now |
@ianmethyst Perfect! |
Sorry for the delay. Here is the log (which is way too big compared to what is shown in the Chrome DevTools), and a zip with a git repo that contains the example I used when I found this problem. I removed all the files from the jsartoolkit repo that are not related (but kept the directory structure) and added a npm script so you can do With |
Is there any way I can help with this? I believe there is missing some documentation and some guidance on how to contribute, because I gladly help but I find myself quite lost when I try to navigate the repo. For instance, I don't fully understand what is built with emscripten and what is plain javascript that ends in the final code |
We highly appreciate any help. So yes you can certainly help. What is your experience what would you like to contribute? |
Sorry @ianmethyst @ThorstenBux i haven't had the time to look Into this. I will try today. |
@ianmethyst i will provide an example soon with a different approach, though i would investigate deeply on that error in a near future. |
I tested your code @ianmethyst rebuilding the libs with |
I have some experience with JavaScript. I use it for frontend and backend (with Node.js) development. I've also been using three.js for a while. I'd like to start helping fix this issue as it is something we are aware of, but I'd mostly like to contribute with the documentation, because I believe it's the most important part of any FOSS software. I'm gonna open another issue for that, though.
Alright, thanks for trying that @kalwalt. I'll remove the Worker from the repo from the example I uploaded and see if it stills throws the exception |
@ianmethyst i also tested without the WebWorker and happens the same error. I think we should create a multi handler for Multi NFT, starting from the C++ code. We will go in detail in a dedicated issue.
yes this is fundamental. I improved a bit the docs inside the api but should be enhanced. Actually you can create the docs running |
any update on this? or any workaround? thank you for your time, im using artoolkit.min.js and I have same exception. Seem to be blocking in the second call to : var id = Module._addNFTMarker(arId, prefix); First marker being added succesfully. |
@ThorstenBux ThorstenBux @ianmethyst nicolocarpignoli |
@Memleak1 No any updates from this point, i was focused to solve other part of the code. To handle correctly and efficently a series of NFT markers is required some changes in the C++ code, I think i know how to do but never had the time to implement. 🙂 |
Sorry, I was really busy lately and couldn't look into this this before. I just checked the code in the C++ ARToolKit5 repo and found a few things. I don't know C++, so correct me if I'm wrong, but the I'll leave the links to the relevant files: |
@ianmethyst you looked in the right place, we should implement a sort of iterator as it exist in ARMarkerNFT, but without the threaded part of course. |
@kalwalt @ianmethyst, thank you for coming back to me, I tried to run the code to take a look and seem like I cannot build it using VS 2017. Did you manage to make it run? Seems I have issues with the KPM library |
@Memleak1 You can use (and you should, to avoid unexpected errors due to OS differences) Docker to build jsartoolkit. It takes the C++ and turns it into JS using Emscripten. If you're trying to build C++ artoolkit5, then you can check this section of its readme. |
@ianmethyst yes thats what we do to create an js version, but are you suggesting to make the change on the c++ side and test on the js side? I didnt have any luck building the C++ vs project so far 2017 & 2013. |
@Memleak1 please open another issue and post some logs, with detailed informations as much as you can. You can file an issue here or at my repository issue tracker Thank you 🙂 |
I can confirm this error. I have been digging through the codebase including the underlying artoolkit5 the past couple of days. It was a crazy journey :) You cannot call addNFTMarker multiple times on a single AR controller. Once the marker dataset is set, calling this again will throw error. I believe there are a couple of logical flaws in the code. I wonder does anyone able to run multiple markers before. I fixed a couple of things and finally managed to get something working. If you want, you can use my build here: https://github.com/hiukim/jsartoolkit5/tree/fixnft/build You still cannot call loadNFTMarker multiple times here, but I have extended a new method ar.loadNFTMarkers that accept multiple urls.
If you want to build yourself, you need to use this artoolkit5 branch https://github.com/hiukim/artoolkit5/tree/nftfix There is a small fix here as well. |
@hiukim Nice! What about performances? How many NFT markers is possible to load with your mod? |
@hiukim amazing! how did you manage to build your visual studio project? I'm having a hard time building it. Regarding the multimarker, seem like so people managed to get it working in A-Frame, I didnt look yet a their solution. I wonder what they made differently... kalwalt#40 |
@kalwalt @Memleak1 The whole ar process consists of two parts: The detection part and the tracking part. The detection part is trying to find a first match in the loaded markers. After first match, the tracking part comes in and keep track of the match. There are actually two different algorithms behind. The way it is (or supposed to be) working now is that: At the beginner, ONLY the detection part is running. It try to find a match in all the markers loaded (e.g. through the The ar controller as is now cannot track multiple markers. It is supposed be able to accept loading multiple markers for detection though. My fix is for the second part. It's important to point out that all I'm saying is for one AR controller. That's the behaviour of an AR controller. But you can spawn multiple AR controller to track multiple markers. I hope I explained that clear enough. Now I can come back to the questions :) Regarding performance, my changes won't hurt the performance because in the tracking part, it is still only tracking one marker. The performance of the detection part will depend on the number of loaded markers and their resolutions. Regarding why I need to change the artoolkit5 source code. because I think I figured a bug there. If there is anyone here familiar with the source code, it would be great to if he/she can also take a look. I mean, I'm not totally confident too. If anyone interested in, it's good to have another eye to double check. The changes is here: hiukim/artoolkit5@ac59580 Regarding tracking multiple markers in another project of aframe. I have also dig into that too. If I understand the code correctly, each anchor spawns their own web workers, and each worker itself spawns an an AR controller. In that case, I'm not surprised if there is a working example that can "track" multiple markers using multiple AR controllers. I'm curious, however, is anyone able to load multiple markers in one AR controller though. @Memleak1 Regarding building the project. I'm not sure what you mean by building visual studio project. I just follow the README and build with docker. |
Hi everybody, Branch and direct link to the example is this one: To try it out, you should clone the repo, switch on the branch 'multiple-nft-markers' and run the html file above under an https server. I have not checked this example in a while, so don't know much about performances. I'm sure it works though. Let me know |
I can confirm what you said about thé algorithme @hiukim. If your changes to artoolkit5 are necessary maybe @ThorstenBux may integrate them on the main repository. But it should be tested for all the platforms (Linux, Windows, Mac..), maybe Will be better to create a emscripten branch, and enclose that code between defines. So to prevent for other platform to be compiled. But mine Is only a supposition, i have only took a quick look to your code... |
@hiukim the problem with AR.js is that we need to create two instances of ArController: one in the Worker and the other 'outside' in Ar.js, so if you run another nft, there will be 3 ArController. For a performant device maybe is not a problem, but make a difference for another less performant... |
Walter, if you could let me know why you need two controllers that would be great. Cause it was never designed to have two running simultaneously. Is that the same that you did in webarstudio? Then I check there.
Get Outlook for iOS<https://aka.ms/o0ukef>
…________________________________
From: Walter Perdan <[email protected]>
Sent: Sunday, May 3, 2020 9:54:00 PM
To: artoolkitx/jsartoolkit5 <[email protected]>
Cc: Thorsten Bux <[email protected]>; Mention <[email protected]>
Subject: Re: [artoolkitx/jsartoolkit5] Can't load multiple NFT markers (#95)
@hiukim<https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fhiukim&data=02%7C01%7C%7Cfa84e1d847f94c4f12a708d7ef47e82c%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637240964416920587&sdata=%2FZFePQ8QrZTgByvW7Bwm9rphE5IKa4CyvIcqXPDrNQs%3D&reserved=0> the problem with AR.js is that we need to create two instances of ArController: one in the Worker and the other 'outside' in Ar.js, so if you run another nft, there will be 3 ArController. For a performant device maybe is not a problem, but make a difference for another less performant...
I tested to run in a worker a nft Marker plus a Pattern Marker, but the result wasn't succesfull, probably is required a deeper investigation on this subject. If you are interested we can discuss on the AR.js issue tracker. Said this, we need for sure to improve jsartoolkit5, because is the base for many projects...
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fartoolkitx%2Fjsartoolkit5%2Fissues%2F95%23issuecomment-623084079&data=02%7C01%7C%7Cfa84e1d847f94c4f12a708d7ef47e82c%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637240964416920587&sdata=XA17ylREmesQuT9ZnLQebOdyN24iOW3FqDnfXnaYijc%3D&reserved=0>, or unsubscribe<https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAD765PA6DAVC4DAN7QS7M43RPU5LRANCNFSM4LEK2DXA&data=02%7C01%7C%7Cfa84e1d847f94c4f12a708d7ef47e82c%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637240964416930576&sdata=tlV2ER1%2BLo%2FYdmrVCoowo64MWGHU7rMnLb1MfU83Uo0%3D&reserved=0>.
|
yes because in the worker you can not share an instanced object, so you are obliged to create two ARController, we haven't found another solution yet. this is valid for AR.js and webartsudio too. |
@ThorstenBux @kalwalt Yes, I figured artoolkit5 is somewhat unmaintained. Actually, I'm kind of confused with artoolkit5 and artoolkitx. Is the artoolkitx the next version of artoolkit5? In that case, shouldn't we use artoolkitx as the backend? But that would make it jsartoolkitx. haha |
Yes ArtoolkitX Is the next version of Artoolkit5, but the issue is that with Artoolkit5 is easier to develop for emscripten the JavaScript version of the lib with NFT... That sound strange but is the reality. Anyway @ThorstenBux already did the JavaScript ArtoolkitX version. |
I can confirm this hurts performance badly. Having two This got a lot worse when I tried my code on an iPhone 7, because it drops to 3fps, stays there for a while and then crashes
@hiukim I'll try it later! Thanks for your efforts |
Hi @hiukim @Memleak1 @ianmethyst @kalwalt and me decided to collect everything we worked on in the past year or two (which is a lot) in a new org called We both would like to invite you to become members of the org. Just let me know if you are interested. Our big vision is to unify opensource webAR and to be the best opensource SDK for webAR available. |
@ThorstenBux Nice. It's good to have a new base to move forward. I'm happy to contribute. |
@hiukim you are welcome! |
As @ThorstenBux said if anyone is interested just send a message to Thorsten or to me 😄 |
@ThorstenBux I'll be happy to join! |
what does this mean? that webarkit will be based on artoolkit5 ? what's the difference between ar.js and webarkit? anyway i will keep on following this discussions, very interesting. thank you for sharing |
@kalwalt @ThorstenBux great news. I have only one advice: it should be clear to everyone what is the relationships between AR.js, jsartoolkit5, jsartoolkitx, and any other project that is rising/has rised with the '*rtoolkit' name :) Maybe on each repository a brief description may be useful and should be enough |
@nicolocarpignoli Yes i will do an introductory presentation of the project and the idea behind of the organization. A quick clarification: we don't want to replace Ar.js at all, the core of WebArkit will be WebARStudio; improvements that we will do to jsartoolkit5 or artoolkit5 we will be happy to contribute to Ar.js . |
Thanks @hiukim for your great efforts. I just tested it and it works. The current problem I'm facing is the amount of markers that can be loaded. I tested it with 10 markers but unfortunately it failed to load (Exceed maximum pages). But, if I decrease it to 9 markers, it works again. Can you tell me how to increase the amount of markers to be loaded? Please help me, because I need to load 10 markers. Thank you. |
@ifananomali I think there's probably a config settings in artoolkit that controls the limit. could be this one, but I'm not suree https://github.com/artoolkitx/artoolkit5/blob/master/include/ARWrapper/ARController.h#L76 You might have to change it and rebuilt it and try. You can also try to reduce the dpi in your marker images when compile. |
I already tried to reduce all markers dpi but didn't work. Could you please tell me how to rebuild the project? I want to change it from your artoolkit (forked) and then rebuild it. Thank you. |
The build instruction is on the README - section Build the project Step2: You can pull my artoolkit5 repo (should be the nftfix branch) instead of the existing one. Everything else stays the same |
Thank you @hiukim for your help. I've succeeded to increase the number of markers in jsartoolkit5 after rebuilding the ARToolKitJS.cpp with changes on PAGES_MAX. |
nice! |
hello everybody,how's it going? has the function of multiple NFT markers been updated in project in jsartoolkit5? Or is there any other example by three.js? thanks |
Hi @DLGL99GL we implemented multi NFT in our webarkit/jsartoolkit5 and if you want also our ARnft has multi NFT support. |
yeah, that's exactly what I wanted. Thank you so much |
I'm trying to load multiple NFT markers using
artoolkit.addNFTMarker(markerURI, (id) => { /*...*/})
and its throwing an exception (with a number that is different every time it runs) as soon as the second image set starts to load. I tried recompiling jsartoolkit to enable exception catching, but I didn't help a lot.Did anyone had success with this? I'm using a slightly modified version of one of the Misdake's examples (with jsartoolkit code running on a Worker)
The text was updated successfully, but these errors were encountered: