Code Monkey home page Code Monkey logo

react-cardboard's Introduction

Intro

This project is a proof-of-concept, showing how to use Facebook's React to generate a VR experience that works with Google Cardboard.

Currently, it renders a panorama of Mars taken by NASA, in stereoscopic 3D.

Image Alt

There's also a demo letting you view the famous Utah teapot.

Demo

There are two demos:

  1. Panorama of mars, that you can look around by turning your head (in a Cardboard viewer): View Demo.
  2. The Utah teapot, which you can rotate by turning your head (in a Cardboard viewer): View Demo.

These will work in a desktop browser (tested in Chrome and Safari), but are best viewed in a Google Cardboard viewer (tested with iPhone 5s and Mattel View-Master).

Usage

First, you'll need to have npm installed. It comes with node. tsd is optional (but recommended) if you want type definitions for use in TypeScript; install it with npm install -g tsd if you don't already have it.

Live-rebuilding (development)

	npm install
	tsd install # Optional.
	node_modules/.bin/bower install
	node_modules/.bin/tsc
	node_modules/.bin/webpack-dev-server --content-base www/
	open http://localhost:8080/

To access the dev server from your phone, you may need to specify your computer's IP address in a --host parameter to webpack-dev-server.

Static building (deployment)

	npm install
	tsd install # Optional.
	node_modules/.bin/bower install
	node_modules/.bin/tsc
	node_modules/.bin/webpack
	# Files are in www/ directory.

References

Future Work

  1. Build a UI that lets you show a component in the normal flow of a webpage, but then activate it and jump into VR-mode. E.g. you're on an e-commerce website like Amazon, and you jump into a VR preview of a product. https://github.com/borismus/webvr-boilerplate does something like this, but I think we can do it in a cleaner way with React.
  2. Calibrate the rendering using Google Cardboard viewer QR codes.
  3. Expose a React component with a simple interface for rendering panoramas (like the one in the demo).
  4. Expose a React component with a simple interface for rendering a single object that you can orbit around (rather than pivoting the camera).

Contributions are welcome. Send a PR.

react-cardboard's People

Contributors

masonicboom avatar

Watchers

 avatar  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.