Skip to the content.

Exercise 5

Part B: Advanced Outputs - Unity (Optional Activity)

(Many thanks to Cole Juckette for his help with Exercise 5!)

A step-by-step video of the ‘Mesh Collider’ version of this exercise can be found here.

A more advanced approach to creating an interactive reconstruction of Malthi is to use a game engine, like Unity, to essentially make a walking simulator of the site. Though Sketchfab is a very simple and quick way to get your 3D assets out into the world, Unity offers significantly more freedom in what is possible to create.

Think and Respond: Before you start this optional activity, reflect on your own learning objectives. Do you feel that the additional work and time investment that you will put into learning this new skillset is worth the range of possibilities Unity offers for archaeological reconstructions? Which features offered by Unity (and not offered by Sketchfab) do you think are particularly important for interpreting reconstructed archaeological sites?

You will need to make an account to access the Unity Asset Store, and you can install Unity from this link. In the asset store, you will want to find the most up-to-date, free ‘First Person Character Controller’ (preferably made available by Unity Technologies). At the time of writing, this could be found at this link, but be sure that you familiarise yourself with how the Unity Asset Store functions.

You will also need to make some decisions about how you want your game to appear – do you want the normal maps intact on your laser-scanned datasets, and simply apply a Mesh Collider? Or would you prefer to utilise Unity’s Terrain Engine to add more detail to your landscape/reconstruction?

There are a few things that will need to be prepared before importing everything into a Unity project. First, ensure that the reconstructed assets are exported separately from the laser scanned dataset. Secondly, make sure that your base map is decimated to about 1 million faces or so – this will result in a file size that is around 80 MB. Smaller file sizes mean that your ‘game’ will run more smoothly.

Finally, you need to ensure that most large holes (most of which arise from merging segments of the laser scan data) are filled. Because this involves filling the holes between what used to be two separate ‘objects’, you need to use the ‘Bridge edge loop’ tool instead of just using the ‘Fill’ tool in Blender. This is to prevent your user’s ‘character’ from falling into holes in the terrain.

Screenshot showing the selection of two small edges (in orange) to enable bridging edge loops.

A screenshot showing where to find the 'Bridge Edge Loops' option.

A screenshot showing the hole outlined in orange, which can now be closed with the 'Fill' option.

A screenshot of the filled hole in the mesh.

Once your data is ready, export them into either the FBX or OBJ format. While you can import the entire BLEND file into Unity, at the time of writing this was still less reliable than exporting the files directly.

Creating a Unity Project

Now that your files are ready, you’ve installed Unity on your computer, and you’ve added the First Person Controller to your Unity assets, you are ready to begin building in Unity.

First, open Unity. You will be greeted with a pop up like the one below (note that this Exercise will be providing examples from version 2020.3.18f1). Choose a 3D Template, name your project and choose where to save it. It will then take some time to create the project.

The window that pops up when you start Unity (version 2020.3.18f1). Choose '3D Template'

Now that you have created your blank Unity project, here are a few basic controls you will need to get used to:

Toolbar used to move and rotate the 3D assets in the Unity viewport.

More of Unity’s controls can be found in its Documentation here.

Mesh Collider Approach

If you wish to keep your laser scan data looking exactly as it did in Blender, you can add what is called a ‘Mesh Collider’ to your scan data to allow your user to ‘walk’ on the site. First, let’s import your assets.

When Unity opens the 3D Template, you will see a few familiar-looking areas. For one, it has a ‘Hierarchy Window’ much like Blender, where you can find all of the ‘layers’ or individual ‘assets’ in the project. There is a ‘Project Window’ at the bottom of the screen, where you will likely see a sole ‘Assets’ folder. Open the assets folder, and drag your decimated, normal-mapped laser scan data into the ‘Assets’ folder.

Drag and drop your 'site' or 'terrain' data into the Asset folder.

Once your 3D data is in the ‘Assets’ folder, you can click and drag it directly into the ‘Scene’ window.

Dragging the map of Malthi into the 'Scene'.

Now, let’s rotate the model so that the surface of the site is pointing up (note that the Y axis is up in Unity). Select the Malthi model and the ‘Inspector Window’ will provide many options. Under ‘Transform’, change the rotation of the X Axis to 270.

Aligning the 'site' so that 'up' is aligned with the Y axis.

Next, copy over your ‘Structures’ in the same way, and apply the same transformation so that they are roughly aligned with your site.

Importing the 'Structures'.

When we place the structures into the scene, they will not be perfectly aligned with the site.

Use the 'Move' and 'Rotation' tools to align the structures with the walls visible in the mesh

Now you may want to add your normal maps to the Unity project – you can either drag all of your normal maps into the Asset folder (like you did with the 3D objects), or create a new folder for them. When you import your normal maps, Unity should automatically identify that they are normal maps, because they were attached to your 3D model in Blender as ‘Materials’; Unity should automatically identify this reference. This triggers a pop up window, with Unity asking if you want to ‘fix’ them – click ‘Fix now’ and these will become associated with your laser scanned data.

Unity automatically identifies that the texture you have imported is a normal map - it asks before labelling the image as a normal map.

If something doesn’t look quite right, you can check the ‘Inspector’ for your laser scanned data – for each dataset that you broke down the original laser scan data into, there will be a specific material slot. If you open this ‘material slot’ as in the image below, you can check that the correct Normal map has been assigned by clicking on the normal map slot (highlighted with a red box) – it will highlight the normal map that is assigned to this material slot in the ‘Assets’ folder.

If a normal map does not appear to have been applied correctly, check that the correct normal map has been applied to each material slot for your laser scan data.

Now, to ensure that the user will be able to walk on your laser scan data, we need to add something called a ‘Mesh Collider’. This will ensure that the laser scan data is treated as a ‘solid surface’, enabling characters to ‘collide’ with the site data. To add a Mesh Collider to your laser scan data, ensure that your mesh is highlighted and its details are visible in the Inspector. In the Inspector window, scroll all the way down to the ‘Add Component’ option. Then, search for the ‘Mesh Collider’ component, as shown below. Select Mesh Collider, and it will be added to the list of components (likely above the material slots). Once this is applied, check the ‘convex’ box. This process may take some time to complete.

After clicking 'Add Component', you will be able to search for the 'Mesh Collider' component.

The Mesh Collider Component will appear in the Inspector just above the Material slots. Check the box next to 'Convex'

At this point, you have now converted your laser scan data into a ‘solid surface’ for your users to (eventually) navigate! If you are happy with this, skip to the ‘Adding the First Person Controller’ section below.

Terrain Engine Approach

If, instead of wanting to keep your normal maps, you want to work with Unity’s ‘Terrain Engine’, you will first need to convert your laser scan mesh into a ‘Terrain’. Unfortunately this is not an inbuilt function in Unity, so you will need to download the ‘Object2Terrain’ script. While it is not recommended that you download scripts from sketchy sites, this particular script is recommended by a wide variety of online tutorials (and me).

Create the Editor folder.

Drag the 'Object2Terrain' script into the Editor folder.

Allow the script to update.

Note that the 'Terrain' tab has been added as a dropdown menu from the top of the Unity interface.

The move tool is highlighted in the Unity toolbar.

The mesh is clearly positioned above the grid.

The image shows the Unity interface, with the 'Terrain' dropdown menu engaged, showing the 'Object to Terrain' option, which should then be selected.

The Object2Terrain dialogue box prompts you to provide a resolution at which to project the details from your mesh to the terrain mesh.

Your structures can now be added to the scene and positioned onto your Terrain mesh.

- Make sure you save!

Adding the First Person Controller

Whether you decided to go with the ‘Terrain’ or the ‘Mesh Collider’ approach to creating the floor of your experience, you can now add your user’s first-person player character. To do this, navigate to the ‘Window’ option and select ‘Package Manager’. (Note: The following instructions assume that you have added a first person player controller from the Unity store, as outlined at the start of this exercise.)

A screenshot showing how to access the Unity Package Manager from the Window drop down menu.

In the Package manager, change the ‘Package’ drop down menu to ‘My Assets’ (highlighted with a red box below). From here, choose ‘Starter Assets – First Person Character Controller’ and click ‘Import’ in the bottom right hand corner (highlighted with a blue box below).

How to add the 'Starter Assets - First Person Character Controller' to the project.

Unity will then take some time before coming up with another pop up as shown below, click import again.

A new pop up window will provide details for the assets that you are adding to your project - click Import.

Unity will then take some time to add these components to your project. After some time, a new pop up will appear, asking if you want to enable backends. Click YES, which will cause Unity to do some more processing, and then will restart completely.

Unity will ask if you want to enable backends - click Yes and Unity will restart.

Be sure to save!

How your screen will appear once the Starter Assets have been added to your project. Navigate to the First Person folder.

After dragging in the FPC, you may need to zoom out significantly to find the 'move' controls.

The components of the 'Nested Parent' first person character controller.

Use the 'play' button to test your game.

You should be able to test your 'game' in the 3D viewport using the WASD keys. Your mouse controls the direction of the camera.

How to edit the speed, jump height, etc of your player capsule.

Try it yourself! You may have noticed that your character is currently able to move through the walls of your reconstruction. How would you ensure that your player character collides with these structures?

Now that you have the basics in place, you can add further detail. If you went with the ‘Terrain’ option above, you can easily add a ground texture (after adding it to your assets through the asset store, or by downloading a texture from online and dragging it into your assets). Select your ‘Terrain’ in the hierarchy, then under ‘Terrain’, click the gear image. Under the ‘Basic Terrain’ settings, you can set its ‘Material’ to your preferred texture.

If you have instead chosen to keep your normal maps intact, you will already have all of the detail from the original laser scan data preserved. Adding additional textures may occlude those details, but you may wish to add some sort of colour. This is slightly more complicated than the steps above, as you will need to ‘unpack materials’ from the 3D model to make them editable, and then manually reassign your normal maps to each segment again, even if you did this in the steps above. You will need to do this regardless of whether you exported your site map as an OBJ file or FBX file.

Click on your original mesh to find the 'Extract materials' option in the Inspector window.

Choose one of the materials to open the material Inspector.

Note: Unity may not recognise that these are Normal maps upon import (especially if you are working with an OBJ file). Simply click on the normal map and change (or if you assign a normal map to a material, it will ask if you want to fix this now and do it automatically).

Change the colour of the material so that you can identify the correct normal map to assign to it.

Screenshot showing how to rename the Materials to make matching materials to different areas of your mesh easier

Think and respond: What other details can you add to your reconstruction? What is necessary to address the aims of the project? Other textures? Should the light source in the scene be positioned in a certain direction (where would the sun be above the actual site of Malthi during the morning? The afternoon? The evening?) As you test your experience, what is missing? Do you need to add a bounding box to ensure your users cannot fall into the ‘void’? What about sound?

While this tutorial has introduced you to a few of the basics behind creating a digital walkthrough of your reconstruction of the site of Malthi, there are many other things you would need to consider to create a truly engaging and immersive experience. Because Unity is widely used, there will more than likely be a YouTube video demonstrating how to add whatever functionality you may want to add. However, you may need to reframe your archaeological queries into a more general or videogame-inclined query before pursuing it. For example, if you wanted to add multiple phases of activity to your site, searching for this may not yield too many results. If you instead reframe this as ‘how to allow players to change between Scenes in Unity’, you may find more useful results about triggers or interfaces to incorporate into your project.

Now, how will your Unity project be made available? There are a number of options for you to explore if you navigate to ‘File>Build Settings’, as shown below. If you want to publish it on a website, you will likely need to publish it for WebGL – Unity provides a tutorial specifically for this here.

Window displaying the Build options for a Unity project.

Thinking about going further

You may also want to produce an AR or VR application to allow for a fuller exploration of your reconstruction, like the Villa Livia Reloaded gesture-based VR exhibit. These can get quite complex, though the Cine project has produced a series of toolkits to make the construction of these more accessible. Their VR toolkit is available here. Photosphere exhibits, like those hosted at Roundme, can be employed as VR experiences as well, just with hotspot navigation. You could adapt your project in Unity to a VR output, or you could use something completely different, like Aframe. However, whether this would be a useful output for your project will be determined by the project aims, the budget available, the planned use for this application (will you be demonstrating the application at conferences/outreach events? How many headsets do you need to have available?), and the amount of time available to complete it.

Think and respond: Now that you have basic experience with both approaches, given the requirements/parameters of the project set out in Exercise 1, do you think that Sketchfab or Unity would be a better output? Why have you made that choice? What are the benefits of using Sketchfab, despite its limited functionality? What are the benefits of Unity, despite the amount of learning and time it takes to create an engaging experience?

Resources for Exercise 5

Reconstruction Output examples:

Applications to Disseminate Reconstructed Outputs

Further Reading

Papadopoulos, C. and Schreibman, S. 2019. Towards 3D Scholarly Editions: The Battle of Mount Street Bridge. Digital Humanities Quarterly. 13(1): 31-57. http://www.digitalhumanities.org/dhq/vol/13/1/index.html.

Plaksin, Andrey: https://sketchfab.com/3d-models/the-tomb-of-nefertari-3d-vr35-v0-73-90034cbe58904828a11429395cef9125

Watterson, A, Anderson, J & Baxter, K 2020, Designing Digital Engagements: Approaches to creative practice and adaptable programming for archaeological visualisation. In Proceedings of EVA London 2020. http://www.seriousanimation.com/hillforts/

Unity-specific Resources

Unity User Manual 2020.3 (https://docs.unity3d.com/Manual/index.html)

YouTube Videos Utilised:

Go back to Exercise 5 Part A Go to the Conclusion