electronic visualization laboratory, university of illinois at chicago stereoscopic computer...

35
electronic visualization laboratory, university of illinois a Stereoscopic Computer Graphics CS426 Jason Leigh © 2004-2012 Electronic Visualization Laboratory

Upload: ashley-eleanor-page

Post on 17-Dec-2015

221 views

Category:

Documents


1 download

TRANSCRIPT

electronic visualization laboratory, university of illinois at chicago

Stereoscopic Computer Graphics

CS426Jason Leigh

© 2004-2012Electronic Visualization Laboratory

electronic visualization laboratory, university of illinois at chicago

• 4-10% of population cannot see stereopsis.

• Other cues come into play to provide sense of depth.

• Try to take advantage of those in addition to stereopsis for best results.

electronic visualization laboratory, university of illinois at chicago

Depth CuesPerceiving “depth” with one eye closed

• Perspective.Objects get smaller the further away they are and parallel line converge in distance.

• Sizes of known objects.We expect certain object to be smaller than others. If an elephant and a tea cup appear the same size then we expect the elephant to be further away.

• Detail.Close objects appear in more detail, distant objects less.

• Occlusion.An object that blocks another is assumed to be in the foreground.

• Lighting, shadows.Closer objects are brighter, distant ones dimmer. There a number of other more subtle cues implied by lighting, the way a curved surface reflects light suggests the rate of curvature, shadows are a form of occlusion.

• Relative motion.Objects further away seem to move more slowly than objects in the foreground.

electronic visualization laboratory, university of illinois at chicago

Using both eyes

• Binocular disparity.This is the difference in the images projected onto the back of the eye (and then onto the visual cortex) because the eyes are separated horizontally by the interocular distance.

• Only good to about 15-20 feet. • Accommodation.

This is the muscle tension needed to change the focal length of the eye lens in order to focus at a particular depth.

• Convergence.This is the muscle tension required to rotate each eye so that it is facing the focal point.

• For STEREOSCOPIC Computer Graphics the “3D” effect is achieved through Binocular Disparity.

electronic visualization laboratory, university of illinois at chicago

Ways of Seeing Stereoscopic Content

electronic visualization laboratory, university of illinois at chicago

Free Viewing

In general you are creating 2 views (one for each eye).This means your graphics card needs to render the scene twice.

electronic visualization laboratory, university of illinois at chicago

Anaglyphic Stereo

electronic visualization laboratory, university of illinois at chicago

Stereoscopes

electronic visualization laboratory, university of illinois at chicago

CAVE - 1992

Active Stereo LCD Shutter glassesUniversity of Illinois at Chicago

electronic visualization laboratory, university of illinois at chicago

GeoWall - 2001

electronic visualization laboratory, university of illinois at chicago

Varrier - 2005

electronic visualization laboratory, university of illinois at chicago

Cyber-Commons 3D - 2011

University of Illinois at Chicago

electronic visualization laboratory, university of illinois at chicago

CAVE 2 – Oct 2012

University of Illinois at Chicago

electronic visualization laboratory, university of illinois at chicago

Positive Parallax

The left and right eye images projected on the screen

electronic visualization laboratory, university of illinois at chicago

Negative Parallax

• If Objects are too close in front of the projection plane, negative parallax will increase.

• If negative parallax is wider than eye separation, then result is pain.

electronic visualization laboratory, university of illinois at chicago

Zero Parallax(when the object is actually on the screen)

electronic visualization laboratory, university of illinois at chicago

Correct Stereo Computer Graphics

Asymmetric View Frustum

electronic visualization laboratory, university of illinois at chicago

Stereo Approximation

LeftEye

RightEye

Projection Planes are not the same

• There is potential for eye discomfort for objects that are too close because an object may appear to be cut off at the edges for one of the eyes.

• Enlarging eye separation makes the problem worse.

electronic visualization laboratory, university of illinois at chicago

Making the graphics looktrue to size regardless of screen size

• Set camera properties to be the same as real world properties:– Set user’s distance to screen (ie focal length d)– Measure the screen’s height (h)– Compute the field of view (f = 2*atan(h/2d))– Use real world eye separation distance (2.5 inches)

LeftEye

RightEye

dh

f

E.g. A 1 foot object should appear to be the right size regardless of screen size.

electronic visualization laboratory, university of illinois at chicago

Small screen

Big screen

electronic visualization laboratory, university of illinois at chicago

In Movies and Video Games True Size is Generally Never Used

Yoda is not 30 feet tall…

electronic visualization laboratory, university of illinois at chicago

Note the separation of 2 points on an image here

Eyes

Lets say you created a stereo image for a small desktop display…

In 3D Things Can Get Painful

electronic visualization laboratory, university of illinois at chicago

Eyes

… then you decide to run your application on a BIG display!

Same can happen if you sit too close in a 3D movie

electronic visualization laboratory, university of illinois at chicago

General Recommendation

• General guideline is make eye separation no more than 1/20 of d

• This gives us an angle of about 1.5 degreesi.e. atan(1/20/2 / d)

1/20 of d

d

electronic visualization laboratory, university of illinois at chicago

General Recommendation

• Same therefore goes for any object in the scene.• It should not project an image on the screen of size DX that is

larger than your eye separation.• t = 2 atan(DX / 2d)

t

electronic visualization laboratory, university of illinois at chicago

Say an object is too close…Now t >> 1.5And DX >> Eye Separation

DX Eye

Separation

• But remember for large screens DX will be big.• So you really have to be conservative about

how close you can put your object.• Often you will hear recommendations of setting

eye separation to 1/30 or 1/100

electronic visualization laboratory, university of illinois at chicago

Tips

• Use 2D depth cues.• When using 3D it’s safest to put objects behind the screen –

but not too far or the depth effect is lost.• Bring objects in front of projection screen sparingly and be

careful how close they come. • Be careful with wild camera swings.• Your game may slow down as much as by half to render the

second eye.• Keep eye separation at no more than 1/20 the distance to

projection screen or object.• Test your game on the target display platform don’t assume it

will just look fine..

electronic visualization laboratory, university of illinois at chicago

OLD SLIDES

electronic visualization laboratory, university of illinois at chicago

Stereo in Unity3D

electronic visualization laboratory, university of illinois at chicago

Ways of Seeing Stereo

Passive Stereo GeoWall

Active Stereo LCD Shutter glasses

Passive Stereo LCD

Autostereo LCD (Varrier)

electronic visualization laboratory, university of illinois at chicago

Stereo in Electro

• electro.exe -f config/geowall-side-by-side-config.lua …..• set_camera_stereo(camera, mode, Lx, Ly, Lz, Rx, Ry, Rz)• Set stereo options on the given camera. The mode

argument gives the stereo method, as described below. The (Lx, Ly, Lz) and (Rx, Ry, Rz) arguments give the offsets from the camera to the user's left and right eyes.

• Available stereo modes :– stereo_mode_none– stereo_mode_tile - GeoWall side-by-side stereo– stereo_mode_quad - LCD shutter glasses stereo– stereo_mode_red_blue - red/blue stereo– stereo_mode_varrier_11, * stereo_mode_varrier_33 - autostereo

electronic visualization laboratory, university of illinois at chicago

GeoWall Stereo Config for Electro• W = 5.1666 -- The Geowall in the AG Room is 5'2"• H = 4.1666 -- by 4'2".• D = 10.0000 -- The ideal viewing position is 10' from the center.• O = 0.15 -- The interocular distance• S = 8 -- orthagonal camera pixel seperation (hack)

• w = 2048• h = 768• ------------------------------------------------------------------------------• tile = { }

• host = E.add_host("default", 0, 0, w, h)• tile[1] = E.add_tile(host, 0, 0, w / 2, h)• tile[2] = E.add_tile(host, w / 2, 0, w / 2, h)

• E.set_tile_position(tile[1], -W / 2, -H / 2, -D, W, 0.0, 0.0, 0.0, H, 0.0)• E.set_tile_position(tile[2], -W / 2, -H / 2, -D, W, 0.0, 0.0, 0.0, H, 0.0)

• E.set_tile_viewport(tile[1], S, 0, w / 2, h)• E.set_tile_viewport(tile[2], -S, 0, w / 2, h)

• E.set_tile_view_offset(tile[1], -O / 2, 0, 0)• E.set_tile_view_offset(tile[2], O / 2, 0, 0)

• E.set_host_flags(host, E.host_flag_full, true)

electronic visualization laboratory, university of illinois at chicago

Stereo API in BlitzGeoWallStereoLib.bb

• 3 Main Calls:• 1. Create 2 cameras and return the main camera

(left camera)– mainCamera = SL_CreateStereoCameras()

• 2. Set up the stereo camera viewports– SL_SetUpCameras()– SL_SetEyeSeparation(separationValue#)

• 3. Update stereo cameras just before each Render call (basically to update the right camera)– SL_Update()

electronic visualization laboratory, university of illinois at chicago

Other Useful Calls

• Call these only if for some reason you want to manually create each camera– Camera=SL_CreateLeftCamera()– Camera=SL_CreateRightCamera()

• Call this if you have your own cameras created and want to use them as the stereo cameras– SL_SetLeftCamera(camera)– SL_SetRightCamera(camera)

• Just accessor functions– Camera=SL_GetLeftCamera()– Camera=SL_GetRightCamera()

• Switch to monoscopic viewing– SL_SwitchToMono()

• Switch to Stereo viewing– SL_SwitchToStereo()

• Use this to set near correct scaled stereo. Ie. A 1 foot object will appear 1 foot in size on the screen given the height and distance to the screen.– SL_SetUpCorrectScaleStereo(screenWidth#, screenHeight#,

distanceToScreen#)

electronic visualization laboratory, university of illinois at chicago

Final Comments

• Use the

BLITZ_GEOWALL_GAME_ENGINE_TEMPLATE to begin writing your own Blitz3D GeoWall Stereo Program

• Template includes both stereo calls and proper game loop with Tweening.