README.md 14.2 KB
Newer Older
J
Jerome Etienne 已提交
1
# AR.js - Efficient Augmented Reality for the Web
J
Jerome Etienne 已提交
2

3
I am focusing hard on making AR for the web a reality.
P
Prayag Verma 已提交
4
This repository is where I publish the code.
J
Jerome Etienne 已提交
5
Contact me anytime [@jerome_etienne](https://twitter.com/jerome_etienne).
J
Jerome Etienne 已提交
6
Stuff are still moving fast, We reached a good status tho.
J
Jerome Etienne 已提交
7
An article has been published on [uploadvr](https://uploadvr.com/ar-js-efficient-augmented-reality-for-the-web/).
P
Prayag Verma 已提交
8
So I wanted to publish thus people can try it and have fun with it :)
J
Jerome Etienne 已提交
9

J
Jerome Etienne 已提交
10
- **Very Fast** : it runs efficiently even on phones. [60 fps on my 2 year-old phone](https://twitter.com/jerome_etienne/status/831333879810236421)!
J
Jerome Etienne 已提交
11
- **Web-based** : It is a pure web solution, so no installation required. Full javascript based on three.js + jsartoolkit5
J
Jerome Etienne 已提交
12
- **Open Source** : It is completely open source and free of charge!
J
Jerome Etienne 已提交
13
- **Standards** : It works on any phone with [webgl](http://caniuse.com/#feat=webgl) and [webrtc](http://caniuse.com/#feat=stream)
J
Jerome Etienne 已提交
14

J
Jerome Etienne 已提交
15
[![AR.js 1.0 Video](https://cloud.githubusercontent.com/assets/252962/23441016/ab6900ce-fe17-11e6-971b-24614fb8ac0e.png)](https://youtu.be/0MtvjFg7tik)
J
Jerome Etienne 已提交
16

J
Jerome Etienne 已提交
17

J
Jerome Etienne 已提交
18 19

If you wanna chat, check [![Gitter chat](https://badges.gitter.im/AR-js/Lobby.png)](https://gitter.im/AR-js/Lobby)
20

J
Jerome Etienne 已提交
21
# Try it on Mobile
J
Jerome Etienne 已提交
22

23 24
It works on all platforms. Android, IOS and window phone. It run **any browser with WebGL and WebRTC**.
(for IOS, you need to update to ios11)
J
Jerome Etienne 已提交
25 26

To try on your phone is only 2 easy steps, check it out!
J
Jerome Etienne 已提交
27

J
Jerome Etienne 已提交
28
1. Open this [hiro marker image](https://jeromeetienne.github.io/AR.js/data/images/HIRO.jpg) in your desktop browser.
29
1. Open this [augmented reality webapps](https://jeromeetienne.github.io/AR.js/three.js/examples/mobile-performance.html) in your phone browser, and point it
J
Jerome Etienne 已提交
30 31 32
to your screen.

**You are done!** It will open a webpage which read the phone webcam, localize a hiro marker and add 3d on top of it, as you can see below.
J
Jerome Etienne 已提交
33

34
![screenshot](https://cloud.githubusercontent.com/assets/252962/23072106/73a0656c-f528-11e6-9fcd-3c900d1d47d3.jpg)
J
Jerome Etienne 已提交
35

J
Jerome Etienne 已提交
36 37
# Standing on the Shoulders of Giants

38
So we shown it is now possible to do 60fps web-based augmented reality on a phone.
J
Jerome Etienne 已提交
39 40
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.
J
Jerome Etienne 已提交
41 42 43
So i would like to thanks :

- **three.js** for being a great library to do 3d on the web.
44
- **artoolkit**! years of development and experiences on doing augmented reality
J
Jerome Etienne 已提交
45
- **emscripten and asm.js**! thus we could compile artoolkit c into javascript
J
Jerome Etienne 已提交
46 47 48 49 50
- **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.

J
Jerome Etienne 已提交
51
After all this work done by a lot of people, we have a *web-based augmented reality solution fast enough for mobile*!
J
Jerome Etienne 已提交
52

J
Jerome Etienne 已提交
53
Now, many people got a phone powerful enough to do web AR in their pocket.
J
Jerome Etienne 已提交
54
I think this performance improvement makes web AR a reality.
J
Jerome Etienne 已提交
55 56
i am all exited by what people are gonna with it :)

J
Jerome Etienne 已提交
57
# Performance
J
Jerome Etienne 已提交
58

J
Jerome Etienne 已提交
59
We are still early in the project but here are some initial numbers to give you an idea.
J
Jerome Etienne 已提交
60 61 62 63

- I got 60fps stable on nexus6p
- Some reports [Sony Xperia Z2 (2.5 years old) runs around 50fps](https://twitter.com/leinadkalpot/status/834121238087925763) - this is a 170euro phone
- Some reports [~50fps on a old nexus5, and ~60fps on nexus 9](https://twitter.com/Ellyll/status/834312442926751744) - nexus5 is 3.5 years old!
J
Jerome Etienne 已提交
64
- Some reports it working on windows phone edge!! [13fps on Lumia 950](https://twitter.com/leinadkalpot/status/834299384510763012) for some.
J
Jerome Etienne 已提交
65
  [40-45fps on lumia 930](https://twitter.com/fastclemmy/status/834817155665391616) for others.
J
Jerome Etienne 已提交
66 67 68

Obviously you mileage may vary. The performance you get will depend on 3 things: How heavy your 3D is, How you tune your parameters
and the hardware that you are using.
J
Jerome Etienne 已提交
69

J
Jerome Etienne 已提交
70 71
![screenshot](https://cloud.githubusercontent.com/assets/252962/23068128/40343608-f51a-11e6-8cb3-900e37a7f658.jpg)

J
Jerome Etienne 已提交
72
# Full Featured Marker based
73
With this project, we bring more performance to artoolkit.
J
Jerome Etienne 已提交
74 75 76
artoolkit is a software with years of experience doing augmented reality. It is able to do a lot!

It is marker based. It supports a wide range of markers: multiple types of markers [pattern](https://artoolkit.org/documentation/doku.php?id=3_Marker_Training:marker_training)/[barcode](https://artoolkit.org/documentation/doku.php?id=3_Marker_Training:marker_barcode)
J
Jerome Etienne 已提交
77
multiple independent markers at the same time, or [multiple markers acting as a single marker](https://artoolkit.org/documentation/doku.php?id=3_Marker_Training:marker_multi)
J
Jerome Etienne 已提交
78 79
up to you to choose.

J
Jerome Etienne 已提交
80 81 82 83 84 85 86 87 88 89 90
# What’s New?
Recently, we’ve been getting creative and working on developing new things with AR.js. One of them is playing around with [shadows](https://twitter.com/jerome_etienne/status/837240034847764480), syncing the position of virtual lights with reality for a more life-like finish:
![screen shot 2017-03-16 at 21 06 24](https://cloud.githubusercontent.com/assets/6317076/24018623/7f787ba8-0a8c-11e7-8088-fea4799b5d09.png)

We’ve been collaborating very closely with [Fredrick Blomqvist](https://twitter.com/snigelpaogat). His input has had a great impact on AR.js innovation and we want to thank him. Together, we’ve been implementing [refraction](https://twitter.com/jerome_etienne/status/838749280999518208), giving the 3d a transparent/glassy effect. It ended up having a nice polished look. What do you guys think?
![screen shot 2017-03-06 at 16 31 28](https://cloud.githubusercontent.com/assets/6317076/23832948/9b64c79e-0736-11e7-9cb8-747f6a8fc082.png)

Other crazy ideas we’ve been working on include a [hole in the wall](https://twitter.com/jerome_etienne/status/836754117964017664) and a [portal into another world](https://twitter.com/jerome_etienne/status/838404908235776000). We want to take AR.js to new dimensions.
![screen shot 2017-03-12 at 15 19 51](https://cloud.githubusercontent.com/assets/6317076/23833024/b2e045be-0737-11e7-9ef0-8e1ac9e49ba8.png)
![screen shot 2017-03-07 at 10 08 39](https://cloud.githubusercontent.com/assets/6317076/23833015/947f6abe-0737-11e7-9a0d-1ea919f6ffbe.png)

J
Jerome Etienne 已提交
91 92 93 94
# principles
- "Shared #ar is a lot more real than solo #AR." - Augmented reality principle [tweet](https://twitter.com/jerome_etienne/status/847889867296124933)
- "The marker must be a portal from where the virtual emerges." by @AndraConnect - #AR principles at dinner 😏 [tweet](https://twitter.com/jerome_etienne/status/842112692211056640)

J
Jerome Etienne 已提交
95 96
# Status
- At the three.js level is the main one. It is working well and efficiently
J
Jerome Etienne 已提交
97
- a-frame component - it export ```<a-marker>``` tag. It becomes real easy to use.
98
  It allows the things three.js extension does. Here are some slides
J
Jerome Etienne 已提交
99
  [aframe-artoolkit](http://jeromeetienne.github.io/slides/artoolkit-aframe/)
J
Jerome Etienne 已提交
100
- webvr-polyfill: it is kind of working - still a work-in-progress
J
Jerome Etienne 已提交
101

J
Jerome Etienne 已提交
102 103
# Augmented reality for the web in less than 10 lines of html

J
Jerome Etienne 已提交
104 105 106 107
A-Frame magic :) All details are explained in this super post
["Augmented Reality in 10 Lines of HTML - AR.js with a-frame magic"](https://medium.com/arjs/augmented-reality-in-10-lines-of-html-4e193ea9fdbf)
by
[@AndraConnect](https://twitter.com/AndraConnect).
J
Jerome Etienne 已提交
108 109

```html
G
Gabriel Grant 已提交
110 111 112 113 114 115 116 117 118 119 120 121 122
<!doctype HTML>
<html>
<script src="https://aframe.io/releases/0.6.1/aframe.min.js"></script>
<script src="https://cdn.rawgit.com/jeromeetienne/AR.js/1.5.0/aframe/build/aframe-ar.js"> </script>
  <body style='margin : 0px; overflow: hidden;'>
    <a-scene embedded arjs>
  	<a-marker preset="hiro">
            <a-box position='0 0.5 0' material='color: black;'></a-box>
  	</a-marker>
  	<a-entity camera></a-entity>
    </a-scene>
  </body>
</html>
J
Jerome Etienne 已提交
123 124
```

M
Mark Lee 已提交
125
See on [codepen](https://codepen.io/jeromeetienne/pen/mRqqzb) or [bl.ocks.org](https://bl.ocks.org/jeromeetienne/feeb69257803e69f18dc3ea5f4fc6d71)
J
Jerome Etienne 已提交
126

J
Jerome Etienne 已提交
127 128 129 130
# Posts on medium
We started a [AR.js blog](https://medium.com/arjs), thus we can write about
all the crazy ideas related to AR.js.

J
Jerome Etienne 已提交
131
- ["Area Learning with Multi-Markers in AR.js - For a Larger & More Stable Augmented Reality"](https://medium.com/arjs/area-learning-with-multi-markers-in-ar-js-1ff03a2f9fbe)
J
Jerome Etienne 已提交
132
  by [@AndraConnect](https://twitter.com/AndraConnect)
J
Jerome Etienne 已提交
133 134
- ["WebVR for Augmented Reality - Using WebVR to write cross-platform AR applications"](https://medium.com/arjs/webvr-for-augmented-reality-f1e69a505902)
  by [@jerome_etienne](https://twitter.com/jerome_etienne)
J
Jerome Etienne 已提交
135
- ["Augmenting The Web Page - Bringing augmenting reality to normal web pages"](https://medium.com/arjs/augmenting-the-web-page-e893f2d199b8)
J
Jerome Etienne 已提交
136
  by [@jerome_etienne](https://twitter.com/jerome_etienne)
J
Jerome Etienne 已提交
137 138 139 140 141 142 143
- ["Server Rendering for Augmented Reality - Cloud Rendering with Web Standards"](https://medium.com/arjs/server-rendering-for-augmented-reality-2de0a71aae04)
  by [@jerome_etienne](https://twitter.com/jerome_etienne)
- ["AR-Code:a Fast Path to Augmented Reality - From qrcode to AR.js content"](https://medium.com/arjs/ar-code-a-fast-path-to-augmented-reality-60e51be3cbdf)
  by [@jerome_etienne](https://twitter.com/jerome_etienne)
- ["Augmented Reality in 10 Lines of HTML - AR.js with a-frame magic"](https://medium.com/arjs/augmented-reality-in-10-lines-of-html-4e193ea9fdbf)
  by [@AndraConnect](https://twitter.com/AndraConnect)

144
# Great Posts by Users
J
Jerome Etienne 已提交
145 146 147

- How to write a AR.js application ?
Here is a [full tutorial](https://marmelab.com/blog/2017/06/19/augmented-reality-html5.html)
148 149 150
by [marmelab](https://marmelab.com/) featuring [François Zaninotto](https://twitter.com/francoisz).
It explain how to code a full application on phone! Step by Steps, with explaination and videos. 
Very great! the perfect step if you want to start writing AR application today.
J
Jerome Etienne 已提交
151 152
- Great post about [WebAR for designer](http://www.nexusinteractivearts.com/webar/)
by [nexus interactive arts](http://www.nexusinteractivearts.com/)
153

154
# Augmented Website
J
Jerome Etienne 已提交
155
[Seminal post](https://medium.com/arjs/augmenting-the-web-page-e893f2d199b8) explaining the concept.
J
Jerome Etienne 已提交
156
The service is available [webxr.io/augmented-website](https://webxr.io/augmented-website/)
J
Jerome Etienne 已提交
157

J
Jerome Etienne 已提交
158
[![Augmented Website](https://user-images.githubusercontent.com/252962/27472386-0d11e59a-57f3-11e7-9fa5-34332c5484f7.png)](https://webxr.io/augmented-website/)
J
Jerome Etienne 已提交
159

160

J
Jerome Etienne 已提交
161 162
# Examples

J
Jerome Etienne 已提交
163 164
Some applications:

J
mor wok  
Jerome Etienne 已提交
165
- [Pattern Marker Training](https://jeromeetienne.github.io/AR.js/three.js/examples/marker-training/examples/generator.html) :
J
Jerome Etienne 已提交
166
  Generate a [pattern marker](https://artoolkit.org/documentation/doku.php?id=3_Marker_Training:marker_training) with your own image.
J
Jerome Etienne 已提交
167 168
- [ARCode Generator](https://jeromeetienne.github.io/AR.js/three.js/examples/arcode.html) :
  Generator of AR-Code
J
Jerome Etienne 已提交
169 170 171 172
  ([source](https://github.com/jeromeetienne/AR.js/blob/master/three.js/examples/arcode.html))
- [WebAR Playground](https://jeromeetienne.github.io/webar-playground/) :
  Playground running in WebAR with ar.js/chromiumAR

173
[ALL EXAMPLES](https://jeromeetienne.github.io/AR.js-docs/misc/EXAMPLES.html)
J
Jerome Etienne 已提交
174

J
Jerome Etienne 已提交
175 176 177
# Folders
- ```/three.js``` is the extension to use it with [pure three.js](https://threejs.org)
- ```/aframe``` is the extension to use it with [a-frame](https://aframe.io)
178
- ```/webvr-polyfill``` is the WebVR polyfill so you can reuse your #AR / #VR content easily
J
Jerome Etienne 已提交
179

J
Jerome Etienne 已提交
180 181
# Licenses
It is **all open source** ! jsartoolkit5 is under LGPLv3 license and additional permission.
182
And All my code in AR.js repository is under MIT license. :)
J
Jerome Etienne 已提交
183 184

For legal details, be sure to check [jsartoolkit5 license](https://github.com/artoolkit/jsartoolkit5/blob/master/LICENSE.txt)
185
and [AR.js license](https://github.com/jeromeetienne/AR.js/blob/master/LICENSE.txt).
J
Jerome Etienne 已提交
186

J
Jerome Etienne 已提交
187
# Change Log
188
[CHANGELOG.md](https://github.com/jeromeetienne/AR.js/blob/master/CHANGELOG.md)
189

J
Jerome Etienne 已提交
190 191 192
# What's Next ?

We did good on performance, but there are still a lot of room for optimisation.
193 194
Using [webworkers](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Using_web_workers)
would increase cpu usage. Compiling in [webassembly](https://webassembly.org) instead
J
Jerome Etienne 已提交
195 196 197 198 199
of [asm.js](http://asmjs.org/) should improve loading time and likely cpu performance.
And obviously, we can still do more parameters tweaking :)


I would like people start experience augmented reality and play with it.
200
This is highly creative! Just look at this [puzzle game in #AR playing with mirror and laser beam](https://www.youtube.com/watch?v=OzLJb7HitvA).
J
Jerome Etienne 已提交
201 202 203 204 205 206
You could do it with AR.js, so opensource and running on normal phones, no need to buy a new device. isn't that great!


Augmented reality on phone have applications in many fields:
[history education](https://www.youtube.com/watch?v=gyp8ZYtyu_M)
, [science](https://www.youtube.com/watch?v=gMxdBdLpVgc)
J
Jerome Etienne 已提交
207
or [gaming](https://www.youtube.com/watch?v=kEMDgvfFUcI).
J
Jerome Etienne 已提交
208 209 210
I exited to see what people will do with AR.js :)


211 212 213 214 215 216 217 218 219 220 221
# Browser Support
Demo tested on the following browser setups:
- **Desktop Chrome with webcam and 2 tabs** (one for Hero, one for result) (works!)
- **Android native 4.4.2** (doesn't work, doesn't ask for permission to use camera. I see white background and text)
- **Android native 5.0** (doesn't work, doesn't ask for permission, I see white background and text)
- **Chrome on Android 4.4.2** (works!)
- **Chrome on Android 5.0** (doesn't work, asks for permission, I see black background, text and a chart)
- **Safari and Chrome on iOS 8.2 (iPad)** (doesn't work, doesn't ask for permission, I see white background and text)
- **Microsoft Edge on Windows 10** (Chrome on Google Pixel phone to view hologram)

Credits: @HelloDeadline, @sorianog
J
Jerome Etienne 已提交
222

223

J
Jerome Etienne 已提交
224
# Future
225

226
[FUTURE.md](https://jeromeetienne.github.io/AR.js-docs/misc/FUTURE.html)
227

J
Jerome Etienne 已提交
228
# FAQ
J
Jerome Etienne 已提交
229

J
Jerome Etienne 已提交
230
[FAQ.md](https://jeromeetienne.github.io/AR.js-docs/misc/FAQ.html)
J
Jerome Etienne 已提交
231 232 233 234 235 236 237 238



# How To Release ?

This one is mainly for [me](@jerome_etienne) to remember :)

```bash
J
Jerome Etienne 已提交
239 240 241 242
# Update CHANGELOG.md - remove the -dev into version
atom CHANGELOG.md

# replace REVISION to the proper version, search/replace on the version string should do it
J
Jerome Etienne 已提交
243
atom three.js/src/threex/threex-artoolkitcontext.js package.json README.md
J
Jerome Etienne 已提交
244

J
Jerome Etienne 已提交
245 246

# Rebuild and minify everything - aka a-frame and three.js
J
Jerome Etienne 已提交
247
make minify
J
Jerome Etienne 已提交
248 249 250 251

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

J
Jerome Etienne 已提交
252 253 254
# Go to master branch
git checkout master

J
Jerome Etienne 已提交
255 256 257
# Merge dev branch into master branch
git merge dev

J
Jerome Etienne 已提交
258
# tag the release
J
Jerome Etienne 已提交
259
git tag 1.5.1
J
Jerome Etienne 已提交
260 261 262 263

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

J
Jerome Etienne 已提交
264 265 266
# push commits tag on github
git push

J
Jerome Etienne 已提交
267 268 269
# update npm package.json
npm publish

J
Jerome Etienne 已提交
270 271 272
# Come back to dev branch
git checkout dev

J
Jerome Etienne 已提交
273 274 275 276
# Update CHANGELOG.md - start new dev version
atom CHANGELOG.md

# update the a-frame codepen if needed
J
Jerome Etienne 已提交
277 278
open "https://codepen.io/jeromeetienne/pen/mRqqzb?editors=1000#0"
```