Log in or register to post comments

Download new MT Dataset and Load it at runtime

February 21, 2019 - 10:59am #1

Hello folks!

I been stuck in this for some days now so I hope you can give me a hand to achieve it or to let me know that that is not possible right now.



My work flow:

  1. Upload the *.xml  and  *.dat  files from a model target to a server.
  2. Download it to my Unity app.
  3. Save them to my persistentDataPath.
  4. Load the *.xml  and  *.dat  files from my persistentDataPath.
  5. Load my Dataset and instantiate some content for it.

First, I've read some examples about how to load the data set at runtime :



https://developer.vuforia.com/forum/model-targets/dynamically-loading-and-activating-datasets

https://developer.vuforia.com/forum/model-targets/multiple-model-targets

https://library.vuforia.com/articles/Solution/How-To-Access-and-Modify-Targets-at-Run-Time.html

https://developer.vuforia.com/forum/faq/unity-load-dataset-setup-trackables-runtime

Based on the examples, I was able to load the dataset I downloaded without console errors but the editor doesn't show the information about that specific model target Behaviour. It just comes empty.



 

I just notice that all the solutions works like a charm when the data set I downloaded also resides inside my unity Assets folder at the moment I build the app but what I was looking for is the capacity to load data sets that are not present at the moment I made my build.

I suspect that Vuforia can correctly load the data sets only if it was inside Unity at the moment I build my app but it can't load a dataset that hasn't been present at the build moment.

Here are a picture when I load the same dataset and there was also present at the build moment. Everything is on place.



So, is there a way to achieve this?

Maybe I need some extra files besides the *.xml and *.dat?

Or even better, are out there a model target service on the cloud? (Like the cloud service for image targets).



Thanks in advance.

Download new MT Dataset and Load it at runtime

February 21, 2019 - 4:16pm #4

Hello @Guiara,

Apologies but my response was probably not clear. The code example I provided was to indicate that datasets can be loaded from a variety of locations. However, reading it back, I see that it is not comprehensive as it does not reference some key Vuforia APIs:

https://library.vuforia.com/content/vuforia-library/en/reference/unity/classVuforia_1_1DataSet.html#aa10b2eaa09ff407163063ca42a4fbd0e

Here are some additional library articles that provide reference code for similar use cases:

The basic idea is that Vuforia device databases can be loaded from anywhere in device storage, as long as the app can read that location during run time.

Admittedly, our documentation is not comprehensive and needs to be improved. We continue to work on improving our documentation.

Thanks,

Vuforia Engine Support

Download new MT Dataset and Load it at runtime

February 21, 2019 - 12:56pm #3

Hello medabit.

Thanks for your response.



As you says there's a way to dynamically load the database during run time via OBB files, but that means that Unity has the MT database previously in the project, then compile it, split the binary, etc., and I want exactly the oposite, lets say, download a new and previously unknown MT database to my app. 



Maybe what you are trying to say is that I need to upload an OBB File for each new MT database I want to use or despite the ModelTargetBehaviour dropDown comes empty, it has all the correct data inside and the Unity editor just don't show it?, let me know if that's not what you was trying to say.



Any way, OBB files works great with Android but I'm not aware if there's an option like that on iOS, do you know one?



Thanks,

Guiara

Download new MT Dataset and Load it at runtime

February 21, 2019 - 12:24pm #2

Hello,

Guiara wrote:

Based on the examples, I was able to load the dataset I downloaded without console errors but the editor doesn't show the information about that specific model target Behaviour. It just comes empty.

Device databases only appear in the Unity Inspector when they been imported via Assets->Import Package->Custom package... This places the .unitypackage contents in Assets/StreamingAssets/Vuforia folder of your project, and is the only place our Unity extension looks for these assets.

Guiara wrote:

I just notice that all the solutions works like a charm when the data set I downloaded also resides inside my unity Assets folder at the moment I build the app but what I was looking for is the capacity to load data sets that are not present at the moment I made my build.

I suspect that Vuforia can correctly load the data sets only if it was inside Unity at the moment I build my app but it can't load a dataset that hasn't been present at the build moment.

I disagree with your assessment. The articles referenced are specific to the use case of being able to dynamically load device databases during runtime, as downloaded from a CMS. This has been successfully implemented in many commercial apps that I'm aware of.

Here is an article about loading datasets from an OBB file. Fundamentally, the use case is the same as what you're trying to achieve.

https://developer.vuforia.com/forum/unity/load-dataset-android-split-binary-obb

Guiara wrote:

Or even better, are out there a model target service on the cloud? (Like the cloud service for image targets).


Currently, the Vuforia Engine SDK's Cloud Recognition service does not support Model Targets.

Thanks,

Vuforia Engine Support

Log in or register to post comments