Here at Parallax, we’ve been excited to work on various augmented reality (AR) projects for our clients recently. For those that don’t know – AR is a set of new technologies that allow you to display digital objects in a way that makes them look part of the real world.
You might be wondering what steps are involved in taking an object and making it viewable in an AR app or website. Here’s a quick breakdown of what we’ve discovered about the process.
Everything starts with a 3D model or ‘mesh’ typically created with 3D editors like Blender or Maya. Some smartphones come with depth-sensing cameras so scanning your 3D models can be an option too. To allow things to run at a smooth framerate – meshes need to be efficient, typically less than 100K polygons so some form of optimisation pass will often be required.
Most 3D editors will have several tools to help transform hi-res models into low-res ones, usually referred to as retopologizing or ‘retopo’ for short.
As shown in the image above, the decimator collapses polygons fall below a certain threshold in an area. A blunt instrument, but can be effective in making really dense meshes manageable. Similar to changing the quality setting on a JPEG.
Allows you to draw a lower resolution mesh on the surface of the hi-res version retaining the overall shape.
If an object is to look like it belongs in the real world it needs realistic materials and lighting. To achieve this most AR renderers use ‘PBR’. This stands for Physically Based Rendering which uses lighting algorithms based on real-world physics. PBR started off in the movie industry where assets need to look consistently accurate regardless of the environment.
Before PBR came along artists would create special purpose lighting setups per scene that were time-consuming to create and unintuitive to edit. PBR has now become something of a standard and is widely used in games and other real-time applications such as AR.
PBR uses a small number of shader inputs to describe how all materials look.
The base colour of the material
The vast majority of materials are described as being either metallic or non-metallic (dielectrics).
Simply how smooth or rough the surface is.
These take the ‘baked’ normal maps mentioned previously as input. Allows the display of small details like stitching or rivets.
There are some other special purpose properties such as emission and transparency but these tend to the vary depending on the renderer. Materials are rarely uniform across their surface so most of these values take an image map as input.
Libraries and Platforms
We have our assets ready to go, now we just have to pick what devices, browsers and operating systems we want to display them on. This is where things start to get tricky.
Apple SceneKit / ARKit
Apple’s AR framework, required to run natively on iOS devices.
Google’s AR framework, required to run natively on Android. Also works on iOS.
One of the first marker-based AR libraries
Yes, that’s its actual name… Allows the use of Google ARCore via the browser.
There’s also a version that allows access to ARKit too.
AR model view component
A Google web component that aims to abstract the differences between the different AR libraries.
Despite various attempts, there’s never been such thing as a universal 3D file format. Apps running natively on iOS will require Collada (.dae) files. Website or apps using the AR Quick Look viewer require USDZ files. AR Core on Android uses GLTF.
A broadly used XML format originally created by Sony and now managed by the Khronos Group (of OpenGL fame).
Short for Universal Scene Descriptor (Z = binary version). This format originated at Pixar and a converter comes built in with XCode. The converter also produces a more human-friendly USDA ASCII version, useful for debugging.
Another format managed by the Khronos Group GLTF is becoming the most popular interchange format for real-time assets. Supports PBR materials and the ability to embed textures in a single file.
It’s a pain exporting these formats manually.
We’ve created a command line script that will convert a Blender3D (.blend) file into these three main file formats in one shot.
You can find it on our GitHub here. The Collada format doesn’t seem to support PBR materials directly but as it’s an XML format it should be possible to add in some way. Pull requests are welcome ;)
Hopefully, this gives you an idea of what’s involved in creating AR suitable 3D assets. Send us an email or shout our way on Twitter if you have any questions!