matthias zwicker universität bern herbst 2016zwicker/courses... · •head-mounted displays...

28
Computergrafik Matthias Zwicker Universität Bern Herbst 2016

Upload: others

Post on 04-Jul-2020

5 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Matthias Zwicker Universität Bern Herbst 2016zwicker/courses... · •Head-mounted displays –Resolution –Binocular depth perception, also called stereopsis (vergence-accommodation

Computergrafik

Matthias Zwicker

Universität Bern

Herbst 2016

Page 2: Matthias Zwicker Universität Bern Herbst 2016zwicker/courses... · •Head-mounted displays –Resolution –Binocular depth perception, also called stereopsis (vergence-accommodation

Today

• Virtual reality

2

Page 3: Matthias Zwicker Universität Bern Herbst 2016zwicker/courses... · •Head-mounted displays –Resolution –Binocular depth perception, also called stereopsis (vergence-accommodation

Introduction

3

• “a computer technology that replicates an

environment, real or imagined, and

simulates a user's physical presence”,

including interaction with the environmenthttps://en.wikipedia.org/wiki/Virtual_reality

• Presence: feeling of being there

Page 4: Matthias Zwicker Universität Bern Herbst 2016zwicker/courses... · •Head-mounted displays –Resolution –Binocular depth perception, also called stereopsis (vergence-accommodation

History

4

1950s

Sensoramahttps://en.wikipedia.org/wiki/Sensorama

1980s

1990s: Cavehttps://en.wikipedia.org/wiki/Cave_automatic_virtual_environment

2000s: HTC Vive, Oculus

Google Cardboardhttps://en.wikipedia.org/wiki/Virtual_reality

Page 5: Matthias Zwicker Universität Bern Herbst 2016zwicker/courses... · •Head-mounted displays –Resolution –Binocular depth perception, also called stereopsis (vergence-accommodation

Applications

• Education, training (medical, military,

etc.)

• Entertainment (games, film, theme parks,

concerts, theater, etc.)

• Design (consumer products, engineering,

architecture, city planning)

• Virtual heritage, archeology

• Shopping

5

Page 6: Matthias Zwicker Universität Bern Herbst 2016zwicker/courses... · •Head-mounted displays –Resolution –Binocular depth perception, also called stereopsis (vergence-accommodation

Why is VR hard?• Input:

– Body pose of user (hands, head, etc.); current status of virtual world

• Output:

– Rendering of virtual world, other sensory outputs (audio, haptics); status of virtual world in next time step

• “Motion-to-photon” latency (input-to-output latency) must be < 20ms

– Otherwise, “VR sickness”

• Challenging to obtain in a system with many componentshttp://oculusrift-blog.com/john-carmacks-message-of-latency/

• Requirements

– Fast 3D motion tracking

– Fast rendering, GPUs

– High-resolution displays

6

Page 7: Matthias Zwicker Universität Bern Herbst 2016zwicker/courses... · •Head-mounted displays –Resolution –Binocular depth perception, also called stereopsis (vergence-accommodation

First head mounted display

• With mechanical head tracking (Ivan

Sutherland, 1968)https://en.wikipedia.org/wiki/Ivan_Sutherland

http://www.informit.com/articles/article.aspx?p=2516729&seqNum=2

• See-through (“augmented reality”)

7

Page 8: Matthias Zwicker Universität Bern Herbst 2016zwicker/courses... · •Head-mounted displays –Resolution –Binocular depth perception, also called stereopsis (vergence-accommodation

Consumer VR system (2016)

8

Head mounted display, tracked

(HMD)

Hand-held controller

(tracked)

3D tracking

hardware

Sound

input/output

GPU

Page 9: Matthias Zwicker Universität Bern Herbst 2016zwicker/courses... · •Head-mounted displays –Resolution –Binocular depth perception, also called stereopsis (vergence-accommodation

Technical challenges

• Head-mounted displays

– Resolution

– Binocular depth perception, also called

stereopsis (vergence-accommodation conflict)

• Integration of additional input and output

devices

– 3D tracking of head, hands, body

– 3D audio

– Haptics (sense of touch)

9

Page 10: Matthias Zwicker Universität Bern Herbst 2016zwicker/courses... · •Head-mounted displays –Resolution –Binocular depth perception, also called stereopsis (vergence-accommodation

Head mounted display

10

http://www.osvr.org/hardware.html

Pre-distorted binocular

stereo images

Shows two separate, slightly different images to each eye

Page 11: Matthias Zwicker Universität Bern Herbst 2016zwicker/courses... · •Head-mounted displays –Resolution –Binocular depth perception, also called stereopsis (vergence-accommodation

Stereopsis

• Perception of depth (3D structure) through

binocular vision

• Binocular depth cueshttps://en.wikipedia.org/wiki/Depth_perception#Binocular_cues

– Vergence

– Disparity

• Allow distance estimation based on

binocular vision

11

Page 12: Matthias Zwicker Universität Bern Herbst 2016zwicker/courses... · •Head-mounted displays –Resolution –Binocular depth perception, also called stereopsis (vergence-accommodation

• Both eyes rotate (“vergence”), such that

fixation point is in center of visual field

(fovea) for both eyes

Vergence

12

Fovea (center of visual field)

Left eye Right eyeRight eye

view

Left eye

viewVergence

Page 13: Matthias Zwicker Universität Bern Herbst 2016zwicker/courses... · •Head-mounted displays –Resolution –Binocular depth perception, also called stereopsis (vergence-accommodation

Binocular disparity• (Angular) disparity: difference in image

location (angle) of object seen by left and right eye

13

Right eye

view

Left eye

view

Disparity: difference

between and

Fovea (center of visual field)

Fixation point

Page 14: Matthias Zwicker Universität Bern Herbst 2016zwicker/courses... · •Head-mounted displays –Resolution –Binocular depth perception, also called stereopsis (vergence-accommodation

Accommodationhttps://en.wikipedia.org/wiki/Accommodation_(eye)

• Lens in eye changes optical power (by

deforming) to focus at certain distance

14

Page 15: Matthias Zwicker Universität Bern Herbst 2016zwicker/courses... · •Head-mounted displays –Resolution –Binocular depth perception, also called stereopsis (vergence-accommodation

Accommoation

• Head mounted display includes additional

lens to allow focus (accommodation) at a

comfortable distance

15

HMD with lens

and displayAccommodation

to virtual display distance

Page 16: Matthias Zwicker Universität Bern Herbst 2016zwicker/courses... · •Head-mounted displays –Resolution –Binocular depth perception, also called stereopsis (vergence-accommodation

Vergence-accommodation conflict

• Vergence: to perceived point in space

• Accommodation: to virtual display surface

16

Perceived

point in space

Virtual display distanceHMD

Vergence

Page 17: Matthias Zwicker Universität Bern Herbst 2016zwicker/courses... · •Head-mounted displays –Resolution –Binocular depth perception, also called stereopsis (vergence-accommodation

Vergence accommodation conflict

• Can lead to “VR sickness”

• Currently unsolved

• Related: retinal blur

– Out-of-focus blur of objects at distances away

from fixation point

– Perceivable in real world, but not replicated

in current HMDs

• Research ideas exist

– “Light field stereoscope”http://www.computationalimaging.org/publications/the-light-field-stereoscope/

17

Page 18: Matthias Zwicker Universität Bern Herbst 2016zwicker/courses... · •Head-mounted displays –Resolution –Binocular depth perception, also called stereopsis (vergence-accommodation

3D tracking

• Goal: determine position and orientation

of real-world objects relative to a

reference coordinate system

18

x

y

z

World coordinate system

?

Page 19: Matthias Zwicker Universität Bern Herbst 2016zwicker/courses... · •Head-mounted displays –Resolution –Binocular depth perception, also called stereopsis (vergence-accommodation

Triangulation• Assume known “lighthouse” coordinate systems

• Measure directions from lighthouses to tracking point

• Intersection gives 3D position (triangulation) of tracking point relative to lighthouses

• Triangulating 3 or more points determines orientation

19

x

y

z

World coordinate system

Fixed “Lighthouse”

coordinate system

Fixed “Lighthouse”

coordinate system

KnownKnown

Page 20: Matthias Zwicker Universität Bern Herbst 2016zwicker/courses... · •Head-mounted displays –Resolution –Binocular depth perception, also called stereopsis (vergence-accommodation

HTC Vive/SteamVR tracking techhttps://partner.steamgames.com/vrtracking/

• Lighthouses emit optical timing signals and sweeps room (left-right and top-bottom) with laser beam, 60 times per second

• Tracking point has light sensor

• When tracking point detects laser beam, can recover laser beam direction from timing information, then perform triangulation from two beams

20

x

y

z

World coordinate system

“Lighthouse” “Lighthouse”

Laser beams

sweeping scene

Page 21: Matthias Zwicker Universität Bern Herbst 2016zwicker/courses... · •Head-mounted displays –Resolution –Binocular depth perception, also called stereopsis (vergence-accommodation

HTC Vive/SteamVR tracking tech• Calibration: establish relation between lighthouses and world coordinates

• Moving tracking objects around and recording multiple beam directions from both lighthouses allows to reconstruct relation of light houses

• Set world coordinates at center of user space, user defined

21

x

y

z

World coordinate system

“Lighthouse” “Lighthouse”

User defined

User defined

Calibration

Page 22: Matthias Zwicker Universität Bern Herbst 2016zwicker/courses... · •Head-mounted displays –Resolution –Binocular depth perception, also called stereopsis (vergence-accommodation

HTC Vive/SteamVR tracking tech• Track several objects, like hand controllers

• 1000Hz refresh rate (using additional inertial sensors in tracked devices)

22

x

y

z

World coordinate system

“Lighthouse” “Lighthouse”

User defined

User defined

Page 23: Matthias Zwicker Universität Bern Herbst 2016zwicker/courses... · •Head-mounted displays –Resolution –Binocular depth perception, also called stereopsis (vergence-accommodation

3D tracking demo• Juggling

• Many other 3D tracking technologies exist

• Often via triangulation

23

Page 24: Matthias Zwicker Universität Bern Herbst 2016zwicker/courses... · •Head-mounted displays –Resolution –Binocular depth perception, also called stereopsis (vergence-accommodation

VR in practice

• GPU-based rendering (almost) as usual

(OpenGL, DirectX)

• Interface to VR hardware via OpenVRhttps://en.wikipedia.org/wiki/OpenVR

24

Page 25: Matthias Zwicker Universität Bern Herbst 2016zwicker/courses... · •Head-mounted displays –Resolution –Binocular depth perception, also called stereopsis (vergence-accommodation

OpenVR

• Main functionality

– Provide 3D tracking information (hand

controllers, head, etc.)

– Provide VR camera parameters (two eyes)

– Display rendered images on HMD

• Source and documentationhttps://github.com/ValveSoftware/openvr

• Java binding via JNAhttps://en.wikipedia.org/wiki/Java_Native_Access

25

Page 26: Matthias Zwicker Universität Bern Herbst 2016zwicker/courses... · •Head-mounted displays –Resolution –Binocular depth perception, also called stereopsis (vergence-accommodation

OpenVR

• Basic setup

26

While running

WaitGetPoses to get 3D tracking information

Render left camera using OpenGL

Submit to compositor

Render right camera using OpenGL

Submit to compositor

Update application logic

OpenVR API calls in red

Page 27: Matthias Zwicker Universität Bern Herbst 2016zwicker/courses... · •Head-mounted displays –Resolution –Binocular depth perception, also called stereopsis (vergence-accommodation

OpenGL rendering

• Using camera and projection matrices

provided by OpenVR

• Render into OpenGL frame buffer objecthttps://www.opengl.org/wiki/Framebuffer_Object

– Will not be displayed directly on screen

• Pass rendered image to OpenVR compositor via submit

– OpenVR automatically performs lens pre-

distortion

• Optionally, mirror rendered image to screen (OpenGL glBlitFrameBuffer)

27

Page 28: Matthias Zwicker Universität Bern Herbst 2016zwicker/courses... · •Head-mounted displays –Resolution –Binocular depth perception, also called stereopsis (vergence-accommodation

OpenVR in jrtr

• Encapsulated in jrtr.OpenVRRenderPanel,

jrtr.OpenVRRenderContext

• Some messiness because of JNA access to

native functions and data structures

• Base code provided for VR programming

exercise

– Virtual squash game

– Demo during exercise session

28