In this tutorial, we will see how to make an AR coloring app using unity 2018.2.1f1, Vuforia 7.5.26 and Region Capture 2.0.9. we will also use an image as a texture for a 3D model.
AR Coloring App Using Unity and Vuforia:
Setting Region Capture and Vuforia:
First, open a unity project and then go to Edit -> Project Settings -> Tags & Layers.
Then at user layer 20 add “Region_Capture”.
Now switch platform to android by File -> Build Settings.
in the next screen, select Android and switch platform.
Now select player setting and in XR settings select Vuforia.
Now delete the main camera from your scene and add AR camera by right clicking in the hierarchy and Vufoira-> AR Camera.
After deleting the main camera, search for Vuforia Configuration in the project panel. Then add your app license key which you can get from the Vuforia Developer Portal.
Now download Region Capture from the following link.
Now import region capture unity package in your project.
Adding Image Target:
Once the package is imported go to “Region_Capture” Folder -> Markers Folder and import stones and chips package.
Now right click in the hierarchy and select Vuforia -> Image to add an image target.
Now click on the image target and select “StonesAndChips” database and in image target select Stones_Marker.
Adding 3D Object:
Now add a sphere in the child of the image target by right-clicking on it and select 3d Object -> sphere.
Adding Material to the 3D Object:
Now create a material by right-clicking in the projects tab create -> material
And set that material type to Unlit/Texture.
Now assign that material to the sphere.
Adding Region Capture:
Now to go Region_Capture -> Prefabs and drag and drop Region_Capture prefab in the hierarchy.
Now select sphere and click add component and add “RC_Get_Texture” script.
Then add Region_Capture render camera in the RC_Get_Texture script.
In the next step, select Region_Capture and add AR Camera to it and also check use background plane in the scene.
Now go to Region_Capture folder -> Markers and open Stone_Marker image.
In last, build the app and scan the image from the phone you will see a sphere appear on the screen and if you start coloring on the image the texture of the sphere will also change.
In this tutorial, we learned how to make an AR coloring app using Unity, Vuforia and Region Capture by using an image as a texture for a 3D model. You can follow our whole game dev tutorials from here.