Giter VIP home page Giter VIP logo

cardboardsdk-ios's Introduction

CardboardSDK-iOS

March 2016 update

Google has released an official iOS CardboardSDK. However, for now it's a closed source precompiled library.


iOS port of Google's CardboardSDK.

Treasure example fully running with magnetic trigger detection. Successfully tested on an iPhone 6 running iOS 8 and on a iPhone 5 running iOS 7.

It (mostly) has feature parity with Android's CardboardSDK v0.5.1.

Unity

There is a bundled sample Unity project compatible with Unity 5.0.0f4 (use other Unity versions at your own risk).

The Unity\Cardboard.UnityProject folder contains the sample project based on Google's CardboardSDK-Unity plugin.

Unity Instructions

There are two ways of running the Unity project on an iOS device:

a. Pre-built Unity Xcode project

You can use the bundled pre-built Unity Xcode project, but you need to regenerate libiPhone-lib.a, as it's too big to commit to GitHub.

This method is useful for updating the Xcode project after changing the Unity project or its Cardboard Unity scripts.

  1. Open the Unity project on Unity 5.0.0f4.
  2. Go to File -> Build Settings, choose iOS and click Build. Choose the already existing Unity\Cardboard.UnityProject\builds\iOS as the output folder and click on Append. Unity should then update your current project with the needed Unity library binary without overwriting the CardboardSDK native code.
  3. Open Unity\Cardboard.UnityProject\builds\iOS\Unity-iPhone.xcodeproj on Xcode and run on an iOS device (tested on Xcode 6.2).
b. Build your own Unity Xcode project

You can disregard the Unity\Cardboard.UnityProject\builds\iOS\ folder and build your own project from scratch.

This method is useful if you want to rebuild the Unity Xcode project after updating Unity to a newer version (newer Unity versions won't let you append to an already built Xcode project).

  1. Open the Unity project on Unity 5.0.0f4 or later.
  2. Go to File -> Build Settings, choose iOS, click Build and save it to any folder of your choosing.
  3. Open the built project on Xcode.
  4. Add the CardboardSDK source files to the Classes group: right click on Classes and choose Add files to "Unity-iPhone". Do not copy the CardboardSDK source, just link them at their original location by unchecking Copy items if needed.
  5. Add the GLKit framework: go to the Unity-iPhone target -> Build Phases -> Link Binary With Libraries and add the GLKit.framework.
  6. Go to Project -> Build Settings and set: C++ Language Dialect to GNU++11.

Unity Issues

  • Magnetic trigger not working
  • Distortion correction not working

General Todo

  • Update native code and Unity project to CardboardSDK v0.5.2.
  • Fix Unity issues
  • Replace Matrix3x3d and Vector3d by eigen3.
  • Provide easy way of configuring custom Cardboard devices.
  • Add additional examples.

Discusion

Overlay Views

The CBStereoGLViewclass allows any UIView to be rendered to OpenGL. You can subclass it for your app overlay (lens distortion correction is correctly applied to it). See the TextOverlayView subclass on the Treasure example.

Avoid updating the texture on every frame as it's an expensive operation (performing UIView animations is not a good idea).

Headtracker

The HeadTracker can either use:

  • Google's OrientationEKF class with raw gyro and accelerometer data. Has very low latency but suffers from gyro drift (slight continuous rotation movement when stationary). This is the current Android's CardboardSDK approach.
  • CoreMotion's CMDeviceMotion.attitude. Improves the gyro drift, but very noticeably worsens the latency (CoreMotion does its own EKF-like internal IMU-fusion algorithm).
  • CoreMotion's CMDeviceMotion.attitude data with Google's OrientationEKF. Best of both worlds: low latency and low gyro drift, but uses more CPU (basically it does the IMU integration twice).

In general using HEAD_TRACKER_MODE_CORE_MOTION_EKF is recommended.

In HeadTracker.mm, you can set #define HEAD_TRACKER_MODE to either HEAD_TRACKER_MODE_EKF, HEAD_TRACKER_MODE_CORE_MOTION, or HEAD_TRACKER_MODE_CORE_MOTION_EKF.

General Issues

  • Reading the Cardboard configuration from NFC has not been implemented, as there's no public NFC API available on iOS 8. Hopefully Apple will provide one on iOS 9 (only the iPhone 6/6+ or higher have an NFC sensor).

License & Contributors

CardboardSDK-iOS, as the original CardboardSDK, is available under the Apache license. See the LICENSE file for more info.

See AUTHORS.md for some of the project contributors.

cardboardsdk-ios's People

Contributors

cardenb avatar equinox2k avatar guydavis90 avatar rsanchezsaez avatar samhare avatar sean-purcell avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cardboardsdk-ios's Issues

Typedef redefinition with different types...

Hey ho!
I installed the latest xCode Verison (9.0) on my machine.
After building my Project for the iPhone (X on Simulator, but the regular build failed as well) there are some semantic issues:

typedef NSUInteger MTLPixelFormat; // Typedef redefinition with different types ('NSUInteger' (aka 'unsigned long') vs 'enum MTLPixelFormat') enum // Declaration does not declare anything { MTLPixelFormatBGRA8Unorm, // edefinition of enumerator 'MTLPixelFormatBGRA8Unorm' MTLPixelFormatBGRA8Unorm_sRGB, // Redefinition of enumerator 'MTLPixelFormatBGRA8Unorm_sRGB' };

How could I avoid this? I don't support metal on my release build and even when I recompile with metal activated it throws these errors.

Any help would be very appreciated.

Thanks in advance,
Martin

how to read custom Cardboard Profile and Read QR code

Hi,

I am aware this repository is closed but as I am using this lib for my app. Would be pleased if you can let me know how can I read QR code profile and update my custom distortion.

I want to read QR code. When I read QR code using cardboard official app it is not reflected in my app. But similarly it is working fine in Android side of my application.

Swift support

Hello there,

writing it in Swift 2 would be cool.

I am currently using it for a project. Maybe I could help?

regards

Designated Initializer to use CDBViewController via Storyboard

Hello,

the CDBViewController currently only implements the init designated initializer. Storyboard uses initWithCoder as designated initializer. When I'm trying to copy & paste the code from the init method it only shows a black screen.

I ended up solving the problem like this: kgoedecke@bd29578

Whats the proper way to run the init code from initWithCoder?

Undefined symbols for architecture armv7: "_CTFontGetGlyphsForCharacters" ... in libGoogleKitCore.a(GoogleKitCore.o)

Hi there,

I tried your SDK a month or so ago, it was working very nicely.
However, recently I updated the Cardboard SDK in my project (I think it was like a week ago) and now I cannot compile it for iOS, even tho I follow the same steps - the ones you wrote. Every time I want to compile, I get the following errors:

Undefined symbols for architecture armv7:
"_CTFontGetGlyphsForCharacters", referenced from:
l302 in libGoogleKitCore.a(GoogleKitCore.o)
"_CTFontCreateWithName", referenced from:
l299 in libGoogleKitCore.a(GoogleKitCore.o)
"_CTFontManagerRegisterFontsForURL", referenced from:
l231 in libGoogleKitCore.a(GoogleKitCore.o)
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Here is a screenshot:
error
Any ideas what can be causing this? Thanks a lot!

how to create a vr view for ios app

hi im creating an ios app where the user can choose image and video from gallery or take photo and make it into an stereographic view.i.e vr view (which has a left and right split for each eye). im complete new beginner to ios.please do help.

Integration to current working Unity 4.6 android project

Hi! I have not very clear how to replace/upgrade/change my current working android project.

First, of all (before getting to your git), when I compiled the unity project to ios build, it did it successfully, then, on Xcode, I tried to compile the file, but... It failed with:

Undefined symbols for architecture armv7:
  "_InitFromUnity", referenced from:
      RegisterMonoModules() in RegisterMonoModules.o
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Searching on goole, I landed on your git, I first tried option b (just added the Cardboard-SDK folder on Classes folder as the instructions say) and it had compiler errors, I fixed one by one... until I got again the same "_InitFromUnity" error...

So, Can you please Explain how do I build for iOS?

I'm using Unity 4.6.3 and Cardboard Unity Plugin 0.4.9

Thanks!

Build error: __unity_getFrameParameters

Hi,
I'm trying to build this with Unity 5.0.1f1 and Xcode 6.3 for iPhone 5S on iOS 8.3.
I followed your steps for setting up the project. Version A wouldn't work, (the Append option was greyed out,) so I went with option B and built to a new folder and added the resources you mention. However, I get a build error I can't resolve:

Undefined symbols for architecture armv7:
  "__unity_getFrameParameters", referenced from:
      RegisterMonoModules() in RegisterMonoModules.o
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I see _unity_getFrameParameters in CardboardUnity.cpp, so I'm not sure what the issue is. Any hints?
Thanks
Ash

Prepare for update to SceneKit version?

Hi @rsanchezsaez ,thanks for providing a terrific framework to us. Now i want to move the code to Scenekit.But I met problems with Scenekit + CardboardSDK-iOS.In my code i use SCNRenderer to match with CBDViewController's openGL Context.But the [SCNRenderer render] function is deprecated: deprecated in iOS 9.0.And Particle Effects can not show correctly.
So,is there possible to change the project to Scenekit? Thanks.

adding images

Hi - looks like a cool project. I downloaded it and ran it on my phone. I was wondering, how would I use images in this? is there anyway I can just pass images in and simply move my phone around?

Fix for simulator

Hi,

the following patch fixes the pink screen shown on the simulator (as reported in issue #6):

diff -r 99ad9a206f6c ios/dependencies/CardboardSDK-iOS/src/CardboardSDK/Cardboard/Sensors/HeadTracker.mm
--- a/ios/dependencies/CardboardSDK-iOS/src/CardboardSDK/Cardboard/Sensors/HeadTracker.mm   Thu May 14 04:53:59 2015 +0200
+++ b/ios/dependencies/CardboardSDK-iOS/src/CardboardSDK/Cardboard/Sensors/HeadTracker.mm   Thu May 14 04:57:23 2015 +0200
@@ -176,11 +176,15 @@

 bool HeadTracker::isReady()
 {
+#if TARGET_IPHONE_SIMULATOR
+   return true;
+#else
     bool isTrackerReady = (_sampleCount > kInitialSamplesToSkip);
   #if HEAD_TRACKER_MODE == HEAD_TRACKER_MODE_EKF || HEAD_TRACKER_MODE == HEAD_TRACKER_MODE_CORE_MOTION_EKF
     isTrackerReady = isTrackerReady && _tracker->isReady();
   #endif
     return isTrackerReady;
+#endif
 }

 GLKMatrix4 HeadTracker::lastHeadView()

Maybe paths in the header of the patch must be updated to be able to apply it (are from a Mercurial project).

GUI click event

Hi, Ricardo.
Great work for cardboard in iOS.
I've got one question about GUI in unity sdk. I run the unity sample in your package, but can't see pointer image and also can't click on button.
Does your sdk for unity support click event of gui button?
Regards. Johanne.

What about smaller screens? e.g. not 50/50 split

I have an iPhone 4S and with the Durovis SDK I tried earlier on, I had to adapt to the smaller 3,5 screen on my phone. Instead of setting the left/right cameras to each take 50% of the screen, I had to adjust them as follows:
left camera = 25% width, aligned to the left (x=0)
right camera = 25% width, aligned to the right (x=0.75)
Height can stay at 100%

This reconstructed the stereo view, albeit with a smaller view (the middle of the screen stays empty).

With the CardboardSDK-iOS, I did set both left/right camera's that way, but the rendering of the two cameras to the main camera does not take this into account.

Any hints on where do I have to adjust this?
I was looking at CopyCameraAndMakeSideBySide in CardboardEye.cs but not sure how to adapt it.

If there is a simpler method, that would also be fine.
Maybe the stereo-setting?
Maybe the spacing between the two camera's?

With bigger screens, your eye center is nicely in the middle of half the screen, but we have to adapt this for smaller (e.g. iPhone 4S) or bigger (iPad) screens.

Headtracker glitching on iPhone 6

On iPhone 6, the headtracker occasionally "jumps" between different positions. The problem seems to be related to core motion (it does not happen in pure EKF mode). If the "jump" occurs for a rotation around the vertical axis, it also occurs for the "opposite" rotation, e.g. 180° across.

The glitch could not be observed on iPhone 5 or 5s.

Any ideas or hints for tracking that one down?

Assertion failure

*** Assertion failure in -[GCSSphericalMetadataExtractor intFromBytes:withLength:], googlemac/iPhone/CardboardSDK/Source/GCSSphericalMetadataExtractor.mm:201

"Pink screen"

Hi I tried the CDBTreasure demo, but when I run it in simulator it's just showing a pink screen and nothing more happens.

Cardboard renders to black when switched to VR Mode with uGUI

When using uGUI the UI shows up fine when I don't turn on VR mode. However, When I do I see black and just the UI. I took a snapshot in Xcode of the OpenGl State and I can see the the split view via the left and right cameras from cardboard. After, the depth buffer clears and renders to black. then the buttons renders. Any suggestions?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.