Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Mobile_AR_with_ARCore.pdf

2307a37297162f815342545a2068b2f1?s=47 Erik Hellman
November 19, 2018
6

 Mobile_AR_with_ARCore.pdf

2307a37297162f815342545a2068b2f1?s=128

Erik Hellman

November 19, 2018
Tweet

Transcript

  1. Mobile AR with ARCore Moble AR with ARCore - @ErikHellman,

    Øredev 2018
  2. https://9to5mac.com/2018/05/16/comment-stop-using-ar-as-a-gimmick/

  3. Transformative AR Moble AR with ARCore - @ErikHellman, Øredev 2018

  4. Moble AR with ARCore - @ErikHellman, Øredev 2018

  5. Moble AR with ARCore - @ErikHellman, Øredev 2018

  6. MERGE Cube https://mergevr.com/cube

  7. Microsoft HoloLens https://www.engadget.com/2017/11/01/microsoft-hololens-hard-hat-european-expansion/

  8. Magic Leap Moble AR with ARCore - @ErikHellman, Øredev 2018

  9. Transformative AR Moble AR with ARCore - @ErikHellman, Øredev 2018

  10. ARCore from Google https://developers.google.com/ar

  11. Motion Tracking https://developers.google.com/ar/discover/concepts

  12. Environmental understanding https://developers.google.com/ar/discover/concepts

  13. Light estimation https://developers.google.com/ar/discover/concepts

  14. User interaction Oriented Points Anchors and Trackables Augmented Images Cloud

    Anchors Moble AR with ARCore - @ErikHellman, Øredev 2018
  15. Anchors Moble AR with ARCore - @ErikHellman, Øredev 2018

  16. Getting started with ARCore (Android) Moble AR with ARCore -

    @ErikHellman, Øredev 2018
  17. override fun onResume() { super.onResume() val arCoreApk = ArCoreApk.getInstance() if

    (!arCoreApk.checkAvailability(this).isSupported()) { // Not supported - notify user! return } if (arCoreApk.requestInstall(this, true) == ArCoreApk.InstallStatus.INSTALL_REQUESTED)) { // Installation needed - activity will pause return } // Everything is ok to go! } Moble AR with ARCore - @ErikHellman, Øredev 2018
  18. Sceneform (Android) Moble AR with ARCore - @ErikHellman, Øredev 2018

  19. Sceneform → High-level scenegraph API → Realistic Physical Based Rendering

    using Filament → Android Studio plugin Moble AR with ARCore - @ErikHellman, Øredev 2018
  20. Filament https://github.com/google/filament

  21. Sceneform dependencies { // Provides ARCore Session and related resources.

    implementation 'com.google.ar:core:1.5.0' // Provides ArFragment, and other UX resources. implementation 'com.google.ar.sceneform.ux:sceneform-ux:1.5.1' // Alternatively, use ArSceneView without the UX dependency. implementation 'com.google.ar.sceneform:core:1.5.1' } Moble AR with ARCore - @ErikHellman, Øredev 2018
  22. Sceneform <fragment android:id="@+id/ar_fragment" android:name="com.google.ar.sceneform.ux.ArFragment" android:layout_width="match_parent" android:layout_height="match_parent" /> Moble AR with

    ARCore - @ErikHellman, Øredev 2018
  23. Sceneform val arFragment = fragmentManager .findFragmentById(R.id.ux_fragment) as ArFragment? arFragment?.setOnTapArPlaneListener {

    hitResult, plane, motionEvent -> // Create new anchor and node val anchor = hitResult.createAnchor() val anchorNode = AnchorNode(anchor) // Add to the scene anchorNode.setParent(arFragment.arSceneView.scene) // TODO Add content to the new anchor... } Moble AR with ARCore - @ErikHellman, Øredev 2018
  24. Scneeform - Display models arFragment?.setOnTapArPlaneListener { hitResult, plane, motionEvent ->

    ModelRenderable.builder() .setSource(this, Uri.parse("earth.sfb")) .build() .thenAccept { val anchor = hitResult.createAnchor() val anchorNode = AnchorNode(anchor) val transformableNode = TransformableNode(arFragment.transformationSystem) .apply { setParent(anchorNode) renderable = it } anchorNode.addChild(transformableNode) anchorNode.setParent(arFragment.arSceneView.scene) } } Moble AR with ARCore - @ErikHellman, Øredev 2018
  25. Sceneform - Display Android views Moble AR with ARCore -

    @ErikHellman, Øredev 2018
  26. Sceneform - Display Android views arFragment?.setOnTapArPlaneListener { hitResult, plane, motionEvent

    -> ViewRenderable.builder() .setView(this, R.layout.simple_form) .build() .thenAccept { card -> val anchor = hitResult.createAnchor() val anchorNode = AnchorNode(anchor) TransformableNode(arFragment.transformationSystem).apply { setParent(anchorNode) renderable = card select() } anchorNode.setParent(arFragment.arSceneView.scene) card.view.findViewById<Button>(R.id.okBtn).setOnClickListener { arFragment.arSceneView.scene.removeChild(anchorNode) anchor.detach() } } Moble AR with ARCore - @ErikHellman, Øredev 2018
  27. Augmented Images Moble AR with ARCore - @ErikHellman, Øredev 2018

  28. Configure Augmented Images // ARCore session sestup val session =

    Session(this) val config = Config(session) // Open image database val inputStream = context.assets.open("my_images_db.imgdb") val imageDatabase = AugmentedImageDatabase.deserialize(inputStream); // Enable image tracking config.setAugmentedImageDatabase(imageDatabase); session.configure(config); Moble AR with ARCore - @ErikHellman, Øredev 2018
  29. Track images // in onDrawFrame() val frame = session.update() val

    updatedAugmentedImages = frame.getUpdatedTrackables(AugmentedImage::class.java) updatedAugmentedImages.forEach { when (it.trackingState) { TrackingState.PAUSE -> // Detected, but not yet tracked TrackingState.TRACKING -> // Tracking! Create an anchor TrackingState.STOPPED -> // Remove anchor } } Moble AR with ARCore - @ErikHellman, Øredev 2018
  30. Cloud Anchors Moble AR with ARCore - @ErikHellman, Øredev 2018

  31. Cloud Anchors <meta-data android:name="com.google.android.ar.API_KEY" android:value="<YOUR_API_KEY>" /> Moble AR with ARCore

    - @ErikHellman, Øredev 2018
  32. Moble AR with ARCore - @ErikHellman, Øredev 2018