All Projects → expo → Expo Three Ar

expo / Expo Three Ar

Utilities for using Expo AR with THREE.js

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to Expo Three Ar

Expo Chroma Key Camera
Live green-screen effect with Expo and THREE.js
Stars: ✭ 28 (-30%)
Mutual labels:  expo, arkit
ios logger
Application for camera and sensor data logging (iOS)
Stars: ✭ 60 (+50%)
Mutual labels:  camera, arkit
Expo Three Demo
🍎👩‍🏫 Collection of Demos for THREE.js in Expo!
Stars: ✭ 76 (+90%)
Mutual labels:  expo, arkit
Firebase Instagram
📸 Instagram clone with Firebase Cloud Firestore, Expo, and React Native 😁😍
Stars: ✭ 389 (+872.5%)
Mutual labels:  camera, expo
Nextlevel
NextLevel was initally a weekend project that has now grown into a open community of camera platform enthusists. The software provides foundational components for managing media recording, camera interface customization, gestural interaction customization, and image streaming on iOS. The same capabilities can also be found in apps such as Snapchat, Instagram, and Vine.
Stars: ✭ 1,940 (+4750%)
Mutual labels:  camera, arkit
Expo Three
Utilities for using THREE.js on Expo
Stars: ✭ 432 (+980%)
Mutual labels:  expo, arkit
Qr Code Scanner
Full stable QR code scanner android app.
Stars: ✭ 28 (-30%)
Mutual labels:  camera
Cordova Plugin Ios Camera Permissions
Cordova / PhoneGap Plugin Permission Settings for NSCameraUsageDescription and NSPhotoLibraryUsageDescription in iOS 11 by adding a declaration to the Info.plist file, see:
Stars: ✭ 34 (-15%)
Mutual labels:  camera
Cdpvideorecord
An video camera,you can have realtime of a beautify,and change camera position,or turn on/off flash.Details see demo.
Stars: ✭ 27 (-32.5%)
Mutual labels:  camera
Spiderpig
Diving into ARKit internals.
Stars: ✭ 21 (-47.5%)
Mutual labels:  arkit
Pi Webcam
Automation to configure a Raspberry Pi as a USB OTG webcam
Stars: ✭ 990 (+2375%)
Mutual labels:  camera
Instabyte
Clone of Instagram made with React Native
Stars: ✭ 36 (-10%)
Mutual labels:  expo
Arkitbusinesscard
A Basic Example Creating An Interactive Business Card In ARKit2.
Stars: ✭ 33 (-17.5%)
Mutual labels:  arkit
Partfolio
Rosberry Portfolio app made with Apple ARKit
Stars: ✭ 29 (-27.5%)
Mutual labels:  arkit
Scenekit Bezier Animations
Create animations over Bezier curves of any number of points
Stars: ✭ 35 (-12.5%)
Mutual labels:  arkit
Camera calibration api
A simple Python API for single camera calibration using opencv
Stars: ✭ 36 (-10%)
Mutual labels:  camera
Picamera
Capture the stream of Images for a Raspberry Pi Camera in GoLang
Stars: ✭ 21 (-47.5%)
Mutual labels:  camera
Arpointcloud
A Basic Example Of Visualising Point Clouds In ARKit
Stars: ✭ 31 (-22.5%)
Mutual labels:  arkit
Meething Ml Camera
Machine-Learning powered Virtual Camera with SVG Animation (alpha)
Stars: ✭ 36 (-10%)
Mutual labels:  camera
React Native Helpers
All helpers in one; iPhone series support, dimensions helper, hasNotch helper, normalize text helper and text helpers for React Native with very easy useEasy to use & awesome helpers for React Native.
Stars: ✭ 31 (-22.5%)
Mutual labels:  expo

NPM

expo-three-ar

Tools for using three.js to build native AR experiences with Expo. This library is iOS only.

This library is a side-project and should not be considered production ready

Installation

yarn add three expo-three-ar

Usage

Import the library into your JavaScript file:

import * as ThreeAR from 'expo-three-ar';

Enabling AR

  • expo-gl: call AR.startAsync(gl) after GLView.onContextCreate has been called.
  • expo-graphics: you need to add the isArEnabled={true} prop

API

new BackgroundTexture(renderer: WebGLRenderingContext)

extends a THREE.Texture that reflects the live video feed of the AR session. Usually this is set as the .background property of a THREE.Scene to render the video feed behind the scene's objects.

// viewport width/height & zNear/zFar
scene.background = new BackgroundTexture(renderer);

new Camera(width: number, height: number, zNear: number, zFar: number)

extends a THREE.PerspectiveCamera that automatically updates its view and projection matrices to reflect the AR session camera. width, height specify the dimensions of the target viewport to render to and near, far specify the near and far clipping distances respectively. The THREE.PerspectiveCamera returned has its updateMatrixWorld and updateProjectionMatrix methods overriden to update to the AR session's state automatically. THREE.PerspectiveCamera that updates it's transform based on the device's orientation.

// viewport width/height & zNear/zFar
const camera = new Camera(width, height, 0.01, 1000);

new Light()

THREE.PointLight that will update it's color and intensity based on ARKit's assumption of the room lighting.

renderer.physicallyCorrectLights = true;
renderer.toneMapping = THREE.ReinhardToneMapping;

const arPointLight = new Light();
arPointLight.position.y = 2;
scene.add(arPointLight);

// You should also add a Directional for shadows
const shadowLight = new THREE.DirectionalLight();
scene.add(shadowLight);
// If you would like to move the light (you would) then you will need to add the lights `target` to the scene.
// The shadowLight.position adjusts one side of the light vector, and the target.position represents the other.
scene.add(shadowLight.target);

...
// Call this every frame:
arPointLight.update()

new MagneticObject()

A THREE.Mesh that sticks to surfaces. Use this as a parent to models that you want to attach to surfaces.

const magneticObject = new MagneticObject();
magneticObject.maintainScale = false; // This will scale the mesh up/down to preserve it's size regardless of distance.
magneticObject.maintainRotation = true; // When true the mesh will orient itself to face the camera.

// screenCenter is a normalized value = { 0.5, 0.5 }
const screenCenter = new THREE.Vector2(0.5, 0.5);
...

// Call this every frame to update the position.
magneticObject.update(camera, screenCenter);

new ShadowFloor()

A transparent plane that extends THREE.Mesh and receives shadows from other meshes. This is used to render shadows on real world surfaces.

renderer.gammaInput = true;
renderer.gammaOutput = true;
renderer.shadowMap.enabled = true;
const shadowFloor = new ShadowFloor({
  width: 1,
  height: 1,
  opacity: 0.6,
}); // The opacity of the shadow

new Points()

A utility object that renders all the raw feature points.

const points = new Points();
// Then call this each frame...
points.update();

new Planes()

A utility object that renders all the ARPlaneAnchors

const planes = new Planes();
// Then call this each frame...
planes.update();

AR Functions

Three.js calculation utilites for working in ARKit. Most of these functions are used for calculating the surfaces. You should see if MagneticObject() has what you need before digging into these. You can also check out this example provided by Apple

hitTestWithFeatures(camera: THREE.Camera, point: THREE.Vector2, coneOpeningAngleInDegrees: number, minDistance: number, maxDistance: number, rawFeaturePoints: Array)

Props

  • camera: THREE.Camera
  • point: THREE.Vector2
  • coneOpeningAngleInDegrees: number
  • minDistance: number
  • maxDistance: number
  • rawFeaturePoints: Array<any>

hitTestWithPoint(camera: THREE.Camera, point: THREE.Vector2)

Props

  • camera: THREE.Camera
  • point: THREE.Vector2

unprojectPoint(camera: THREE.Camera, point: THREE.Vector2)

Props

  • camera: THREE.Camera
  • point: THREE.Vector2

hitTestRayFromScreenPos(camera: THREE.Camera, point: THREE.Vector2)

Props

  • camera: THREE.Camera
  • point: THREE.Vector2

hitTestFromOrigin(origin: THREE.Vector3, direction: THREE.Vector3, rawFeaturePoints: ?Array)

Props

  • origin: THREE.Vector3
  • direction: THREE.Vector3
  • rawFeaturePoints: ?Array<any>

hitTestWithInfiniteHorizontalPlane(camera: THREE.Camera, point: Point, pointOnPlane: THREE.Vector3)

Props

  • camera: THREE.Camera
  • point: THREE.Vector2
  • pointOnPlane: THREE.Vector3

rayIntersectionWithHorizontalPlane(rayOrigin: THREE.Vector3, direction: THREE.Vector3, planeY: number)

Props

  • rayOrigin: THREE.Vector3
  • direction: THREE.Vector3
  • planeY: number

convertTransformArray(transform: Array): THREE.Matrix4

Props

  • transform: number[]

positionFromTransform(transform: THREE.Matrix4): THREE.Vector3

Props

  • transform: THREE.Matrix4

worldPositionFromScreenPosition(camera: THREE.Camera, position: THREE.Vector2, objectPos: THREE.Vector3, infinitePlane = false, dragOnInfinitePlanesEnabled = false, rawFeaturePoints = null): { worldPosition: THREE.Vector3, planeAnchor: ARPlaneAnchor, hitAPlane: boolean }

Props

  • camera: THREE.Camera
  • position: THREE.Vector2
  • objectPos: THREE.Vector3
  • infinitePlane: boolean = false
  • dragOnInfinitePlanesEnabled: boolean = false
  • rawFeaturePoints: any = null

positionFromAnchor(anchor: ARAnchor): THREE.Vector3

Props

  • anchor: { worldTransform: Matrix4 }

improviseHitTest(point, camera: THREE.Camera): ?THREE.Vector3

Props

  • point: THREE.Vector2
  • camera: THREE.Camera
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].