Andrzej Mazur • @end3r • Enclave Games
Warszawskie Dni Informatyki, Warsaw, Poland, March 28th 2017
View Master (1939)
Project Headsight (1961)
Tron (1982), Star Trek (1987), Matrix (1999)
Sega Genesis (1991)
Virtua Racing (1993)
Norvegian Army (2014)
Oculus Rift
PlayStation VR
Gear VR, Google Cardboard
Keyboard and mouse, Leap Motion, Gamepad API, Device Orientation...
Firefox Nightly, Chromium, Microsoft Edge, Oculus Carmel, Samsung Internet
Editor's Draft
Web: mozvr.com, webvr.info.
HMDVRDevice and PositionSensorVRDevice
HMDVRDevice: getEyeParameters(), setFieldOfView().
PositionSensorVRDevice: getState(), resetSensor().
navigator.getVRDevices().then(function(devices) {
for (var i = 0; i < devices.length; ++i) {
if (devices[i] instanceof HMDVRDevice) {
gHMD = devices[i];
break;
}
}
if (gHMD) {
for (var i = 0; i < devices.length; ++i) {
if (devices[i] instanceof PositionSensorVRDevice
&& devices[i].hardwareUnitId === gHMD.hardwareUnitId) {
gPositionSensor = devices[i];
break;
}
}
}
});
VREffect ⁄ VRControls
var effect = new THREE.VREffect(renderer);
var manager = new WebVRManager(renderer, effect);
function init () {
// using gl-matrix for linear algebra
var viewMatrix = mat4.lookAt(mat4.create(), eye, center, up);
var projectionMatrix = mat4.perspective(mat4.create(), fov, near, far);
var mvpMatrix = mat4.multiply(mat4.create(), projectionMatrix, viewMatrix);
gl.uniformMatrix4fv(uniforms.uMVPMatrixLocation, false, mvpMatrix);
};
function update (t) {
gl.clear(flags);
gl.drawElements(mode, count, type, offset);
requestAnimationFrame(update);
};
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>A-Frame demo - cube</title>
<script src="aframe.min.js"></script>
</head>
<body>
<a-scene>
<a-cube color="#0095DD" position="0 1 0" rotation="20 40 0"></a-cube>
</a-scene>
</body>
</html>
<a-camera>
<a-light>
<a-cylinder>
<a-entity>
...
<a-entity
geometry="primitive: torus; radiusTubular: 0.1; segmentsTubular: 12;"
material="color: #EAEFF2; roughness: 0.1; metalness: 0.5;"
rotation="10 0 0"
position="-3 1 0">
</a-entity>
var scene = document.querySelector('a-scene');
var cylinder = document.createElement('a-cylinder');
cylinder.setAttribute('color', '#FF9500');
cylinder.setAttribute('height', '2');
cylinder.setAttribute('radius', '0.75');
cylinder.setAttribute('position', '3 1 0');
scene.appendChild(cylinder);
<a-cube color="#0095DD" rotation="20 40 0" position="0 1 0">
<a-animation
attribute="rotation"
from="20 0 0"
to="20 360 0"
direction="alternate"
dur="4000"
repeat="indefinite"
easing="ease">
</a-animation>
</a-cube>
var t = 0;
function render() {
t += 0.01;
requestAnimationFrame(render);
cylinder.setAttribute('position', '3 '+(Math.sin(t*2)+1)+' 0');
}
render();
Consumer devices: 2016/2017.
There's already an API for that!
Keep high framerate, no camera movement, keep horizon level, show... nose?
Give reasons to look around.
You have to be "inside".
Find out how millions of people will use it.