Forum Discussion
TheShoeboxDiora
12 years agoHonored Guest
Splitting .mpo files in runtime with Unity?
Basically the title says it all :)
I'm creating a stereo photo viewer for the Oculus, think viewmaster but then EPIC!
The viewer works fine, but the user has to split the images by hand. I was wondering
if anyone knows how to split the .mpo files in runtime ?
Hope someone can help me out!
Thanks,
Daniel!
I'm creating a stereo photo viewer for the Oculus, think viewmaster but then EPIC!
The viewer works fine, but the user has to split the images by hand. I was wondering
if anyone knows how to split the .mpo files in runtime ?
Hope someone can help me out!
Thanks,
Daniel!
3 Replies
Replies have been turned off for this discussion
- CosbyTronHonored GuestPossible code head start:
https://github.com/dmitrybrant/MpoViewer'>
https://github.com/dmitrybrant/MpoViewer
I just skimmed it, but looking at Form1.cs is seems like he's reading in the full byte array and just lobbing off the second half with an offset value. Apparently the MPO is two standard jpgs stored in the same file with a delimiter somewhere marking the end of the first image and start of the next.
You should be able to load it into unity as a text asset, split the byte array (in half, or by some delimiter, not sure there) and load the bytes into two separate images with Texture2D.LoadImage.
All a big guess on my part though :-D - cyberealityGrand ChampionYes. MPO is basically just 2 JPEG files concatenated together. You can just read in the hex-code and split it into two, then read in the results as JPEG. If I remember correct you are looking for 0xD8, which indicates the start of the image ( http://en.wikipedia.org/wiki/JPEG#Syntax_and_structure ). Not sure exactly how that would work in Unity though.
- TheShoeboxDioraHonored GuestHeya Everybody,
Thanks for the fast replies, forgot to check the notify me when a reply is posted box :).
CosbyTron & Cyber Realtiy: sounds doable. Thanks for the tips! I will look into it asap and report back. I don't know what a byte array is YET, but luckily unity is well documented! Sometimes I forget I'm an artist :)
Quick Links
- Horizon Developer Support
- Quest User Forums
- Troubleshooting Forum for problems with a game or app
- Quest Support for problems with your device
Other Meta Support
Related Content
- 4 years ago
- 3 years ago