This article is a practical case revolving around existing code, which you can download here.
If you are really into mobile AR or you are among one of its million admirers (like me), I’m pretty sure that you have dreamt of owning an ARCore-supported device (if you don’t already have one of those).
The list of ARCore-supported devices is like a drop in the vast ocean of Android devices. :D.
Many well-known AR platforms like Vuforia and familiar frameworks like Rajawali are already compatible with older Android devices. Now, Google too has included a feature (a view) for viewing 3D models which can be used with devices not possessing AR camera.
This blog demonstrates the use of SceneView by ARCore.
Enough talk! Let’s code…
I’ll use a 3D model of a coffee cup in this demo.
Skipping the initialization part and assuming that we are ready with the .sfb file of the 3D model, let’s focus on the core part. (Please refer the blog that I mentioned earlier, in order to generate the .sfb file of a model)
Add SceneView in the XML as shown below.
In your activity, add the following methods.
render() method accepts URI of the model (.sfa file) and produces a ModelRenderable object which is passes to addNode() method.
In this method, the node is prepared which has renderable as the ModelRenderable object that the previous method created. The node is added as a child in the scene view.
Don’t forget to resume and pause the sceneView in onResume() and onPause() methods.
That’s it. You’re done! The following screenshot shows the output.
I have included a link to the git repository for this project. Check it out!
Such apps can be used to showcase the catalog of any business in 3D to the users that do not own an AR-supported device.
In general cases, any businessman, developer or investor who has invested a lot of his time and money in building the app, will always want his app to be available to most number of users as possible. This feature can be helpful at such times. And as it is possible to load 3D models in real time, a lot can be thought on the basis of this ARCore functionality.
Find more top mobile app developers worldwide on AppFutura.