Srushtika Neelakantam and

Tanay Pant

Learning Web-based Virtual Reality

Build and Deploy Web-based Virtual Reality Technology

Srushtika Neelakantam

Bangalore, Karnataka, India

Tanay Pant

Ghaziabad, India

Any source code or other supplementary material referenced by the author in this book is available to readers on GitHub via the book’s product page, located at www.apress.com/978-1-4842-2709-1 . For more detailed information, please visit www.apress.com/source-code .

ISBN 978-1-4842-2709-1

e-ISBN 978-1-4842-2710-7

DOI 10.1007/978-1-4842-2710-7

Library of Congress Control Number: 2017935381

© Srushtika Neelakantam and Tanay Pant 2017

This work is subject to copyright. All rights are reserved by the Publisher, whether the whole or part of the material is concerned, specifically the rights of translation, reprinting, reuse of illustrations, recitation, broadcasting, reproduction on microfilms or in any other physical way, and transmission or information storage and retrieval, electronic adaptation, computer software, or by similar or dissimilar methodology now known or hereafter developed.

Trademarked names, logos, and images may appear in this book. Rather than use a trademark symbol with every occurrence of a trademarked name, logo, or image we use the names, logos, and images only in an editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the trademark. The use in this publication of trade names, trademarks, service marks, and similar terms, even if they are not identified as such, is not to be taken as an expression of opinion as to whether or not they are subject to proprietary rights.

While the advice and information in this book are believed to be true and accurate at the date of publication, neither the authors nor the editors nor the publisher can accept any legal responsibility for any errors or omissions that may be made. The publisher makes no warranty, express or implied, with respect to the material contained herein.

Printed on acid-free paper

Distributed to the book trade worldwide by Springer Science+Business Media New York, 233 Spring Street, 6th Floor, New York, NY 10013. Phone 1-800-SPRINGER, fax (201) 348-4505, e-mail [email protected], or visit www.springeronline.com. Apress Media, LLC is a California LLC and the sole member (owner) is Springer Science + Business Media Finance Inc (SSBM Finance Inc). SSBM Finance Inc is a Delaware corporation.

To my beloved parents, and my brother, without whom none of my success would be possible.

—Srushtika Neelakantam

To my parents, who gave me the dream.

—Tanay Pant

Acknowledgments

Srushtika Neelakantam: I’d like to thank the Apress team, for their guidance throughout publishing my first book; Ms. Pramila Balan and Ms. Prachi Mehta, for patiently handling all my impatient queries; and all the other people at Apress, secretly and silently involved with this book.

Thanks to Sri Krishnadevaraya Trust, the management of my college; to my principal, Dr. M.S. Indira, for always supporting me; to my professors and mentors at my university, Mr. Dilip. K. Sen and Dr. VijayaKarthik, who’ve always steered me in the right direction and provided me with the right resources to achieve what I wanted; and to all my teachers throughout my life—I have had so many wonderful things to learn from each one of you!

Thanks to Mr. Kevin Ngo and Mr. Ram Dayal Vaishnav, for introducing me to virtual reality and WebVR—the journey has been amazing ever since, with your guidance. Thanks also to Mr. Shivagangadhar Kolli, for introducing me to Mozilla in my early days of college; to Ms. Havi Hoffman, for introducing me to MozTechSpeakers and giving me the opportunity to learn new technologies; to my mentor at Mozilla, Ms. Konstantina Papadea, for helping me with every possible thing and providing me with the right resources I needed to complete this book; and to my longtime friends, B.S Archana, Athira Girish, Vineel Reddy, Galaxy Kadiyala, Harsha Vardhan, Santosh Vishwanatham, Akshay Tiwari, Sumanth Damarla, and all my well-wishers, for always inspiring me and supporting me in all my endeavors.

Thanks to my extended family, which consists of so many amazing people who are always ready to share useful things and opportunities with me - you know who you are! To my father, Mr. Manmohan Raju, for always supporting me in all my endeavors; to my mother, Mrs. Vani Priya, for always nagging me to do the right thing; and to my amazing little brother, Mr. Srujan Raj, for always inspiring me to learn new things.

Tanay Pant: I would like to express my warmest gratitude to the many people who saw me through this book and to all those who provided support, read, wrote, assisted, and offered their insights. I would like to thank my family for their huge support and encouragement. Thank you to my father, who always inspired me to do something different, something good, with my life. I could not have asked for a better role model in my life! I am grateful to my mother, who has been the biggest source of positivity and a pillar of support throughout my life.

I would like to thank Donovan Kraeker ( drawvr.com ) for his code contributions in Chapter 6 . I want to thank Apress for enabling me to publish this book and the Apress team for providing smooth passage throughout the publishing process! I also would like to thank the professors at the College of Technology – Pantnagar, who provided me with the support I needed to write this book.

Thank you to Dr. H. L. Mandoria, Dr. Ratnesh Prasad Srivastava, Er. Sanjay Joshi, Er. Rajesh Shyam Singh, Er. B.K. Pandey, Er. Ashok Kumar, Er. Shikha Goswami, Er. Govind Verma, and Er. Subodh Prasad, for your motivation. My deepest gratitude to all the teachers who taught me from kindergarten through engineering. Last but not the least, my thanks and appreciation go to all my friends and well-wishers, without whom this book would not have been possible.

Thank you!

Contents

  1. Chapter 1:​ Introduction to VR and WebVR
    1. Introducing Virtual Reality
    2. Types of VR Hardware Setup
    3. Web-Based Virtual Reality
      1. Opportunities for WebVR Applications
      2. Current State of WebVR
    4. Virtual Reality Devices Available in the Market
    5. Summary
  2. Chapter 2:​ Bringing VR to the Web and WebVR Frameworks
    1. The WebVR API
    2. What Is MozVR?​
    3. Is Your Browser WebVR Enabled?​
    4. WebVR Developer Tools
      1. A-Frame
      2. WebVR-Boilerplate
      3. Vizor
    5. Summary
  3. Chapter 3:​ Setting Up Your VR Lab and Popular WebVR Projects
    1. Google Cardboard
    2. Oculus Rift
    3. HTC Vive
    4. Other Requirements
    5. A-Painter
    6. Blair Witch WebVR Experience
      1. Quake 3 WebGL Demo
    7. Summary
  4. Chapter 4:​ Introduction to A-Frame
    1. Introducing the A-Frame Library
      1. A Simple Example
      2. A Basic Application
      3. Key Features of A-Frame
    2. The Entity-Component System
      1. Caching Assets to Improve Performance
      2. Mixins
      3. Components and Building Blocks of A-Frame
    3. Primitives
      1. <a-box>
      2. <a-camera>
      3. <a-cursor>
      4. <a-circle>
      5. <a-collada-model>
      6. <a-cone>
      7. <a-curvedimage>
      8. <a-cylinder>
      9. <a-dodecahedron>
      10. <a-image>
      11. <a-light>
      12. <a-obj-model>
      13. <a-octahedron>
      14. <a-plane>
      15. <a-ring>
      16. <a-sky>
      17. <a-sound>
      18. <a-sphere>
      19. <a-tetrahedron>
      20. <a-torus>
      21. <a-torus-knot>
      22. <a-video>
      23. <a-videosphere>
    4. A-Frame Inspector
      1. Scene Graph
      2. Viewport
      3. Components Panel
    5. Summary
  5. Chapter 5:​ From “Hello, World” to a VR Content Display
    1. Building a Simple “Hello, World” VR Application
      1. bm-font-text-component
      2. Understanding the Flow of the Application
    2. Building a VR Content Display Web Site
    3. Summary
  6. Chapter 6:​ Building a VR-Based Movie Theater
    1. Planning the Movie Theater
    2. Building 3D Models with MagicaVoxel
    3. Getting Prebuilt Models from Clara
    4. Summary
  7. Chapter 7:​ A-Frame Components and the Registry
    1. Components in A-Frame
    2. Lifecycle Methods of Components
      1. Component.​init( )
      2. Component.​update( )
      3. Component.​remove( )
      4. Component.​tick( )
      5. Component.​pause( ) and Component.​play( )
    3. Built-in Components
    4. Using A-Frame Registry Components
    5. Summary
  8. Chapter 8:​ Version Control and Deploying Your Code on GitHub
    1. Introduction to Version Control Systems
    2. Advantages of Version Control
    3. Git:​ All You Need to Know
      1. Git vs.​ GitHub
      2. Installing Git on Your Machine
    4. Working with GitHub
    5. Hosting Your VR Web Site for Free Using GitHub Pages
    6. Summary
  9. Index

About the Authors

Srushtika Neelakantam ( https://srushtika.github.io ) is a student in computer science major at Sir M. Visvesvaraya Institute of Technology, Bangalore. She is a tech speaker at Mozilla and has spoken at various national and international tech conferences. She is a developer for the Android and web platforms. She runs a learning club in Bangalore where she actively advocates for an open Web and teaches web literacy to the people in her region. She is a Mozilla representative and actively contributes to the Mozilla VR project. She’s part of the Campus Advisory Committee, which aims at making contributions to Mozilla’s open source projects easier for students.

Tanay Pant ( https://en.wikipedia.org/wiki/Tanay_Pant ) is an Indian author, speaker, hacker, innovator, and tech enthusiast. He is best known for his work on various books about computer science, his open source contributions, and his talks at technology conferences. He is the chief architect of Stock Wolf ( www.stockwolf.net ), a global virtual stock-trading platform that aims to impart practical education about stocks and markets. He is also an alumnus of the Mozilla Representative Program, and you can find his name listed in the credits ( www.mozilla.org/credits/ ) of the Firefox web browser. You can also find articles written by him on web development at SitePoint and TutsPlus.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.144.252.201