MixedRealityToolkit-Unity icon indicating copy to clipboard operation
MixedRealityToolkit-Unity copied to clipboard

Best practice sending over image files from backend server to HoloLens?

Open gkh38 opened this issue 9 years ago • 5 comments

I'm currently using a JSON txt file as a configuration file to get several lightweight stuff like strings and numbers. But for my current project I want to get some images from my own webserver and show it into the HoloLens app.

The thing is: I want it to be configurable, and for that purpose I'm currently using a Base64 byte array in a JSON file to get the image. Problem is, when I read and process this array the HoloLens app freezes for a couple of seconds when the app gets started and I initialize the JSON.

I presume there is a better way to load images dynamically, but what is the better way?

gkh38 avatar May 01 '17 13:05 gkh38

How are you loading the JSON file and the images? From inside a Coroutine?

genereddick avatar May 01 '17 15:05 genereddick

You can try to do all of the work on other thread and then use InvokeOnAppThread() to to constructed the texture2D object that unity uses. But this also can cause lag since most of the function unity uses to load images are synchronous, so you can use a coroutine inside the function written inside InvokeOnAppThread to set the texture pixel by pixel and yield the coroutine once it exceeds a certain time threshold. The last approach increase the loading time (not by much if you are loading images sparsely) but it ensures a smooth experience

ignavus avatar May 08 '17 10:05 ignavus

@gkh38 : Any news? Could you improve the dynamic loading of images?

ghost avatar Jul 05 '17 11:07 ghost

Hmmm, never really had any problem loading images dynamically. Just dump your image data into the texture and you should be good to go. What methods are you using to load your image? And what seems to be the bottleneck(parsing your json or loading the texture)? Can either @gkh38 or @HoloFan elaborate on what the performance problem is?

christjt avatar Jul 06 '17 08:07 christjt

Going to close this. It's probably been archived by google by now.

StephenHodgson avatar Oct 28 '17 01:10 StephenHodgson