Home Game Development Unity 2020 Virtual Reality Projects - Third Edition

Unity 2020 Virtual Reality Projects - Third Edition

By Jonathan Linowes
books-svg-icon Book
eBook $29.99 $20.98
Print $43.99
Subscription $15.99 $10 p/m for three months
$10 p/m for first 3 months. $15.99 p/m after that. Cancel Anytime!
What do you get with a Packt Subscription?
This book & 7000+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with a Packt Subscription?
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with eBook + Subscription?
Download this book in EPUB and PDF formats, plus a monthly download credit
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with a Packt Subscription?
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with eBook?
Download this book in EPUB and PDF formats
Access this title in our online reader
DRM FREE - Read whenever, wherever and however you want
Online reader with customised display settings for better reading experience
What do you get with video?
Download this video in MP4 format
Access this title in our online reader
DRM FREE - Watch whenever, wherever and however you want
Online reader with customised display settings for better learning experience
What do you get with video?
Stream this video
Access this title in our online reader
DRM FREE - Watch whenever, wherever and however you want
Online reader with customised display settings for better learning experience
What do you get with Audiobook?
Download a zip folder consisting of audio files (in MP3 Format) along with supplementary PDF
What do you get with Exam Trainer?
Flashcards, Mock exams, Exam Tips, Practice Questions
Access these resources with our interactive certification platform
Mobile compatible-Practice whenever, wherever, however you want
BUY NOW $10 p/m for first 3 months. $15.99 p/m after that. Cancel Anytime!
eBook $29.99 $20.98
Print $43.99
Subscription $15.99 $10 p/m for three months
What do you get with a Packt Subscription?
This book & 7000+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with a Packt Subscription?
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with eBook + Subscription?
Download this book in EPUB and PDF formats, plus a monthly download credit
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with a Packt Subscription?
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with eBook?
Download this book in EPUB and PDF formats
Access this title in our online reader
DRM FREE - Read whenever, wherever and however you want
Online reader with customised display settings for better reading experience
What do you get with video?
Download this video in MP4 format
Access this title in our online reader
DRM FREE - Watch whenever, wherever and however you want
Online reader with customised display settings for better learning experience
What do you get with video?
Stream this video
Access this title in our online reader
DRM FREE - Watch whenever, wherever and however you want
Online reader with customised display settings for better learning experience
What do you get with Audiobook?
Download a zip folder consisting of audio files (in MP3 Format) along with supplementary PDF
What do you get with Exam Trainer?
Flashcards, Mock exams, Exam Tips, Practice Questions
Access these resources with our interactive certification platform
Mobile compatible-Practice whenever, wherever, however you want
  1. Free Chapter
    Understanding Unity, Content, and Scale
About this book
This third edition of the Unity Virtual Reality (VR) development guide is updated to cover the latest features of Unity 2019.4 or later versions - the leading platform for building VR games, applications, and immersive experiences for contemporary VR devices. Enhanced with more focus on growing components, such as Universal Render Pipeline (URP), extended reality (XR) plugins, the XR Interaction Toolkit package, and the latest VR devices, this edition will help you to get up to date with the current state of VR. With its practical and project-based approach, this book covers the specifics of virtual reality development in Unity. You'll learn how to build VR apps that can be experienced with modern devices from Oculus, VIVE, and others. This virtual reality book presents lighting and rendering strategies to help you build cutting-edge graphics, and explains URP and rendering concepts that will enable you to achieve realism for your apps. You'll build real-world VR experiences using world space user interface canvases, locomotion and teleportation, 360-degree media, and timeline animation, as well as learn about important VR development concepts, best practices, and performance optimization and user experience strategies. By the end of this Unity book, you'll be fully equipped to use Unity to develop rich, interactive virtual reality experiences.
Publication date:
July 2020
Publisher
Packt
Pages
592
ISBN
9781839217333

 
Understanding Unity, Content, and Scale

You may remember building a diorama project from a shoebox for school as a child. We're going to make one today, using Unity. Let's assemble our first scene, which is composed of simple geometric objects. Along the way, we'll talk about using Unity, world scale, and rendering. We'll also explore various sources for 3D content, where you can find them, and how to use them in your Unity VR scenes. In this chapter, we will get you started in creating VR projects with Unity and work through some core concepts, including the following:

  • Installing Unity
  • Getting started with Unity
  • Creating a simple diorama
  • Using prefabs
  • Creating and importing content
 

Technical requirements

To implement the projects and exercises in this chapter, you will need the following:

  • A PC or Mac with Unity 2019.4 LTS or later, the XR Plugin for your device, and the XR Interaction Toolkit installed

You can access or clone the GitHub repository for this book (https://github.com/PacktPublishing/Unity-2020-Virtual-Reality-Projects-3rd-Edition-) to optionally use the assets and completed projects for this chapter as follows:

  • The asset files for you to use in this chapter are located in UVRP3Files/Chapter-02-Files.zip.
  • All completed projects in this book are in a single Unity project atUVRP3Projects.
  • The completed assets and scenes for this chapter are in the UVRP3Projects/Assets/_UVRP3Assets/Chapter02/folder.
 

Installing Unity

To get started, you first need to install Unity on your development machine. All the projects in this book will be built using the Unity 3D game engine. Unity is a powerful, cross-platform 3D development environment with a user-friendly editor.

If you don't have Unity installed on your computer yet, we'll do that now! The full-featured Personal Edition is free and runs on both Windows and Mac (for details, see https://store.unity.com/#plans-individual). This book is written with Unity 2019.4 LTS and Unity 2020.x in mind.

Development system requirements

There are a few prerequisites that we need before we get started. You should have a Mac or Windows PC to develop on with enough resources to install and run Unity (a Linux version of Unity is also in the works). Details of the current system requirements for Unity can be found on its website (https://unity3d.com/unity/system-requirements), including the supported operating system...

 

Getting started with Unity

For you beginners out there, we're going to take this chapter nice and slow, with more hand-holding than you'll get later in this book. Even if you already know Unity and have developed your own games, it may be worthwhile to revisit the fundamental concepts, since the rules are sometimes different when designing for virtual reality.

Exploring the Unity Editor

The Unity Editor consists of multiple nonoverlapping windows, or panels, that may be subdivided into panes. The following is a screenshot of a project with the default window layout, annotated to identify some of the panels: (1) Hierarchy, (2) Scene, (3) Inspector, and (4) Project:

A Unity project consists of one or more scenes, containing a hierarchy of game objects. In the preceding screenshot, I have just created a new default empty scene (File | New Scene) and added a 3D cube (GameObject | 3D Object | Cube). The Hierarchywindow...

 

Creating a simple diorama

We will add a few objects to the scene, including a unit cube, a flat plane, a red ball, and a photographic backdrop. Here is a photograph of a physical mock-up of the diorama we will build in VR:

To begin, let's create a new scene and name it Diorama:

  1. If you haven't already, start a new scene in your opened project by selecting File | New Scene.
  2. Then select File | Save As....
  3. Open the Assets/Scenes/ folder.
  4. Set the file name to Diorama.
  5. Press Save.

Ok, now we'll add stuff.

Adding a cube and a plane

Let's add the first object to the scene, a unit-sized cube:

  1. Within theHierarchywindow,click on the+ (create) menu in the upper-left corner.
  2. Click on 3D Object | Cube. The same selection can also be found in the main menu bar's GameObject menu.

A default cube...

 

Using prefabs

Unity prefabs (short for prefabricated object) allow you to create, store, and modify GameObjects as reusable assets together with all its components, property values, and child GameObjects. Prefabs are easily created by dragging an object from the scene Hierarchy window into the Project window, or they may be imported as part of a Unity asset package. You can read more about prefabs in the Unity Manual at https://docs.unity3d.com/Manual/Prefabs.html.

Let's see how this works by creating a simple reusable model built from simple geometric elements.

Creating and instantiating a prefab

We're going to create a reusable character prefab named BobHead. First, let's build the little guy from a few primitive 3D objects, as follows:

  1. In the Hierarchy, create an empty GameObject named BobHead (by clicking on +| Create Empty; name it BobHead).
  2. Set its position to something like Position (3, 0.75, 1.25).
  3. ...
 

Importing content

So far, we have shown you how to use Unity and be productive in creating a scene, but with pretty simple content. Normally, Unity is not a 3D-modeling or asset-creation tool. Rather (as the name Unity suggests), it's a unified platform for pulling together content from a variety of sources to assemble and program a game or experience involving animation, physics, rendering effects, and so on. If you are a 3D artist, then you may know how to create content in other programs, or you can find a plethora of models on the web.

Creating 3D content for VR

Unity offers some basic geometric shapes, but when it comes to more complex models, you'll need to go beyond Unity. The Unity Asset Store and many other sites have tons of amazing models. Where do they come from? Will you run into problems while importing them into Unity?

For example, Blender is a free and open source 3D animation suite (http://www.blender.org/) that you can use to...

 

Summary

In this chapter, you built a simple diorama, became more acquainted with the Unity editor, and learned about importing content into your project. We started by installing Unity via Unity Hub, creating a new VR project with the Universal Render Pipeline, and installing additional packages using Package Manager.

Then you learned some basics of the Unity editor, such as how to navigate between its many windows and how to use the Scene editing gizmos, including grid and snap. We built a simple diorama scene with a ground plane, a crate (cube), a red ball, and a photo backdrop. You then created a BobHead prefab and learned about prefab editing, overrides, variants, and nesting, which we'll be seeing more of in upcoming chapters.

You also looked at the value of, and potential problems with, importing assets and Unity asset packages, including ones from the Asset Store. We learned about the issues with importing legacy assets that are not necessarily compatible...

About the Author
  • Jonathan Linowes

    Jonathan Linowes is a VR/AR enthusiast, Unity, and full stack developer, entrepreneur, certified Unity instructor, and the owner of Parkerhill XR Studio, an immersive media, applications, and game developer. Jonathan has a bachelor of fine arts degree from Syracuse University, a master of science degree from the MIT Media Lab, and has held technical leadership positions at Autodesk and other companies. He has authored multiple books on VR and AR published by Packt Publishing.

    Browse publications by this author
Latest Reviews (2 reviews total)
Easy process with a great customer experience.
The book was as advertised.
Unity 2020 Virtual Reality Projects - Third Edition
Unlock this book and the full library FREE for 7 days
Start now