Unity Virtual Reality Projects

Book description

Explore the world of Virtual Reality by building immersive and fun VR projects using Unity 3D

About This Book

  • Learn the basic principles of virtual reality applications and get to know how they differ from games and desktop apps
  • Build various types of VR experiences, including diorama, first-person characters, riding on rails, 360 degree projections, and social VR
  • A project-based guide that teaches you to use Unity to develop VR applications, which can be experienced with devices such as the Oculus Rift or Google Cardboard

In Detail

What is consumer ?virtual reality?? Wearing a head-mounted display you view stereoscopic 3D scenes. You can look around by moving your head, and walk around using hand controls or motion sensors. You are engaged in a fully immersive experience. On the other hand, Unity is a powerful game development engine that provides a rich set of features such as visual lighting, materials, physics, audio, special effects, and animation for creating 2D and 3D games. Unity 5 has become the leading platform for building virtual reality games, applications and experiences for this new generation of consumer VR devices.

Using a practical and project-based approach, this book will educate you about the specifics of virtual reality development in Unity.

You will learn how to use Unity to develop VR applications which can be experienced with devices such as the Oculus Rift or Google Cardboard. We will then learn how to engage with virtual worlds from a third person and first person character point of view. Furthermore, you will explore the technical considerations especially important and possibly unique to VR. The projects in the book will demonstrate how to build a variety of VR experiences. You will be diving into the Unity 3D game engine via the interactive Unity Editor as well as C-Sharp programming.

By the end of the book, you will be equipped to develop rich, interactive virtual reality experiences using Unity.

So, let's get to it!

What You Will Learn

  • Create 3D scenes with Unity and Blender while learning about world space and scale
  • Build and run VR applications for consumer headsets including Oculus Rift and Google Cardboard
  • Build interactive environments with physics, gravity, animations, and lighting using the Unity engine
  • Experiment with various user interface (UI) techniques that you can use in your VR applications
  • Implement the first-person and third-person experiences that use only head motion gestures for input
  • Create animated walkthroughs, use 360-degree media, and build multi-user social VR experiences
  • Learn about the technology and psychology of VR including rendering, performance and VR motion sickness
  • Gain introductory and advanced experience in Unity programming with the C# language

Who This Book Is For

If you're a non-programmer unfamiliar with 3D computer graphics, or experienced in both but new to virtual reality, and are interested in building your own VR games or applications then this book is for you. Any experience in Unity is an advantage.

Style and approach

This book takes a practical, project-based approach to teach specifics of virtual reality development in Unity. Using a reader-friendly approach, this book will not only provide detailed step-by-step instructions but also discuss the broader context and applications covered within.

Table of contents

  1. Unity Virtual Reality Projects
    1. Table of Contents
    2. Unity Virtual Reality Projects
    3. Credits
    4. About the Author
    5. About the Reviewers
    6. www.PacktPub.com
      1. Support files, eBooks, discount offers, and more
        1. Why subscribe?
        2. Free access for Packt account holders
    7. Preface
      1. What this book covers
      2. What you need for this book
      3. Who this book is for
      4. Conventions
      5. Reader feedback
      6. Customer support
        1. Downloading the example code
        2. Downloading the color images of this book
        3. Errata
        4. Piracy
        5. Questions
        6. Image credit
    8. 1. Virtually Everything for Everyone
      1. What is virtual reality to you?
      2. Types of head-mounted displays
        1. Desktop VR
        2. Mobile VR
      3. The difference between virtual reality and augmented reality
      4. Applications versus games
      5. What this book covers
        1. Who are you?
      6. Types of VR experiences
      7. Technical skills that are important to VR
      8. Summary
    9. 2. Objects and Scale
      1. Getting started with Unity
        1. Starting a new Unity project
        2. The Unity editor
        3. The default world space
      2. Creating a simple diorama
        1. Adding a cube
        2. Adding a plane
        3. Adding a sphere and some material
        4. Changing the scene view
        5. Adding a photo
        6. Coloring the ground plane
      3. Measurement tools
        1. Keeping a unit cube handy
        2. Using a Grid Projector
        3. Measuring the Ethan character
      4. Importing from the Blender experiment
      5. An introduction to Blender
        1. A unit cube
        2. A UV Texture image
        3. Importing into Unity
        4. A few observations
      6. Summary
    10. 3. VR Build and Run
      1. VR device integration software
        1. Unity's built-in VR support
        2. The device-specific SDK
        3. The OSVR project
        4. WebVR
        5. 3D worlds
      2. Creating the MeMyselfEye prefab
      3. Build for the Oculus Rift
      4. Build for Google Cardboard
        1. The Android setup
        2. The iOS setup
        3. Installing the Cardboard Unity package
        4. Adding the camera
        5. The build settings
        6. The Play Mode
        7. Building and running in Android
        8. Building and running in iOS
      5. The device-independent clicker
      6. How virtual reality really works
        1. Stereoscopic 3D viewing
        2. Head tracking
      7. Summary
    11. 4. Gaze-based Control
      1. Ethan, the walker
        1. Artificially intelligent Ethan
        2. The Navmesh bakery
        3. A random walker in the town
        4. Interlude – a quick introduction to Unity programming
        5. The RandomPosition script
        6. "Zombie-ize" Ethan!
      2. Go where I'm looking
        1. The LookMoveTo script
        2. Adding a feedback cursor
        3. Observations
      3. If looks could kill
        1. The KillTarget script
        2. Adding particle effects
        3. Cleaning up
      4. Summary
    12. 5. World Space UI
      1. A reusable default canvas
      2. The visor HUD
      3. The reticle cursor
      4. The windshield HUD
      5. The game element UI
      6. The info bubble
      7. An in-game dashboard with input events
        1. Creating a dashboard with buttons
        2. Linking the water hose to the buttons
        3. Activating buttons from the script
        4. Look to highlight a button
        5. Looking and then clicking to select
        6. Looking and staring to select
      8. A responsive object UI with head gestures
        1. Using the head position
        2. Using head gestures
      9. Summary
    13. 6. First-person Character
      1. Understanding the Unity characters
        1. Unity components
          1. The Camera component
          2. The Rigidbody component
          3. The Character Controller component
        2. Unity Standard Assets
          1. ThirdPersonController
          2. AIThirdPersonController
          3. FirstPersonController
          4. RigidBodyFPSController
      2. Making a first person
        1. Move in the direction you're looking
        2. Keep your feet on the ground
        3. Don't pass through solid objects
        4. Don't fall off the edge of the world
        5. Stepping over small objects and handling uneven terrain
        6. Start and stop moving
        7. Using head gestures to start/stop
      3. User calibrations
        1. A character's height
        2. Real-life height of a player
        3. Recentering
      4. Maintaining a sense of self
        1. Head-body disconnect
        2. Head and body...
        3. ...And feet
        4. The body avatar
        5. Virtual David le nose
        6. Audio cues
      5. Locomotion, teleportation, and sensors
      6. Managing VR motion sickness
      7. Summary
    14. 7. Physics and the Environment
      1. Unity physics
      2. Bouncy balls
      3. Headshots
      4. Trampoline and brick
      5. A human trampoline
        1. Like a brick
        2. Like a character
      6. Interlude – environment and things
        1. Wispy Sky
        2. The planet Earth
        3. The corporate logo
          1. Blender
          2. Unity
      7. An elevator
      8. Jumping
      9. Summary
    15. 8. Walk-throughs and Rendering
      1. Building in Blender
        1. Walls
        2. Ceiling
      2. Assemble the scene in Unity
        1. The gallery room
        2. The artwork rig
        3. The exhibition plan
      3. Adding photos to the gallery
      4. An animated walk-through
        1. Unity's animation system
        2. Scripted animation
      5. Optimizing for performance and comfort
        1. Optimizing your implementation and content
          1. Simplify your models
          2. Using texture maps instead of complex meshes
          3. Limiting the objects to be drawn
          4. Lighting and shadow performance
          5. Optimizing your scripts
        2. Optimizing for the Unity rendering pipeline
          1. Life's a batch
          2. Multipass pixel filling
          3. Other rendering tips
        3. Optimizing for the target hardware and drivers
        4. Unity Profiler
      6. Summary
    16. 9. Using All 360 Degrees
      1. 360-degree media
      2. Crystal balls
      3. Magic orbs
      4. Panoramas
      5. Infographics
      6. Equirectangular projections
      7. Globes
      8. Photospheres
      9. Field of view – FOV
      10. Capturing a 360-degree media
      11. Summary
    17. 10. Social VR Metaverse
      1. Multiplayer networking
        1. Networking services
        2. The network architecture
        3. Local versus server
        4. The Unity networking system
      2. Setting up a simple scene
        1. Creating a scene environment
        2. Creating an avatar head
      3. Adding multiplayer networking
        1. Network Manager and HUD
        2. Network Identity and Transform
        3. Running as a host
        4. Adding spawn positions
        5. Running two instances of the game
        6. Associating avatar with the first-person character
      4. Adding multiplayer virtual reality
        1. The Oculus Rift players
        2. The Google Cardboard players
        3. Next steps
      5. Building and sharing a custom VRChat room
        1. Preparing and building the world
        2. Host the world
      6. Summary
    18. 11. What's Next?
    19. Index

Product information

  • Title: Unity Virtual Reality Projects
  • Author(s): Jonathan Linowes
  • Release date: September 2015
  • Publisher(s): Packt Publishing
  • ISBN: 9781783988556