演讲稿: 如何使用增强现实技术提高应用的用户体验

简介: With the accellerated evolution of mobile hardware, application developers tend to reconsider the importance of the Augmented Reality technology ( ca.

这是Jerry在SAP成都研究院内部用英文做的一个演讲,这里把底稿分享给大家:

With the accellerated evolution of mobile hardware, application developers tend to reconsider the importance of the Augmented Reality technology ( called AR for short in this article subsequently ) in regard to satisfy their customers better with enhanced user experience.

What is AR? See one explanation from Wikipedia:

Augmented reality (AR) is an interactive experience of a real-world environment where the objects that reside in the real world are enhanced by computer-generated perceptual information. AR can be defined as a system that fulfills three basic features: a combination of real and virtual worlds, real-time interaction, and accurate 3D registration of virtual and real objects.

clipboard1,1

This blog will not explore the possible scenario where AR can play its important role. Instead, Jerry will introduce a kind of development approach which enables developers to generate applications leveraging AR without deep knowledge on Computer Graphics.

This approach consists of pure JavaScript technical stack:the combination of React-Native plus ViroReact.

Jerry has introduced how to use Cordova to package a hybrid mobile application in the past:

clipboard2,2

And compared with Cordova, React-Native has quite different design idea: while Cordova can easily allow existing web application to run under different mobile platform at the cost of some performance loss, the application built by React-Native can behave more like a native mobile application.

For the concrete comparison between these two technical stacks, please refer to this medium article.

ViroReact,a platform for developers to rapidly build native cross platform AR applications using React Native. Its website provides many step by step guide by following which, you can soon get a running Hello World application with AR enablement.

clipboard3,3

Although just a single declaration code to introduce the dependency of ViroReact to your React-Native application as below, it's just the tip of iceberg.

clipboard4,4

When we enter the root folder of application with react-viro declared as dependency in its package.json and perform npm install, lots of artifacts are automatically downloaded into the node_modules folder:

clipboard5,5

Expand folder react-viro and we can find two separate folder, android and ios, which contains corresponding library codes for each platform. This mechanism implies how ViroReact achieves the cross platform enablement of AR feature. And what's the meaning of arcore_client under android folder above?

Before we go deep into the source code, let's acquaint ourselves with some prerequisite knowledge. In ViroReact website, it is documented that both ARKit from iOS and ARCore from Android are supported.

clipboard6

In this blog I choose Android platform which means I will concentrate on ARCore. Still remember the arcore_client folder mentioned previously?

Let's first see some real examples, developed by my colleague Wang Leo:

https://youtu.be/05A0bIiVouE
https://youtu.be/Rt163cQ_fbg

Amazing, isn't it?

Below are steps how to develop an application like that and make it running in your Android phone.

As the first step, ARCore should be installed on the Android phone.

ARCore is Google’s platform for building augmented reality experiences. Using different APIs, ARCore enables your phone to sense its environment, understand the world and interact with information.

clipboard7,7

Check the supported device list from Google website and install ARCore into your device according to corresponding instructions:

clipboard8,8
clipboard9,9

In ViroReact website there is a nice tutorial for beginners( just as our SAP UI5 tutorials):
clipboard10,10

Just follow the steps there and finally you will get a Hello World application with some computer generated virtual objects positioned within your real world:

clipboard11,11

In fact the AR car demo by my colleague Leo is also based on this tutorial, so I will introduce the delta part Leo has added on top of the Hello World tutorial.

In React-Native package.json file, name the project as "ViroSample" and declare the dependency of React-Native and ViroReact as below:

clipboard12,12

Execute the following two command lines:

  • react-native start
  • react-native run-android

And you can find the corresponding generated Java source code for Android platform under android folder. The most important one is MainActivity.java, where the project name defined in package.json is injected:

clipboard13,13

And in MainApplication.java, the entry point of React-Native JavaScript module is injected in Android callback getJSMainModuleName:

clipboard14,14

In my opinion the common process of ViroReact development consists of three major steps: Match, Replace and Augment.

Match step

As developers mix computer generated virtual objects with real world, they must decide which places in real environment could be used to hold the virtual objects and tell AR application the exact position. In ViroReact based AR application this is achieved by the tag . See one example below.

clipboard15,15

As its name hints, this tag declares a marker which guides ViroReact with exact position where the virtual object should be put on. As long as end user opens device Camera and detects a real object in the real world which is exactly the same as the object represented by the marker, we call this process as "matched" and ViroReact will automatically replace marker with another prepared virtual object ( will introduce soon ). As long as the marker is matched by some object in the real world, the replace process is automatically done without any additional coding from developer.

A marker is a placeholder in the application and could have various types, and of course ViroARImageMarker has Image as marker type, the image marker is indicated as name "logo" defined in line 44 above.

In the above example, the marker named "logo" is created by the following code:

clipboard16,16

The input of createTargets API is an image file stored in project folder:

clipboard17

This is reason in the youtube demo video that first Leo displays this image in his screen, then scan it via phone camera, and the image marker is replaced by the prepared car 3D model.

Replace step

As mentioned earlier, there is nothing to do from developer in this step except providing a 3D model to be replaced by image marker.

ViroReact provides the tag which represents the 3D car model consisting of a pure model ( .obj file ) and a series of material textures.

clipboard18,18

Below is the obj file for this car demo, opened by 3D Design software:

clipboard19,19

In Paint 3D software, we can drag it and have a 360 degree view on it. You can see the dynamic effect from this video:

You might think that the car model has no color on its surface and doesn't look not fancy at all. So do I. That's why we need to prepare texture as well.

In the project folder six different image files are stored there as raw material for model texture.

clipboard20,20

Colorful materials are created using those texture images files, and finally generate the glossy car model in the youtube video.

clipboard21,21

Augment step

Finally it's time for we developers to play with those generated virtual car model by JavaScript code. Since now we have six colorful textures at hand, it follows logically that it could be nice if the car in the AR application could change color every time it's tapped in the phone.

A piece of cake: register a function to onClick event handler:

clipboard22,22

And change the binding field for texture property accordingly:

clipboard23,23

Check this video below about how the Tesla car model in the application can change color once pressed:

Hope this blog can give you a basic understanding how to develop AR application using React-Native + ViroReact, thanks for reading.

clipboard24,24

本文来自云栖社区合作伙伴“汪子熙”,了解相关信息可以关注微信公众号"汪子熙"。

相关文章
|
2天前
|
传感器 人工智能 vr&ar
构建未来:移动应用中的增强现实技术革新
【4月更文挑战第23天】 随着移动技术的不断进步,增强现实(AR)在移动应用中扮演的角色日益重要。本文深入探讨了AR技术如何重新定义用户体验,以及开发者如何利用最新的AR工具和框架来创建沉浸式和互动式的应用程序。我们将通过实例分析,揭示AR技术如何在教育、游戏、零售和健康医疗等多个领域发挥作用,并讨论其面临的挑战与未来的发展趋势。
|
3天前
|
人工智能 算法 vr&ar
构建未来:移动应用中的增强现实技术
【4月更文挑战第22天】 在数字时代的风口浪尖,增强现实(Augmented Reality, AR)技术已经成为移动应用领域的一颗耀眼之星。本文将深入探讨AR技术的基本原理、当前在移动应用中的实际运用以及它如何重塑用户体验和商业战略。通过分析多个行业内的成功案例,我们将揭示AR技术如何推动移动应用从简单的工具转变为沉浸式的交互平台,并预测其未来的发展趋势。
12 3
|
4月前
|
人工智能 JSON C++
GPTs prompts灵感库:创意无限,专业级创作指南,打造吸睛之作的秘诀
GPTs prompts灵感库:创意无限,专业级创作指南,打造吸睛之作的秘诀
|
传感器 移动开发 数据可视化
三种前端实现VR全景看房的方案!说不定哪天就用得上! (下)
事情是这样的,前几天我接到一个外包工头的新需求,某品牌要搭建一个在线VR展厅,用户可以在手机上通过陀螺仪或者拖动来360度全景参观展厅,这个VR展厅里会有一些信息点,点击之后可以呈现更多信息(视频,图文等)... 我第一反应是用3D引擎,因为我不久前刚用three.js做过一个BMW的在线展厅,基本把three.js摸熟了。
952 0
三种前端实现VR全景看房的方案!说不定哪天就用得上! (下)
|
传感器 前端开发 vr&ar
三种前端实现VR全景看房的方案!说不定哪天就用得上!(上)
事情是这样的,前几天我接到一个外包工头的新需求,某品牌要搭建一个在线VR展厅,用户可以在手机上通过陀螺仪或者拖动来360度全景参观展厅,这个VR展厅里会有一些信息点,点击之后可以呈现更多信息(视频,图文等)... 我第一反应是用3D引擎,因为我不久前刚用three.js做过一个BMW的在线展厅,基本把three.js摸熟了。
452 0
三种前端实现VR全景看房的方案!说不定哪天就用得上!(上)
|
人工智能 数据可视化 大数据
5G商用化背后,“沉浸式阅读”是如何炼成的?
5G商用化背后,“沉浸式阅读”是如何炼成的?
143 0
5G商用化背后,“沉浸式阅读”是如何炼成的?
|
传感器 自动驾驶 算法
回顾:鲍世强,讲述51VR自动驾驶仿真平台从0-1的开发与构建
如何有效构建自动驾驶决策和感知的仿真体系?
986 0