Cardboard VR Projects for Android

Develop mobile virtual reality apps using the native Google Cardboard SDK for Android

Cardboard VR Projects for Android

This ebook is included in a Mapt subscription
Jonathan Linowes, Matt Schoen

3 customer reviews
Develop mobile virtual reality apps using the native Google Cardboard SDK for Android
$10.00
$44.99
RRP $35.99
RRP $44.99
eBook
Print + eBook
Preview in Mapt

Book Details

ISBN 139781785887871
Paperback386 pages

Book Description

Google Cardboard is a low-cost, entry-level media platform through which you can experience virtual reality and virtual 3D environments. Its applications are as broad and varied as mobile smartphone applications themselves. This book will educate you on the best practices and methodology needed to build effective, stable, and performant mobile VR applications.

In this book, we begin by defining virtual reality (VR) and how Google Cardboard fits into the larger VR and Android ecosystem. We introduce the underlying scientific and technical principles behind VR, including geometry, optics, rendering, and mobile software architecture. We start with a simple example app that ensures your environment is properly set up to write, build, and run the app. Then we develop a reusable VR graphics engine that you can build upon. And from then on, each chapter is a self-contained project where you will build an example from a different genre of application, including a 360 degree photo viewer, an educational simulation of our solar system, a 3D model viewer, and a music visualizer.

Given the recent updates that were rolled out at Google I/O 2016, the authors of Cardboard VR Projects for Android have collated some technical notes to help you execute the projects in this book with Google VR Cardboard Java SDK 0.8, released in May 2016. Refer to the article at https://www.packtpub.com/sites/default/files/downloads/GoogleVRUpdateGuideforCardbook.pdf which explains the updates to the source code of the projects.

Table of Contents

Chapter 1: Virtual Reality for Everyone
Why is it called Cardboard?
The spectrum of VR devices
A gateway to VR
The value of low-end VR
Cardware!
Configuring your Cardboard viewer
Developing apps for Cardboard
An overview to VR best practices
Summary
Chapter 2: The Skeleton Cardboard Project
What's in an Android app?
The Android project structure
Getting started with Android Studio
Creating a new Cardboard project
Adding the Cardboard Java SDK
The AndroidManifest.xml file
The activity_main.xml file
The MainActivity class
Summary
Chapter 3: Cardboard Box
Creating a new project
Hello, triangle!
3D camera, perspective, and head rotation
Repositioning the triangle
Hello, cube!
Lighting and shading
Spinning the cube
Hello, floor!
Hey, look at this!
Summary
Chapter 4: Launcher Lobby
Creating a new project
Adding Hello Virtual World text overlay
Using a virtual screen
Responding to head look
Adding an icon to the view
Listing installed Cardboard apps
Highlighting the current shortcut
Using the trigger to pick and launch the app
Further enhancements
Summary
Chapter 5: RenderBox Engine
Introducing RenderBox – a graphics engine
Creating a new project
Materials, textures, and shaders
The Math package
The Transform class
The Component class
The RenderObject component
The Cube RenderObject component
Vertex color material and shaders
The Camera component
RenderBox methods
A simple box scene
Cube with face normals
The Light component
Vertex color lighting material and shaders
Time for animation
Detect looking at objects
Exporting the RenderBox package
Summary
Chapter 6: Solar System
Setting up a new project
Creating a Sphere component
A solid color lighted sphere
Adding the Earth texture material
Day and night material
Creating the Sun
Creating a Planet class
Formation of the Solar System
A starry sky dome
Fine tuning the Earth
Changing the camera location
Possible enhancements
Updating the RenderBox library
Summary
Chapter 7: 360-Degree Gallery
Setting up the new project
Viewing a 360-degree photo
Viewing a regular photo
Putting a border frame on the image
Loading and displaying a photo image
Loading and displaying a photosphere image
The image gallery user interface
Displaying thumbnails in a grid
Gaze to load
Enable scrolling
Stay responsive and use threads
An explanation of threading and virtual reality
Launch with an intent
Showing/hiding the grid with tilt-up gestures
Spherical thumbnails
Updating the RenderBox library
Further possible enhancements
Summary
Chapter 8: 3D Model Viewer
Setting up a new project
Understanding the OBJ file format
Creating the ModelObject class
Parse OBJ models
Model extents, scaling, and center
I'm a little teapot
I'm a little rotating teapot
Thread safe
Launch with intent
Practical and production ready
Summary
Chapter 9: Music Visualizer
Setting up a new project
Capturing audio data
A VisualizerBox architecture
Waveform data capture
A basic geometric visualization
2D texture-based visualization
FFT visualization
Trippy trails mode
Multiple simultaneous visualizations
Random visualizations
Further enhancements
Summary
Onward to the future

What You Will Learn

  • Build Google Cardboard virtual reality applications
  • Explore the ins and outs of the Cardboard SDK Java classes and interfaces, and apply them to practical VR projects
  • Employ Android Studio, Android SDK, and the Java language in a straightforward manner
  • Discover and use software development and Android best practices for mobile and Cardboard applications, including considerations for memory management and battery life
  • Implement user interface techniques for menus and gaze-based selection within VR
  • Utilize the science, psychology, mathematics, and technology behind virtual reality, especially those pertinent to mobile Cardboard VR experiences
  • Understand Cardboard VR best practices including those promoted by Google Design Lab.

Authors

Table of Contents

Chapter 1: Virtual Reality for Everyone
Why is it called Cardboard?
The spectrum of VR devices
A gateway to VR
The value of low-end VR
Cardware!
Configuring your Cardboard viewer
Developing apps for Cardboard
An overview to VR best practices
Summary
Chapter 2: The Skeleton Cardboard Project
What's in an Android app?
The Android project structure
Getting started with Android Studio
Creating a new Cardboard project
Adding the Cardboard Java SDK
The AndroidManifest.xml file
The activity_main.xml file
The MainActivity class
Summary
Chapter 3: Cardboard Box
Creating a new project
Hello, triangle!
3D camera, perspective, and head rotation
Repositioning the triangle
Hello, cube!
Lighting and shading
Spinning the cube
Hello, floor!
Hey, look at this!
Summary
Chapter 4: Launcher Lobby
Creating a new project
Adding Hello Virtual World text overlay
Using a virtual screen
Responding to head look
Adding an icon to the view
Listing installed Cardboard apps
Highlighting the current shortcut
Using the trigger to pick and launch the app
Further enhancements
Summary
Chapter 5: RenderBox Engine
Introducing RenderBox – a graphics engine
Creating a new project
Materials, textures, and shaders
The Math package
The Transform class
The Component class
The RenderObject component
The Cube RenderObject component
Vertex color material and shaders
The Camera component
RenderBox methods
A simple box scene
Cube with face normals
The Light component
Vertex color lighting material and shaders
Time for animation
Detect looking at objects
Exporting the RenderBox package
Summary
Chapter 6: Solar System
Setting up a new project
Creating a Sphere component
A solid color lighted sphere
Adding the Earth texture material
Day and night material
Creating the Sun
Creating a Planet class
Formation of the Solar System
A starry sky dome
Fine tuning the Earth
Changing the camera location
Possible enhancements
Updating the RenderBox library
Summary
Chapter 7: 360-Degree Gallery
Setting up the new project
Viewing a 360-degree photo
Viewing a regular photo
Putting a border frame on the image
Loading and displaying a photo image
Loading and displaying a photosphere image
The image gallery user interface
Displaying thumbnails in a grid
Gaze to load
Enable scrolling
Stay responsive and use threads
An explanation of threading and virtual reality
Launch with an intent
Showing/hiding the grid with tilt-up gestures
Spherical thumbnails
Updating the RenderBox library
Further possible enhancements
Summary
Chapter 8: 3D Model Viewer
Setting up a new project
Understanding the OBJ file format
Creating the ModelObject class
Parse OBJ models
Model extents, scaling, and center
I'm a little teapot
I'm a little rotating teapot
Thread safe
Launch with intent
Practical and production ready
Summary
Chapter 9: Music Visualizer
Setting up a new project
Capturing audio data
A VisualizerBox architecture
Waveform data capture
A basic geometric visualization
2D texture-based visualization
FFT visualization
Trippy trails mode
Multiple simultaneous visualizations
Random visualizations
Further enhancements
Summary
Onward to the future

Book Details

ISBN 139781785887871
Paperback386 pages
Read More
From 3 reviews

Read More Reviews