Creating a Biology AR poster using Unity
About this lesson
In this lesson, students explore how to design and implement a simple Augmented Reality (AR) world to project DNA model using Unity 3D and Vuforia SDK for Unity 3D.
Year band: 9-10Curriculum Links Assessment
Links with Digital Technologies Curriculum Area
|9-10||Processes and Production Skills||
Create interactive solutions for sharing ideas and information online, taking into account safety, social contexts and legal responsibilities (ACTDIP043)
Plan and manage projects using an iterative and collaborative approach, identifying risks and considering safety and sustainability (ACTDIP044)
Links with Science Curriculum Area
|9||Science - Science Inquiry Skills||
Multi-cellular organisms rely on coordinated and interdependent internal systems to respond to changes to their environment (ACSSU175)
|10||Science - Science Inquiry Skills||
Transmission of heritable characteristics from one generation to the next involves DNA and genes (ACSSU184)
A group activity to add more information to the AR space poster as audio and/or 3D text about astronauts and spacecrafts would be an excellent chance for students to present their AR project to the class, along with addressing:
- Project title - introducing their favorite astronaut and spacecraft
- Project description (Science) - what Science concepts (e.g. gravity of planets, what materials used to build space crafts) are coupled with this project
- Project description (Digital Technologies) - what Digital Technologies concepts (e.g. digital systems, information systems, Internet) are coupled with this project
- Project description (Artificial Intelligence) - what Artificial Intelligence concepts (e.g. computer vision to track target image) are coupled with this project. This is an optional activity for students familiar with AI technology. For more information, please visit our free CSER MOOCS on teaching AI in Secondary years
- Project description (Augmented Reality) - what AR concepts (e.g. image target, 3D objects) are coupled with this project
- Process of design and development of the project
- What is the experience of developing this AR project, what are the identified challenges and how they were resolved
For further advice, examples and support around assessment please visit the Digital Technologies Hub's assessment section.
- Printed copy of an Image Target. Download the image used in this project from here
- 3D object that you want to overlay image (Note: this lesson uses freely available 3D objects)
- Computer to install Unity 3D (check system requirements for development)
- iPad or a computer with a webcam (in-built or wired) to test AR poster
Step 1: Unity 3D installation
The following are some suggested steps for implementing the lesson.
- If you haven’t installed Unity in your computer, please follow the comprehensive steps listed in the Unity documentation.
- You will need a free account with Unity 3D to access free Unity assets. Follow the instructions to create an account.
You will need to add ‘Vuforia AR’ resources when you are installing Unity. ‘Check’ the Vuforia Augmented Reality Support during Unity installation as below. If you want to test your project using iOS or Android devices, check the corresponding components (Note: Be mindful about the Install Size of these components since you will need free disk space in your computer to install these). To develop this lesson, we used ‘Vuforia Augmented Reality Support’ and ‘iOS Build Support’.
If you have completed the above steps, click New button to start developing this lesson.
- Provide a name for the project (e.g. AR_poster), select Template as 3D and choose a location from the computer to store the project files and click Create project (Note: it might take a while to import things needed for your project such as assets).
- Please complete steps 2-4 in order to set up the environment for your Unity-AR project.
- Once these steps are completed, start Step 5 to start developing your AR project.
Familiar with Unity 3D environment
If this is your first time working with Unity, you can try out step-by-step tutorials to get familiar with the Unity environment by downloading basic tutorials (e.g. Play & Edit Mode). These basic tutorials are recommended for beginners prior to try out our lesson since this lesson will not provide information about features in the Unity environment (such as Assets, Objects, Inspector).
Step 2: Vuforia SDK for Unity 3D
What is Vuforia?
Vuforia is an Augmented Reality (AR) Software Development Kit (SDK) for mobile devices that facilitates the creation of AR applications. It uses Computer Vision technology to recognise and track ‘Image Targets’ in real-time. Vuforia is also used as a Mixed Reality (MR) application development platform.
Vuforia uses Computer Vision technology to recognise image targets and overlays AR experience (e.g. 3D objects, videos) on image targets.
If you need to learn more about Vuforia, please refer to the documentation)
- You will need a free account with Vuforia developer. Click Register and complete the required information.
- You will also need to get a Vuforia development key to build and test your applications with Unity using License Manager and Get Development Key function.
Add a random licence key name (e.g. ar_biology), ‘tick’ the agreement box and select Confirm to get a free development key.
- Click the licence key and copy it to your application.
Step 3: Image Target
What is Image Target (or AR markers)?
AR markers are images or objects (e.g. QR codes, physical reflective markers, Image Targets and 2D tags) registered with the application which act as information triggers in your application. When your device’s camera recognizes these markers, this triggers the display of virtual content over the world position of the marker in the camera view.
- Vuforia provides free samples of Image Targets to reuse in your projects. You can download them from here.
Alternatively, you can access them within the Asset Store tab in Unity. Use the Search textbox to find Vuforia Core Samples. You can add these samples to your asset store and Import them to the project. If you are unsure about which assets to import, select All and click Import.
Step 4: 3D objects
- When our camera recognises the image target, we want to overlay a 3D object over it.
- If you want to add your own assets, you can create 3D models on your own or download from the web (Note: 3D models that compatible with Unity can be found here.
- Below are some suggested websites to find good 3D models. Feel free to share new suggestions with the CSER community (https://teachingai.blog/)
Step 5: AR development using Unity
- In order to start a new project, you will need to add a new scene by selecting File -> New Scene and provide a name for the scene (e.g. Astronaut). Alternatively, you can reuse the default SampleScene by deleting existing objects that loaded automatically.
- In the left panel (Hierarchy), delete the default Main Camera and Directional light objects. To do this, right-click on each object and select Delete.
- Once the existing objects are deleted, add ARCamera to the project by selecting GameObject > Vuforia Engine > AR Camera (if you are prompted for anything, you will have to authorise them all - e.g. importing additional assets).
- You should see the AR Camera object added to the Hierarchy panel. Once you select AR Camera, you should see the Inspector panel on the right hand side. This demonstrates the configurations of the object.
- Towards the bottom of the ‘Inspector’ section, you should see a button Open Vuforia Engine Configuration that is disabled by default.
- To enable it, go to Edit > Project Settings and click on the Player button.
- In the XR Settings section (bottom), select the option Vuforia Augmented Reality Supported (Click ‘accept’ if you were prompted for Vuforia Software Licence).
- You can then close the Project Settings window and go back to the AR Camera’s configurations window.
- The Open Vuforia Configurations button should be enabled by now (click ‘AR camera’ to see the ‘Inspector’ window).
- Click Open Vuforia Engine Configuration button and copy your App Licence key that you generated previously and click Add Licence..
- You will need to have a webcam (either built-in or wired) configured for this project (Note: if you do not have a webcam, alternative steps for testing are listed at the bottom of this lesson). If you have only one camera associated with your PC or laptop, everything should be working fine with the default settings. To confirm this, click Resources in the Assets tab and select VuforiaConfiguration.asset.
- In the Inspector window, check Webcam settings towards bottom. In the Camera Device, select the webcam you want to use for this project. Otherwise, leave Integrated Webcam as below.
Adding a custom Image Target to your project
- To learn more about Image Targets, click here.
- In the Vuforia Developer Portal, select Target manager.
- Click Add database, provide a name, select type as Device and click Create.
Now select the database we have created (e.g. DNA_Images) and click Add Target.
There should be four different target types. Select Single Image and browse your disk to locate the image you want to use as an Image Target.
- The Width value (e.g. 5.5 in cm) is a scale value that you need to set to the size you want the image to appear in your Unity Scene (Note: Unity measures everything in your Scene in relation to the size of your Image Target).
- Give a name to the target and upload it.
Now the uploaded image appears in the list of targets with a rating. If the image you uploaded has low ratings, it may be difficult for the camera to track it (see more information here). In such cases, try to upload a different image. Once you are satisfied with your image’s rating, check the box next to Target Name and click Download Database button.
Under the development platform, select Unity Editor and click Download and save this file (.unitypackage) in your disk. Alternatively, if you have prompted, you can open the file with Unity Editor and select Import.
- Switch back to your Unity project to use the Unity package in your AR application.
- If you haven’t imported image targets using the above steps, you can import an Image Target that we have saved in the local drive (see Resources section above for the link). In the Project window, right click Assets and select Import Package > Custom Package and select the package saved in the disk before.
- Once you have set the image target, the next step is to add the image target to the scene. To add an image target to our project, go to GameObject > Vuforia > Image. This will add the image target to your scene.
In the Image Target Behaviour component, click on the Database drop-down list and select your Target database (e.g. VuforiaMars_Images). In the Image Target drop-down list, select the name of your Image Target (e.g. Astronaut) from the database.
You may have to zoom in a little bit inside your scene to see the image.
- We used predefined as the Type of Image Target Behaviour.
- Now we will need to add a 3D object to the Image Target
- For this, right-click on the ImageTarget in the left panel and select Vuforia > ModelTarget.
- We will reuse a 3D model downloaded from DNA project in the Unity Asset Store. To overlay this, select Project > Assets > DNA > Prefabs and drag and drop DNA 3D model as Model Target over our DNA image target.
- By default, the 3D model is quite big. Therefore, we need to scale it down.
- Click on the ModelTarget object in the left panel and update its scale in the right panel. A scale X, Y and Z of 0.7 should work well.
- After scaling it down, it should look something like below.
- You might want to change the position of the model, change the values of the Scale / Rotation (inside the inspector) to get it into the right place
Step 6: Testing the project
Testing using the computer
In order to test your project with a computer, you will need a built-in or wired web camera. If you do not have access to these, please try out ‘option 2: Testing using the iPad’ below.
Now you can try out the AR experience by clicking the Play button of Unity and pointing the printed poster (or a mobile device loaded with the image target) to the camera.
Note: We have included the Image Target used in this lesson in the Resources section.
If everything is working properly, a 3D model should appear when you point the image target to the computer’s camera. To stop running the project, hold and press the Play button again.
Testing using the iPad
- To test your project with an iPad, you will need an iPad with ‘Unity Remote 5’ app loaded. If you do not have access to these, please try out ‘option 1: Testing using the computer’ above.
- To test the project with iPad, we will have to switch platform to iOS. Select File -> Build settings and then select iOS as the platform.
- If you do not have iOS modules loaded (see pic above), click Open Download Page and you will be prompted to Save iOS support file. Download this file to your local computer and double click to install it (Note: this installation required ~2 GB of your disk space).
- Once you have installed iOS support, make sure you restart Unity. Now go back to File -> Build setting -> iOS (step 2 above) and click switch platform at the bottom and wait until switching platform done.
- If switching of platform is successful, you will see a window like below in Build settings.
- Connect your iPad to the computer using a USB cable (provided for iPad charging) and open Unity Remote 5 app. Once it is opened, click the Play button in the Unity window.
- Click Edit -> Project Settings -> Editor and select the Device that is connected to Unity. You will be prompted to select the iPad you are using (Note: iPad name should different from what is shown in the image below)
- You will see the Unity play screen duplicated in your iPad. Now point the printed poster in front of your iPad camera and enjoy the AR experience with 3D models. Enjoy!
The following are some suggested discussion points to create the augmented world with DNA models. You can add answers to following questions as audios, new 3D models, videos, or new Image Targets.
- What does DNA stand for?
- Who discovered DNA and when DNA was discovered?
- What is DNA made of?
- What is the shape of DNA? (See more information here)
- How does the device recognise the Target image?
Why is this relevant?
DNA (Deoxyribonucleic acid) is an extremely long macromolecule that is the main component of chromosomes and is the material that transfers genetic characteristics in all life forms, constructed of two nucleotide strands coiled around each other in a ladder like arrangement with the side pieces composed of alternating phosphate and deoxyribose units and the rungs composed of the purine and pyrimidine bases adenine, guanine, cytosine, and thymine: the genetic information of DNA is encoded in the sequence of the bases and is transcribed as the strands unwind and replicate.
In this activity, students are engaged in evaluating the AR posters and considering how they could build their own AR/VR experience about DNA. In doing so they are thinking about the digital content and ways of presenting information in a 3D space. They are learning about how a Target image can be used in AR experiences and how computers/devices recognise Target images.