Skip to content

HeliosInteractive/AR.js

 
 

Repository files navigation

AR.js - Efficient Augmented Reality for the Web

This project provides all the tools needed to easily test and implement multiple types of web based AR/VR projects.

Be advised that content is changing rapidly.

  • Very Fast : Runs efficiently on most devices. See Performance data. (https://twitter.com/jerome_etienne/status/831333879810236421)!
  • Web-based Standards : Works with any browser with WebGL and WebRTC no installation or app required.
  • Multi-platform : Android, IOS (Must be IOS 11), Windows phone, Windows, OSX
  • Open Source : It is completely open source and free of charge!

AR.js 1.0 Video

If you wanna chat, check Gitter chat

Marker Based AR/VR

While AR.js is experimenting with other tracking methods, the core feature AR.js offers is marker-based tracking, made possible via an asm.js port of ARToolKit5.

Learn more about marker types, limitations, and marker training at ARToolKit's documentation site.

Project Status

Try out AR in your browser now with your desktop and mobile device!

  1. Open this HIRO marker image in your desktop browser.

  2. Open this link Augmented Reality Viewer - Example in your phone browser, and point it to your screen.

Ready to go?! Use your mobile device to view the HIRO marker image on your mobile device to reveal the example Augmented Reality.

screenshot

Project Tools and Examples

ALL EXAMPLES - MANY OLD LINKS

A-Frame example

Detailed walkthrough at "Augmented Reality in 10 Lines of HTML - AR.js with a-frame magic" by @AndraConnect.

<script src="https://aframe.io/releases/0.5.0/aframe.min.js"></script>
<script src="https://jeromeetienne.github.io/AR.js/aframe/build/aframe-ar.js"></script>
<body style='margin : 0px; overflow: hidden;'>
	<a-scene embedded artoolkit='sourceType: webcam;'>
		<a-box position='0 0 0.5' material='opacity: 0.5;'></a-box>
		<a-marker-camera preset='hiro'></a-marker-camera>
	</a-scene>
</body>

See the result on codepen

Browser Support

Any browser that supports WebGL and getUserMedia/Stream API can run AR.js.

See caniuse.com for up-to-date browser support metrics: WebGL, getUserMedia

Desktop Browsers

  • Chrome
  • Firefox

Mobile Browsers

  • Chrome on Android
  • Safari on iOS 11

Common Causes for Failure

If the browser you are using should be able to run AR.js, but doesn't, there are several potential causes.

Unable to access camera via getUserMedia

  • The webpage is served through http instead of https, which doesn't allow user media access.
  • The webpage is opened inside another app through a webview, which doesn't support getUserMedia.
    • In this situation, try opening the same url in mobile Chrome/Safari.
  • The webpage couldn't detect the device's camera.
  • The device does not have a camera.

Unable to create WebGL context

  • The browser doesn't support WebGL.
  • WebGL is blocked for the device's graphics driver version.

Performance

There are three determining factors for performance:

  1. How large is your 3D/AR?
  2. How you tune your parameters? More info soon
  3. Hardware!

We hope to have additional benchmarking results soon.

Researches, Resources, and Recommended Readings

Experimentation

Recently, we’ve been getting creative and working on developing new things with AR.js. One of them is playing around with shadows, syncing the position of virtual lights with reality for a more life-like finish: screen shot 2017-03-16 at 21 06 24

We’ve been collaborating very closely with Fredrick Blomqvist. His input has had a great impact on AR.js innovation and we want to thank him. Together, we’ve been implementing refraction, giving the 3d a transparent/glassy effect. It ended up having a nice polished look. screen shot 2017-03-06 at 16 31 28

Other crazy ideas we’ve been working on include a hole in the wall and a portal into another world. We want to take AR.js to new dimensions. screen shot 2017-03-12 at 15 19 51 screen shot 2017-03-07 at 10 08 39

Augmented Website

Seminal post explaining the concept. The service is available webxr.io/augmented-website

Augmented Website

AR.js blog

The project started a AR.js blog to keep everyone up to date. Please check there for the newest content.

Additional Recommended Reading

Standing on the Shoulders of Giants - Acknowledgements

It is now possible to do 60fps web-based augmented reality on a phone. This is great for sure but how did we get here ? By standing on the shoulders of giants! It is thanks to the hard work from others, that we can today reach this mythic 60fps AR.

Please thank and contribute to these teams:

  • three.js for being a great library to do 3d on the web.
  • artoolkit! years of development and experiences on doing augmented reality
  • emscripten and asm.js! thus we could compile artoolkit c into javascript
  • chromium! thanks for being so fast!

"Only thanks to all of them, I could do my part : Optimizing performance from 5fps on high-end phone, to 60fps on 2years old phone. After all this work done by a lot of people, we have a web-based augmented reality solution fast enough for mobile! Now, many people got a phone powerful enough to do web AR in their pocket. I think this performance improvement makes web AR a reality and I am all exited by what people are going to do with it :)" - Jerome Etienne

"Shared #ar is a lot more real than solo #AR." - Augmented reality principle tweet

"The marker must be a portal from where the virtual emerges." by @AndraConnect - #AR principles at dinner 😏 tweet

Licenses

jsartoolkit5 is under LGPLv3 license and additional permission. Other code in AR.js repository is under MIT license.

For legal details, be sure to check jsartoolkit5 license and AR.js license.

Change Log

CHANGELOG.md

What's Next ?

We did good on performance, but there are still a lot of room for optimisation. Using webworkers would increase cpu usage. Compiling in webassembly instead of asm.js should improve loading time and likely cpu performance. And obviously, we can still do more parameters tweaking :)

Future

FUTURE.md

FAQ

FAQ.md

How To Release ?

# replace REVISION to the proper version
atom three.js/src/threex/threex-artoolkitcontext.js package.json README.md

# Rebuild a-frame and webvr-polyfill
make minify

# Commit everything
git add . && git commit -a -m 'Last commit before release'

# Go to master branch
git checkout master

# Merge dev branch into master branch
git merge dev

# tag the release
git tag 1.5.1

# push the tag on github
git push origin --tags

# push commits tag on github
git push

# update npm package.json
npm publish

# Come back to dev branch
git checkout dev

# update the a-frame codepen
open "https://codepen.io/jeromeetienne/pen/mRqqzb?editors=1000#0"

About

a fork of jeromeetienne/AR.js that has better automation, cleaner code, and less marketing slogans.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 82.0%
  • HTML 15.9%
  • Makefile 0.5%
  • Brainfuck 0.4%
  • C 0.4%
  • Forth 0.4%
  • Other 0.4%