Browser calls ARKit
In the past two days, Apple has released a preview of the new product launch. There is also a small egg on the official website page that is realized by calling ARCore with the browser. The effect of the shader looks comfortable. Attach the link https://www.apple.com.cn/apple-events/
The IOS end uses the safari browser to enable the ARKit function called AR Quick Look, and the developer’s official website has a related introduction https://developer.apple.com/augmented-reality/quick-look/
It uses safari to load the model file in the usdz format. The method of enabling is very simple, as shown below
<a href="sazane.usdz" rel="ar">
Just add a hyperlink tag on the html page, mark rel as ar, and pass in the file in href. But loading is also conditional, it needs to use an iPhone or iPad with IOS system> 12.0, and use the safari browser to load. Click here to see the effect.
The effect of AR is the original ARKit, which is quite good and easy to implement, but the displayed model is not so easy to use. The model loaded by AR Quick Look requires usdz format. It is a zero compression encrypted ZIP archive designed for 3D content. It is a model format developed by Apple and Pixar. At present, we can only use a software called Reality Converter on the Mac platform to output common model formats to usdz. Attach the download link of the software: https://developer.apple.com/download/
Browser calls ARCore
For various reasons, it is more troublesome for the browser to call ARCore than ios. The first need is a model that is compatible with ARCore. The current new Huawei models are basically hopeless (the models with strong hands-on ability can be changed); then the Android system version must be greater than 7.0; and then Google Play Servers for AR needs to be installed ; Then you need Google’s GoogleApp (a ladder and a three-piece set, attach the link https://play.google.com/store/apps/details?id=com.google.android.googlequicksearchbox ); Finally, you need Google’s The browser must be Chrome Beta 81.0.4044.18 or higher.
If all the above conditions are met, you can continue to watch, otherwise, forget it. This is one of the reasons why ARCore cannot be promoted in China. . .
Google’s solution is based on Scene Viewer, with the link introduced https://developers.google.com/ar/develop/java/scene-viewer
It is similar to the ios set, with AR and 3D browsing modes. But one thing is different is that ios uses usdz format, while android uses gltf format.
The implementation of the code is also very simple, as shown below:
<a href="intent://arvr.google.com/scene-viewer/1.0?file=
(你的gltf文件地址,去掉括号)#Intent;scheme=https;package=com.google.android.googlequicksearchbox;action=android.intent.action.VIEW;S.browser_fallback_url=https://developers.google.com/ar;end;">Model</a>
Click here to see the effect. The effect achieved is as follows:
The specific usage is also introduced in the link above, if you are interested, please refer to it