• Complain

John Gwinner [Gwinner - Getting Started With React VR: Build Immersive Virtual Reality Apps for the Web With React

Here you can read online John Gwinner [Gwinner - Getting Started With React VR: Build Immersive Virtual Reality Apps for the Web With React full text of the book (entire story) in english for free. Download pdf and epub, get meaning, cover and reviews about this ebook. year: 2017, publisher: Packt Publishing, genre: Home and family. Description of the work, (preface) as well as reviews are available. Best literature library LitArk.com created for fans of good reading and offers a wide selection of genres:

Romance novel Science fiction Adventure Detective Science History Home and family Prose Art Politics Computer Non-fiction Religion Business Children Humor

Choose a favorite category and find really read worthwhile books. Enjoy immersion in the world of imagination, feel the emotions of the characters or learn something new for yourself, make an fascinating discovery.

John Gwinner [Gwinner Getting Started With React VR: Build Immersive Virtual Reality Apps for the Web With React
  • Book:
    Getting Started With React VR: Build Immersive Virtual Reality Apps for the Web With React
  • Author:
  • Publisher:
    Packt Publishing
  • Genre:
  • Year:
    2017
  • Rating:
    5 / 5
  • Favourites:
    Add to favourites
  • Your mark:
    • 100
    • 1
    • 2
    • 3
    • 4
    • 5

Getting Started With React VR: Build Immersive Virtual Reality Apps for the Web With React: summary, description and annotation

We offer to read an annotation, description, summary or preface (depends on what the author of the book "Getting Started With React VR: Build Immersive Virtual Reality Apps for the Web With React" wrote himself). If you haven't found the necessary information about the book — write in the comments, we will try to find it.

Key Features
  • A practical guide to developing virtual reality experiences targeting web and mobile browsers
  • Create customized 3D graphics for your virtual reality experiences with Three.js
  • Explore the ReactVR library to create objects that seem real and see how they move in the Virtual world
  • Import free models into VR and include those in your code
Book Description

This book takes you on a journey to create intuitive and interactive Virtual Reality experiences by creating your first VR application using React VR 2.0.0.

It starts by getting you up to speed with Virtual Reality (VR) and React VR components.

It teaches you what Virtual Reality (VR) really is, why it works, how to describe 3D objects, the installation of Node.js (version 9.2.0) and WebVR browser. You will learn 3D polygon modeling, texturing, animating virtual objects and adding sound to your VR world. You will also discover ways to extend React VR with new features and native Three.js. You will learn how to include existing high-performance web code into your VR app. This book will also take you through upgrading and publishing your app.

By the end of this book, youll have a deep knowledge of Virtual Reality and a full-fledged working VR app to add to your profile!

What you will learn
  • Use Blender 2.79 to make virtual reality objects for Web VR.
  • Import free models into VR and how to include those in your code
  • Build a Virtual Museum with interactive art pieces
  • Create your first VR App and customizing it
  • Build animations by procedurally changing an objects position, using timers and Animated APIs
  • Incorporate React Native code and JavaScript code in your VR world
About the Author

John Gwinner is a Chief Technology Officer with nearly 2 decades of experience in VR. He developed a VR interface for CompuServe during the last wave of VR. He helped develop VRML (Virtual Reality Markup Language) and Web3D with a focus toward PCs, and put early versions of XML on the web. He was a returning speaker at the Game Developer Convention on 3D toolkits, AI, and VR. He was an early Kickstarter of a new VR Headset in 2014. Now that VR is definitely taking off again, John is once again at the forefront, with Vontic - developing VR interfaces to data, architectural visualization, and a bowling game that pits you against garden gnomes. He is a most viewed writer on Virtual Worlds and Augmented Reality on Quora, answering questions about VR and its future direction.

Table of Contents
  1. What is Virtual Reality, really?
  2. Flatland and Beyond - VR Programming
  3. 3D or reality in dimensions other than X and Y
  4. The react VR library
  5. First VR App
  6. Working with Poly and the Gon family
  7. Sitting Down with a (Virtual) Teapot
  8. Breath Life in Your World
  9. Do It Yourself Native Modules and three.js
  10. Bringing in the Real Live World
  11. Take a walk on the wild side
  12. Publishing Your App, and Where to Go From Here

**

About the Author

John Gwinner is a Chief Technology Officer with nearly 2 decades of experience in VR. He developed a VR interface for CompuServe during the last wave of VR. He helped develop VRML (Virtual Reality Markup Language) and Web3D with a focus toward PCs, and put early versions of XML on the web. He was a returning speaker at the Game Developer Convention on 3D toolkits, AI, and VR. He was an early Kickstarter of a new VR Headset in 2014. Now that VR is definitely taking off again, John is once again at the forefront, with Vontic - developing VR interfaces to data, architectural visualization, and a bowling game that pits you against garden gnomes. He is a most viewed writer on Virtual Worlds and Augmented Reality on Quora, answering questions about VR and its future direction.

John Gwinner [Gwinner: author's other books


Who wrote Getting Started With React VR: Build Immersive Virtual Reality Apps for the Web With React? Find out the surname, the name of the author of the book and a list of all author's works by series.

Getting Started With React VR: Build Immersive Virtual Reality Apps for the Web With React — read online for free the complete book (whole text) full work

Below is the text of the book, divided by pages. System saving the place of the last page read, allows you to conveniently read the book "Getting Started With React VR: Build Immersive Virtual Reality Apps for the Web With React" online for free, without having to search again every time where you left off. Put a bookmark, and you can go to the page where you finished reading at any time.

Light

Font size:

Reset

Interval:

Bookmark:

Make
Do not wait for next year's technology

A long time ago, when I was buying my first stereo, when I was 20, and flush with what I thought was a lot of money from working the summer during my college break, I really wanted a stereo. I spent weeks pouring over specifications, listening tests, comparing features, and was generally a bit parallelized by options.

I went around to stereo stores with a wad of dough, looking to buy something.

I went to one store, and asked the sales guy what stereo system he had.

"Oh, I've got next years model," he said.

What? I thought. Is something really great coming out?

"Oh, so what are you waiting for?" I asked. "What is coming out?"

"Oh, next year I'll wait for the next year too," he said. "You see, next year is always next year, so I never have a stereo that is obsolete," he said. He simply didn't ever buy a stereo.

I see his point. You might be thinking, Wait till it gets better.

My point is that in the last 30 years, I've listened to a lot more music than that salesman ever did.

You shouldn't wait to buy the next great piece of VR gear, get into it now. If something new comes out, you'll have enjoyed VR for much longer than if you had waited, and you'll know what you like a lot more. There aren't any bad decisions right now.

Why did I have you paste in both a Plane and a Box?

They both become the floor of our world, so why did we do both? If you look to the right in the VR View, you'll see that the Box has a funny looking edge. The texture map is equally applied to all six sides, and may look funny when stretched for boxes that aren't close in overall dimension. That is one disadvantage to the Box. The Plane doesn't have this problem, but if you get the Plane tilted the wrong way, you may not see it; the Plane is one sided so will be invisible if tilted away from the current camera. The Plane is also infinitely thin. I included both so you could see how they look.

In the section on transforms, I mentioned how important the order of transforms are. This is particularly important with the Plane object; if you rotate, then translate, the image may be oriented completely wrong, and in the case of a Plane, invisible.

To build the entire gallery, we'll need to include several squares for the platforms. Add a little bit of a gap between them. Now, we could do this by copying and pasting each Box or Plane (use whichever one you like!) and updating the translate statement:

{translate: [0,-1.8,-5.1]},
...
{translate: [0,-1.8,.1]},
...
{translate: [5.1,-1.8,.1]}

There is a better way though; React VR is not just a hardcoded geometry file, but rather an actual object-oriented JSX file, and we can make use of that.

Let's define a new object that is one of our deck plates. We will put everything but the position in as components of that object. First (and I pounded my head against the table for a while on this), change the first line of your code from:

import React from 'react';

To:

import React, {Component } from 'react';

Note that this is a different import statement than what we're using on the second line (and easy to overlook).

If you don't see an object you created, or get an error that a keyword that you know is valid isn't recognized, don't forget the import directive at the top of the file!
PointLight

A Pointlight is like an old-school light bulb; light spreads out in every direction from the point. One interesting thing about Point and Spot lights is again a simplification to make our VR look real. To avoid very slow rendering, the atmosphere is not strictly modeled. This means that a light that would normally fade out due to the atmosphere would instead shine for miles (atmospheric effects might be more of an issue where I live than where you live, unless you live on the moon. If you do, give me a ticket, and I'll come and personally read this book out loud to you).

To avoid modeling atmospheric effects such as extinction (fading), fog, clouds, and so forth, PointLight and SpotLight both take decay and distance props.

distance is how far the light shines. If it is non-zero, the light intensity will be zero at that distance.

decay is how often if fades away. It's sort of a generic (dimensionless) number; 2 is physically realistic light falloff. 0.1 makes a much sharper fade and is useful for artistic effects.

For example:


intensity={1}
style={{ transform: [ { translate: [0, 0, -5] }]}}
distance={10}
decay={2}
/>

To better visualize the preceding, I've constructed a demo scene three times; the first with a distance of 10, the second with a distance of four, and the third with a distance of four and a decay of 0.1 instead of 2. You can see the third scene looks very unnatural. Note that all three scenes have an intensity of exactly one.

If your point lights seem dim check the distance parameter I recommend - photo 1
If your point lights seem dim, check the distance parameter. I recommend leaving decay at two.
Making a three.js cube demo

First, let's take a look at a simple box demo. Let's start with a freshly generated site. Go to your node.js command-line interface and kill any npm start windows you have running and recreate a new, fresh site by issuing the command:

f:\ReactVR>React-vr init GoingNative

The first task is to go to the vr folder and edit client.js. Up to this point, we haven't had to edit this file; it contains boilerplate React VR code. Today, we're going to edit it, as we aren't doing just boilerplate. The bold lines in the following code are the lines we will add to client.js:

// Auto-generated content.
// This file contains the boilerplate to set up your React app.
// If you want to modify your application, start in "index.vr.js"
// Auto-generated content.
import {VRInstance} from 'react-vr-web';
import {Module} from 'react-vr-web';
import * as THREE from 'three';
function init(bundle, parent, options) {
const scene = new THREE.Scene();
const cubeModule = new CubeModule();

const vr = new VRInstance(bundle, 'GoingNative', parent, {
// Add custom options here
cursorVisibility: 'visible',
nativeModules: [ cubeModule ],

scene: scene,
...options,
});
const cube = new THREE.Mesh(
new THREE.BoxGeometry(1, 1, 1),
new THREE.MeshBasicMaterial()
);
cube.position.z = -4;
scene.add(cube);
cubeModule.init(cube);

vr.render = function(timestamp) {
// Any custom behavior you want to perform on each frame goes here
//animate the cube
const seconds = timestamp / 1000;
cube.position.x = 0 + (1 * (Math.cos(seconds)));
cube.position.y = 0.2 + (1 * Math.abs(Math.sin(seconds)));
};
// Begin the animation loop
vr.start();
return vr;
};
window.ReactVR = {init};

We also need to create the object CubeModule. You could put this in a separate file, and should if it gets complicated. For now, we can add it to the bottom of client.js:

export default class CubeModule extends Module {
constructor() {
super('CubeModule');
}
init(cube) {
this.cube = cube;
}
changeCubeColor(color) {
this.cube.material.color = new THREE.Color(color);
}
}

No other changes are needed. You will now see a bouncing, plain white cube. We haven't changed index.vr.js, so it still displays the hello text. This shows that both React VR and Native code, in this case three.js, are running at the same time.

Next page
Light

Font size:

Reset

Interval:

Bookmark:

Make

Similar books «Getting Started With React VR: Build Immersive Virtual Reality Apps for the Web With React»

Look at similar books to Getting Started With React VR: Build Immersive Virtual Reality Apps for the Web With React. We have selected literature similar in name and meaning in the hope of providing readers with more options to find new, interesting, not yet read works.


Reviews about «Getting Started With React VR: Build Immersive Virtual Reality Apps for the Web With React»

Discussion, reviews of the book Getting Started With React VR: Build Immersive Virtual Reality Apps for the Web With React and just readers' own opinions. Leave your comments, write what you think about the work, its meaning or the main characters. Specify what exactly you liked and what you didn't like, and why you think so.