paug paris 2011
TRANSCRIPT
Creating Novel Augmented Reality Applications for Android
1 PAUG
www.diotasoft.com
Sebastian Knödel
sekond
Ludovic Perrier
ludovic_perrier
Yohan Hadjedi
nah0y
Content
Brief History of Mobile AR
Mobile AR SDKs & APIs
Qualcomm AR SDK (QCAR)
QCAR & Unity3D
Mobile AR Games
Future of mobile AR
2 PAUG
Brief History of Mobile AR
Sensor based tracking
GPS position Compass orientation
Courtesy Wikitude Wikitude
3 PAUG
2009
Vision based tracking
Courtesy TU Graz
ARToolkitPlus NyARToolkit Special Marker 1999 2007 2009
Brief History of Mobile AR
Vision based tracking
Natural Features Diotasoft - Werber
Qualcomm AR
Courtesy Qualcomm
Metaio/Juneio Courtesy Metaio
4 PAUG
2010
Mobile AR SDKs & APIs
Proprietary Public
5 PAUG
Qualcomm AR SDK (QCAR)
• Library for mobile AR development
• Android only
• Supported devices Qualcomm CPU (Nexus One/S, HTC Desire)
• SDK with Eclipse integration
Different target types
6 PAUG
Mobile application
Target Resources
QCAR library
Workflow QCAR
Target Images (jpg/png)
QDevNet
Target Management Application
Target.dat Config.xml
App Logic & Rendering Engine
Target Position
7 PAUG
QCAR API
Android
Camera
Tracker
Rendering
Virtual Button
Multi Image Target
Image Target Marker Developer Application
8 PAUG
Developing with QCAR Java
mRenderer = new myRenderer();mGlView.setRenderer(mRenderer);
myRenderer implements GLSurfaceView.Renderer{ void onDrawFrame(GL10 gl){
}}
Initialize SDK
myNativeRenderFrame();
C/CPP
Load Tracker
Update Camera
Pose
Update GL Rendering
Close SDK
9 PAUG
myApp extends Activity{
void onCreate(){
}
void onPause(){
}
void onDestroy(){
}};
Initialize_App();Initialize_QCAR();
mLoadTrackerTask = new LoadTrackerTask();
QCAR.onPause();
QCAR.deinit();
myNativeRenderFrame(JNIEnv *, jobject){
glClear(…);
// Render video background: QCAR::Renderer::getInstance().begin();
for(i … state.getNumActiveTrackables()) {
QCAR::Trackable* trackable = state.getActiveTrackable(i);
modelViewMatrix = convertPose2GLMatrix(trackable->getPose());
glMatrixMode(GL_MODELVIEW); glLoadMatrixf(modelViewMatrix.data); … … Add Your OpenGLES 1.1/2.0 Render Code Here …}
// finish GL Rendering QCAR::Renderer::getInstance().end();
}
QCAR and Unity3D
10 PAUG
QCAR and Unity3D
11 PAUG
Workflow
• Create Target QDevNet • Add target resources to project
• Add ARCamera Prefab • Add myTarget Prefab • Add 3D objects, physics, shaders, Game Logic, etc. • Deploy on Android device
Soundplugin for Unity3D
PAUG 12
AndroidSoundPlugin.CS (C#) public class AndroidSoundPoolPlugin : MonoBehaviour {
[DllImport("javabridge")] private static extern int playSound(int index, float volume, int repeat, float pitch); [DllImport("javabridge")] private static extern void stopSound(int currentStream);};
NativeJavaBridge.CPP (JNI) jint JNI_OnLoad(JavaVM* vm, void* reserved) {
jclass cls_Activity = jni_env->FindClass("com/unity3d/player/UnityPlayer"); jclass cls_JavaClass = jni_env->FindClass("com/diotasoft/pluginunity/JavaClass"); activitySoundPlay = jni_env->GetMethodID(cls_JavaClass, "ActivitySoundPlay", "(IFFIF)I"); …}
int playSound(int index, float volume, int repeat, float pitch) { jint currentStream = (jint)jni_env->CallObjectMethod(JavaClass, activitySoundPlay, index, volume, repeat, pitch); …}
JavaClass.java SoundManager.java
public static void initSounds(Context theContext) { … mAudioManager = (AudioManager) mContext.getSystemService (Context.AUDIO_SERVICE); }
public class JavaClass{private Activity mActivity;
public JavaClass(Activity currentActivity) { mActivity = currentActivity; SoundManager.initSounds(mActivity);}
public int ActivitySoundPlay(int id, float volume) { return SoundManager.playSound(id, volume,…);}
SDK
NDK
Unity
ARLabyrinth The Circus
Diotasoft Games
13 PAUG
Conclusions
14 PAUG
QCAR Android SDK/NDK
• Open system (hands on)
• Existant code integration
• Features you implement
• Developer community
QCAR Unity
• Closed system
• Fast content creation
• Plugins & profiling
• Rich feature sets provided
Future is Markerless
PAUG 15
Merci beaucoup
16 PAUG