Code Monkey home page Code Monkey logo

ar-workshop's Introduction

Welcome to React Native AR and GraphQL workshop

In this workshop, taught at ChainReact2019 and will walk through creating basic Ikea like Store app where we will be able to see products in Augmented Reality, scale them, rotate, them, move around in real world and interact with them.

Topics that we will cover include

  • Getting started with AR for React Native
  • 3D coordinate systems
  • Lighting and textures fundamentals
  • Creating dedicated AR views in your React Native apps
  • Creating AR content and positioning it in the real world
  • Working with 3d models
  • Working with UI in AR
  • AR Portals
  • User inputs and animations
  • Applying Physics
  • Getting AR data from GraphQL endpoint and rendering in your app
  • Adding real time capabilities to your AR apps with GraphQL subscriptions

Step0 - Having your machine ready before workshop

You'll be able to write AR in React Native for either iOS, Android, or both. Let's make sure your machine is ready to get rolling.

It's important that you are able to run a "Hello World" AR app using ViroReact BEFORE this workshop, even if you're not familiar with the steps.

We'll go over all the installation at the very beginning, but it's crucial you will have a basic setup, so you can focus on creating an app.

Step1 - Understanding AR

In this section you will put to test various AR capabilities

  • Create 3 boxes and position them in pyramid in front of the viewer (ViroBox)

  • Add Directional light (ViroDirectionalLight)

  • Create 3 different materials with different lighting models and colors (ViroCreateMaterials)

  • Use ARPlaneSelector and Portal to create walkable portal

  • Create surface plane and add physics to these boxes

Step2 - Integrating Viro into existing React Native app

  • Install latest ViroMedia app from AppStore or PlayStore

  • Init react native with latest compatible release version from Viro docs

  • react-native init chainReactARWorkshop --version [email protected]
  • For this workshop we will be using osdnk/reanimated-bottom-sheet

    yarn add react-native-vector-icons
    yarn add react-navigation
    yarn add reanimated-bottom-sheet
    yarn add react-native-reanimated
    yarn add react-native-gesture-handler
    react-native link react-native-reanimated
    react-native link react-native-vector-icons
    react-native link react-native-gesture-handler
  • Take Map example from reanimated-bottom-sheet and convert it to look according to our requirements.

    • Our app should have two screens - Home screen and Shop screen
    • Shop screen should show a view with cart on the top right corner with notifications
    • It will have reanimated-bottom-sheet for our store navigation

Add Viro to existing app.

https://docs.viromedia.com/docs/integrating-with-react-native-projects

yarn add [email protected]

iOS

create Podfile under ios folder with:

platform :ios, '9.3'
target 'chainReactARWorkshop' do
  use_frameworks!
  pod 'ViroReact', :path => '../node_modules/react-viro/ios/'
  pod 'ViroKit', :path => '../node_modules/react-viro/ios/dist/ViroRenderer/'
end
cd ios
pod install
  • sign your app with valid AppleDeveloper account

  • change ios target in Xcode to 9.3

  • Fix GVRSDK error

  • Build

Android

https://docs.viromedia.com/docs/integrating-with-react-native-projects

Step 3 - add obj 3d models to your scene

  • Create 2 Viro3dObjects in your scene and add shadows, scaling, rotation and onpress interactions with them.
  • When pressing should present ViroText with more detailed data

Car:

type url
model

Sofa:

type url
model

Step 4 - Manual Anchoring and 3dobject instance management

  • Add functionality - when different model is picked (Reset ARPlaneSelector or use manual Anchoring)

Step 5 - Model GraphQL server

  • model database. There should be products, price, description, 3d model for every product and it's scale, resources etc.

Step 6 - Finalize our store

  • create a screen with list of products that are in cart
  • when clicking Buy, product will change it's state to in-cart

ar-workshop's People

Contributors

vnovick avatar

Watchers

James Cloos avatar

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.