Display 3d model on image target using vuforia in unity3d
Augmented Reality is used to augment virtual objects in real world. For augmented reality we will use vuforia in unity 3D. In this blog we are going to learn about displaying 3D model on image target using vuforia in unity 3D
Create a new unity project:
Creating a new unity project requires some of the things to be done. For creating a new unity project write project name and then click on create project.
Now we have to set scene for augmented reality. For that you have to delete main camera and add AR camera and image. As you can see this warning sign, go to build settings then go to player settings. Go to the bottom click on XR settings and check the vuforia augmented reality.
For better understanding you may like to watch video tutorial on this topic in that case you can watch our YouTube video.
Open vuforia developer portal:
For opening vuforia developer portal make sure that you are sign in. Click on develop, then click on get development key. Name it as you want, now check the box bellow and click on confirm. Click on the file which you have named earlier. Copy on license by simple clicking on it.
After copying license key you need to go back to unity. Go to AR camera, open vuforia configuration. Paste the license key there. Click on target manager. Click on add database, select the type and name the database. After that click on create. Click on the file which you have named earlier.
Click on add target after that click on Browse and select image target on which you want to augment 3d model. Add width of your choice and write the augmented reality image name. We do not need to upload metadata so skip that and confirm.
Downloading and importing the database in unity:
Before downloading make sure that the status is active against upload image target, if not then you have to refresh button below. After clicking on download button select unity editor as augmented reality then click on download. To import drag the database into assets folder of unity. Make sure all the items are selected and click on import. Go to image target and select your database. Now you can see your image has loaded.
Place 3dmodel on image target
Drag the model with texture files into unity. After that drag and adjust 3dmodel on top of image target according to your choice. Set model position, scale and rotation to display it properly in augmented reality.
From top menu click on file, then click on build settings. Check the platform is android if not switch it. And then click on add open scenes. Now click on player settings. Go to other settings. Change the package name according to your choice. Unchecked x86 and Android TV compatibility. Change the stripping level to low. Click on XR settings and make sure vuforia augmented reality is selected. And then you can insert the icon of your app. That’s all for settings now connect your android mobile with your computer and click on build and run. Now name it and save it.
That’s all. Enjoy augmented reality by scanning the image target.
To learn about how to place an image on an image target. Go to this link.