The workflow below discusses one way to create an Augmented Reality scene of a real-world landscape using Blender3d and Apple's ARKit.
- Using Blender, a 3D landscape is authored using public domain elevation data and aerial imagery.
- The 3D landscape is then imported into an ARKit Xcode project to create a 'table-top' Augmented Reality scene.
- The Augmented Reality scene can be explored by using a pan gesture to rotate and tilt the mountain landscape.
Figure: Mt. Rainier Augmented Reality scene using ARKit.
Acquire your elevation data (i.e. DEM or height map) from the public domain. In this example, we fetch an elevation model of Mt. Rainier, Washington.
-
Open Blender.
-
Delete the default cube.
-
Add a Plane Mesh.
-
Create a Subdivision Surface Modifier. Click on Modifiers and do the following (see screenshot below):
-
Choose Add a modifier
-
Choose Subdivision Surface
-
Choose Simple (default is Catmull-Clark)
-
Enter Subdivision View as 6
-
Enter Subdivision View as 6
- Create a Displace Modifier. Click on Modifiers and do the following (see screenshot):
-
Choose Add a modifier
-
Choose Displace
-
Under Texture, click New (see screenshot below)
- Click the right-most icon button from the Texture with the tooltip Show texture in texture tab. See screenshot below.
-
Confirm that the Texture Type is Image or Movie
-
Click the Open button and choose a height map downloaded from Part 1. The mesh will now take on the 3D data from the height map! See screenshot below.
- Choose a Color Space of linear (deafult is sRGB). See screnshot below.
-
Switch the viewport shading to Solid.
-
Finess the parameters of the previously added Modifiers to work with the data in your landscape of interest. See screenshot below:
- For the Subsurface Modifier, the Subdivions were updated to View = 9 and Render = 9.
- For the Displace Modifier, the Strength was change from the deafult of 1.0 to 0.5.
-
Acquire an aerial image for the same geographic extent as your height map.
-
Add a material to the 3D mesh (see screenshot below).
-
With the material selected, click the Texture button.
-
Click 'New' to create a new texture (see screenshot below).
- In Image section, click the Open button and navigate to the image.
- Switch to UV Editing mode (see screenshot below).
- On the bottom left, choose the aerial image.
- On the right-window, select the 3D mesh.
-
Select the 3D mesh and enter Edit Mode
-
While your mouse cursor is hovering over the mesh, Press U
-
Choose unwrap
-
Switch back to Object Mode
-
Choose a View Port Shading of Material
- Switch back from UV Editing mode to Deafult Mode to close the left window.
-
Choose File (menu) > Export > Collada (dae)
-
Under the 'Export Data Options', check on Apply Modifiers. This will ensure that the exported plane will have the 3D form of the height map.
-
Under the 'Texture Options', check on Include Material Textures'
-
Choose a location for the export and choose Export Collada.
-
Create a new Xcode project (use the AR template).
-
Add the exported Collada (dae) file into the art.scnassets folder.
-
Add the aerial image used as the material-texture into the art.scnassets folder.
-
Confirm the 3d model renders correctly in the Scene Editor.
- When creatting a scene, simply point to to the .dae file.
// Create a new scene
guard let scene = SCNScene(named: "art.scnassets/mt_rainier.dae") else {
return
}
// Set the scene to the view
sceneView.scene = scene
- Play with repositioning the 3D landscape in the Scene Editor and run. Point your phone at a table and it should resemble ...
Continue hacking at your AR scene!
- Twitter: @clintcabanero
- GitHub: ccabanero