Académique Documents
Professionnel Documents
Culture Documents
https://medium.com/@devdevcharlie/how-to-create-augmented-reality-posters-with-unity-vuforia-ec80a82e6d51 1/24
21/10/2018 How to create Augmented Reality posters with Unity & Vuforia
Initial setup
—-
When you see the “Unity component selection” window, make sure to
tick the “Vuforia Augmented Reality” box to automatically install the
extension (previous versions of Unity require to install Vuforia
separately).
Select the “Vuforia Augmented Reality” option to install the extension automatically.
After installing, launch Unity, sign in or create a new account and click
on “New” to create a new project.
Change the default project name if you want but most importantly,
click on 3D and then click on “Create project”.
https://medium.com/@devdevcharlie/how-to-create-augmented-reality-posters-with-unity-vuforia-ec80a82e6d51 2/24
21/10/2018 How to create Augmented Reality posters with Unity & Vuforia
In the left panel (Hierarchy), delete the default “Main Camera” and
“Directional light” objects. To do so, right-click on each object and
select “delete”.
https://medium.com/@devdevcharlie/how-to-create-augmented-reality-posters-with-unity-vuforia-ec80a82e6d51 3/24
21/10/2018 How to create Augmented Reality posters with Unity & Vuforia
To test that our initial setup is working, let’s use some default Vuforia
assets.
In the middle panel, click on the “Asset store” tab and wait for the asset
store to load.
https://medium.com/@devdevcharlie/how-to-create-augmented-reality-posters-with-unity-vuforia-ec80a82e6d51 4/24
21/10/2018 How to create Augmented Reality posters with Unity & Vuforia
Once the assets are imported, let’s add an ARCamera to our project by
clicking on GameObject > Vuforia > AR Camera.
Towards the bottom of that section, you should see a button “Open
Vuforia Con guration” that is disabled by default. To enable it, go to
File > Build Settings and click on the “Player Settings” button.
Scroll down and in the XR Settings section, select the option “Vuforia
Augmented Reality Supported”. You can then close the Build Settings
https://medium.com/@devdevcharlie/how-to-create-augmented-reality-posters-with-unity-vuforia-ec80a82e6d51 5/24
21/10/2018 How to create Augmented Reality posters with Unity & Vuforia
To do so, after opening the Vuforia con guration panel, activate the
databases:
https://medium.com/@devdevcharlie/how-to-create-augmented-reality-posters-with-unity-vuforia-ec80a82e6d51 6/24
21/10/2018 How to create Augmented Reality posters with Unity & Vuforia
Now that the databases are activated, we are able to use the assets and
have them recognised and trackable.
https://medium.com/@devdevcharlie/how-to-create-augmented-reality-posters-with-unity-vuforia-ec80a82e6d51 7/24
21/10/2018 How to create Augmented Reality posters with Unity & Vuforia
You may have to zoom in a little bit inside your scene to see the image
but the result should look like this:
The default image comes from the Vuforia core samples we imported
earlier. It can be replaced later to use your custom image but for now,
we just want to check that our setup is working.
https://medium.com/@devdevcharlie/how-to-create-augmented-reality-posters-with-unity-vuforia-ec80a82e6d51 8/24
21/10/2018 How to create Augmented Reality posters with Unity & Vuforia
Click on the model target object in the left panel and update its scale in
the right panel. A scale X, Y and Z of 0.5 should work well.
At this stage, we should test that our setup is working properly before
starting to add our own assets. To launch our project, click on the play
button a the top of the window.
https://medium.com/@devdevcharlie/how-to-create-augmented-reality-posters-with-unity-vuforia-ec80a82e6d51 9/24
21/10/2018 How to create Augmented Reality posters with Unity & Vuforia
Once logged in, go to the “Develop” tab and get a development key.
Once you con rm, you will have access to a License key you will need to
use later in Unity.
https://medium.com/@devdevcharlie/how-to-create-augmented-reality-posters-with-unity-vuforia-ec80a82e6d51 10/24
21/10/2018 How to create Augmented Reality posters with Unity & Vuforia
Now, click on the “Target Manager” tab and click on “Add database” to
start uploading your own assets.
Once your database is created, click on “Add target” and select the type
of le your target is, as well as the path to nd it, width and how you’d
like to call it.
For the width, Vuforia uses meters as the default unit scale. As my
demo poster is an A4 sheet which is 21cm (0.21m) large, 0.21 should
be ne.
https://medium.com/@devdevcharlie/how-to-create-augmented-reality-posters-with-unity-vuforia-ec80a82e6d51 11/24
21/10/2018 How to create Augmented Reality posters with Unity & Vuforia
Once added, your Target Manager page should look something like
this:
https://medium.com/@devdevcharlie/how-to-create-augmented-reality-posters-with-unity-vuforia-ec80a82e6d51 12/24
21/10/2018 How to create Augmented Reality posters with Unity & Vuforia
Select the target you would like to download (the image we just
uploaded), and click on “Download Database”. This will download a
le we will need to import later in Unity.
Back to Unity, click on the ARCamera game object, open the Vuforia
con gutation and add the license key you just created.
To import the assets you just uploaded to Vuforia, go to Assets > Import
package > Custom package… and select the database le we just
downloaded.
A window will appear with the di erent les that are going to be
imported; just click “import”.
https://medium.com/@devdevcharlie/how-to-create-augmented-reality-posters-with-unity-vuforia-ec80a82e6d51 13/24
21/10/2018 How to create Augmented Reality posters with Unity & Vuforia
Once your assets are imported, click on the ARCamera again and in the
Vuforia con guration, you should see your database added to the list of
databases. Click on “load” and “activate” to be able to use the assets.
https://medium.com/@devdevcharlie/how-to-create-augmented-reality-posters-with-unity-vuforia-ec80a82e6d51 14/24
21/10/2018 How to create Augmented Reality posters with Unity & Vuforia
Then, click on the image target in the left panel, and, in the right panel,
change the database dropdown from “VuforiaMars_Image” to the name
of your custom database.
https://medium.com/@devdevcharlie/how-to-create-augmented-reality-posters-with-unity-vuforia-ec80a82e6d51 15/24
21/10/2018 How to create Augmented Reality posters with Unity & Vuforia
Selecting your custom database should have changed the target image
used in the “Scene” window.
https://medium.com/@devdevcharlie/how-to-create-augmented-reality-posters-with-unity-vuforia-ec80a82e6d51 16/24
21/10/2018 How to create Augmented Reality posters with Unity & Vuforia
The target image should have changed to your custom assets. (Image source).
If you click on the play button now, you should be able to show your
custom image target in front of your computer’s camera and see the 3D
object appear!
To change the 3D object displayed, drag and drop your 3d model in the
“Models” folder inside the “Project” tab at the bottom left of the Unity
window.
Then, drag that model inside the “Model target” folder in the hierarchy
panel. Your new model should appear in the scene window.
You will probably have to change the scale of your model and its
position to be placed over your image target, but in the end it should
look something like this:
When pressing play, you should be able to have your custom image
tracked and see the 3d model appear above it.
https://medium.com/@devdevcharlie/how-to-create-augmented-reality-posters-with-unity-vuforia-ec80a82e6d51 17/24
21/10/2018 How to create Augmented Reality posters with Unity & Vuforia
Now that we know our AR app is working ne with our laptop’s camera,
let’s test it on our mobile phones or tablet.
Once this is done, you need to setup the path to the SDK in Unity. Go to
Unity > Preferences and in the “External tools” tab, scroll down and
enter the path to the Android SDK. On Mac, it should be something
like: /Users/<your username>/Library/Android/sdk.
You might also need to install the JDK. To do so, visit this page and
download the JDK for your platform.
Once downloaded, you also need to enter the path in the Unity
preferences. For the JDK, it should be
/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/H
ome/.
https://medium.com/@devdevcharlie/how-to-create-augmented-reality-posters-with-unity-vuforia-ec80a82e6d51 18/24
21/10/2018 How to create Augmented Reality posters with Unity & Vuforia
Select Android and click on the “Player Settings” where you have to
double check that the “Vuforia Augmented Reality Supported”
option is checked.
https://medium.com/@devdevcharlie/how-to-create-augmented-reality-posters-with-unity-vuforia-ec80a82e6d51 19/24
21/10/2018 How to create Augmented Reality posters with Unity & Vuforia
After this, you can go back to the Build Settings window and click
“Build And Run”.
https://medium.com/@devdevcharlie/how-to-create-augmented-reality-posters-with-unity-vuforia-ec80a82e6d51 20/24
21/10/2018 How to create Augmented Reality posters with Unity & Vuforia
To build for iOS, you need to start by adding your AppleID to Xcode. To
do so, open XCode, from the menu bar at the top of the screen choose
Xcode > Preferences. Choose Accounts at the top of the window to
display information about the Apple IDs that have been added to
Xcode.
To add your Apple ID, click the plus sign at the bottom left corner and
choose Add Apple ID. Add in your username and password and you
should be good to go back to Unity.
https://medium.com/@devdevcharlie/how-to-create-augmented-reality-posters-with-unity-vuforia-ec80a82e6d51 21/24
21/10/2018 How to create Augmented Reality posters with Unity & Vuforia
Then, nd the “Target iOS minimum version” eld and change the
value to 9.0.
Make sure you scroll down to the XR Settings and activate “Vuforia
Augmented Reality”.
Once this is done, you should be able to click on “Build and run”. This
may launch XCode and you may be prompted to select a “team” and
change the name of the Bundle identi er.
On your iOS device, make sure to have your AppleID “trusted” in the
Settings.
https://medium.com/@devdevcharlie/how-to-create-augmented-reality-posters-with-unity-vuforia-ec80a82e6d51 22/24
21/10/2018 How to create Augmented Reality posters with Unity & Vuforia
That should be it! If you try to run the project again, it should build
successfully and launch on your iOS device!
Going further
—-
If you went through all these steps and you can test this basic app
successfully on your device, you’re all set! You can now upload your
own assets and build your own AR posters!
In this tutorial, we’ve only played with tracking images and displaying a
3D model over it but you can also tracking small 3D models and overlay
images, videos, etc..!
—-
Hopefully this was helpful and don’t hesitate to let me know if any of
those steps don’t work anymore or if anything doesn’t make sense!
https://medium.com/@devdevcharlie/how-to-create-augmented-reality-posters-with-unity-vuforia-ec80a82e6d51 23/24
21/10/2018 How to create Augmented Reality posters with Unity & Vuforia
https://medium.com/@devdevcharlie/how-to-create-augmented-reality-posters-with-unity-vuforia-ec80a82e6d51 24/24