3D in 3D: 3D in 3D: Rendering Rendering anaglyph Bruce Oberg, - - PowerPoint PPT Presentation

3d in 3d 3d in 3d
SMART_READER_LITE
LIVE PREVIEW

3D in 3D: 3D in 3D: Rendering Rendering anaglyph Bruce Oberg, - - PowerPoint PPT Presentation

3D in 3D: 3D in 3D: Rendering Rendering anaglyph Bruce Oberg, anaglyph Bruce Oberg, Programming Lead Programming Lead stereographics stereographics in real- - time time in real Sucker Punch Productions Sucker Punch Productions The


slide-1
SLIDE 1

3D in 3D: 3D in 3D:

Rendering Rendering anaglyph anaglyph stereographics stereographics in real in real-

  • time

time

Bruce Oberg, Bruce Oberg, Programming Lead Programming Lead Sucker Punch Productions Sucker Punch Productions

slide-2
SLIDE 2

The Project The Project

  • Sly 3: Honor Among Thieves

Sly 3: Honor Among Thieves

– – Released in September 2005 Released in September 2005 – – Action / Adventure Action / Adventure – – 1 year in development 1 year in development – – Staff of 52 Staff of 52

  • 22 art

22 art

  • 14 code

14 code

  • 9 test

9 test

  • 3 design

3 design

  • 4 support

4 support

slide-3
SLIDE 3

Anaglyph Stereography Anaglyph Stereography

– – Each eye gets an image from a Each eye gets an image from a slightly different perspective slightly different perspective – – Left eye image drawn in red, Right Left eye image drawn in red, Right eye drawn in cyan eye drawn in cyan – – Red/ Cyan Glasses included in box Red/ Cyan Glasses included in box – – Use not required (7% Use not required (7% -

  • 10%

10% population has inadequate depth population has inadequate depth

  • r color perception)
  • r color perception)

– – Designed into some missions, an Designed into some missions, an unlockable replay mode for others unlockable replay mode for others

slide-4
SLIDE 4

Real Time Anaglyphs in Sly 3 Real Time Anaglyphs in Sly 3

  • Single display list built

Single display list built

– – Frustum culling via standard Frustum culling via standard camera camera

  • Display list submitted twice

Display list submitted twice

– – L/ R Camera matrix patched L/ R Camera matrix patched – – R/ GB Color masking activated R/ GB Color masking activated

  • Effectively halved GPU

Effectively halved GPU frame rate frame rate

slide-5
SLIDE 5

How to do Stereography right How to do Stereography right

  • Cameras

Cameras

– – Frustums and positioning Frustums and positioning

  • Colors

Colors

– – Working with Red/ Cyan Working with Red/ Cyan separation separation

  • Content

Content

– – What works in a scene What works in a scene

  • Cables

Cables

– – Our big mistake Our big mistake

slide-6
SLIDE 6

Cameras Cameras

  • Two cameras pointing

Two cameras pointing exactly in parallel exactly in parallel

  • Separated horizontally (the

Separated horizontally (the “ “ eye distance eye distance” ” ) )

  • Frustums skewed to

Frustums skewed to produce a produce a “ “ stereo window stereo window” ” at the at the “ “ window distance window distance” ”

slide-7
SLIDE 7

Classic Two Camera Stereography Classic Two Camera Stereography

  • Take two pictures from different

Take two pictures from different positions, but pointed in parallel positions, but pointed in parallel

– – Trivially pairing these is usually Trivially pairing these is usually bad bad

  • Stereographers line up some

Stereographers line up some significant figure in the pair, significant figure in the pair, then trim off excess then trim off excess

  • Result establishes a

Result establishes a “ “ stereo stereo window window” ”

  • Anaglyph Examples, but

Anaglyph Examples, but principals hold for other viewing principals hold for other viewing methods methods

slide-8
SLIDE 8

A Simple Stereo Pair A Simple Stereo Pair

slide-9
SLIDE 9

Red/ Cyan filtered Red/ Cyan filtered

slide-10
SLIDE 10

Na Naï ïve pairing ve pairing

slide-11
SLIDE 11

Aligned Aligned

slide-12
SLIDE 12

Aligned and Cropped Aligned and Cropped

slide-13
SLIDE 13

Na Naï ïve vs Aligned ve vs Aligned

slide-14
SLIDE 14

What about Frustums? What about Frustums?

“ Stereo Window Stereo Window” ” cropping cropping effectively skews each effectively skews each Frustum in opposite Frustum in opposite directions directions

  • This skewing establishes a

This skewing establishes a “ “ window distance window distance” ” from the from the cameras, where drawn cameras, where drawn

  • bjects have no parallax
  • bjects have no parallax
slide-15
SLIDE 15

The frustum from above The frustum from above

Far Far Clipping Clipping Plane Plane Near Near Clipping Clipping Plane Plane

slide-16
SLIDE 16

Na Naï ïve Frustum Pair ve Frustum Pair

slide-17
SLIDE 17

Cropping pair trims frustum Cropping pair trims frustum

slide-18
SLIDE 18

Skewed Frustums from Cropping Skewed Frustums from Cropping

slide-19
SLIDE 19

The The “ “ Stereo Window Stereo Window” ” revealed revealed

Everything drawn Everything drawn

  • n this plane
  • n this plane

appears appears coincident in both coincident in both images. images. Stereo Stereo Window Window Distance Distance

slide-20
SLIDE 20

Building Frustums in Sly 3 Building Frustums in Sly 3

  • Pick a stereo window

Pick a stereo window distance (usually the main distance (usually the main character character’ ’s head) s head)

  • Pick an eye distance (more

Pick an eye distance (more

  • n this later)
  • n this later)
  • Translate and skew

Translate and skew projection matrix in two projection matrix in two directions, one for each eye directions, one for each eye

slide-21
SLIDE 21

Sly 3 Stereo Matrix Code Sly 3 Stereo Matrix Code

void CCm: : StereoMatrices(STEREO stereo, MATRIX4 * pmatWorldToCli void CCm: : StereoMatrices(STEREO stereo, MATRIX4 * pmatWorldToClip) p) { { / / new eye position is to the left or right / / new eye position is to the left or right float float sStereo = 0.0f; sStereo = 0.0f; switch (stereo) switch (stereo) { { case STEREO_Left: case STEREO_Left: sStereo = m_sStereoEye; sStereo = m_sStereoEye; break; break; case STEREO_Right: case STEREO_Right: sStereo = sStereo = -

  • m_sStereoEye;

m_sStereoEye; break; break; } } / / / / build skew matrix for this eye offset and the build skew matrix for this eye offset and the “ “ stereo window stereo window” ” distance distance MATRIX4 matSkew = MAT_Identity; MATRIX4 matSkew = MAT_Identity; matSkew.aag[ 2] [ 0] = matSkew.aag[ 2] [ 0] = -

  • sStereo / m_sStereoFocus;

sStereo / m_sStereoFocus; matSkew.aag[ 3] [ 0] = sStereo; matSkew.aag[ 3] [ 0] = sStereo; / / / / folding the skew matrix into the projection matrix folding the skew matrix into the projection matrix MATRIX4 matProjSkewed = m_matProj * matSkew; MATRIX4 matProjSkewed = m_matProj * matSkew; / / / / Combine world and skewed projection matrix Combine world and skewed projection matrix CombineEyeProj(MatWorld(), matProjSkewed, pmatWorldToClip); CombineEyeProj(MatWorld(), matProjSkewed, pmatWorldToClip); } }

slide-22
SLIDE 22

Close Window = = Strong Parallax Close Window = = Strong Parallax

slide-23
SLIDE 23

Minimizing the puke factor Minimizing the puke factor

  • Too much parallax makes

Too much parallax makes 3D effect harder to see (and 3D effect harder to see (and may make people sick) may make people sick)

  • Solution: change eye

Solution: change eye separation to compensate separation to compensate for large parallax for large parallax

  • Smoothing all transitions

Smoothing all transitions keeps the effect from begin keeps the effect from begin jarring jarring

slide-24
SLIDE 24

Colors Colors

  • Any color with too much red or

Any color with too much red or green/ blue will cause retinal rivalry green/ blue will cause retinal rivalry

  • Whites, grays, yellows, magentas

Whites, grays, yellows, magentas work best work best

  • Sly 3 reloaded levels when entering

Sly 3 reloaded levels when entering 3D mode, desaturating and 3D mode, desaturating and brightening colors at load time brightening colors at load time

  • Result: greyer and brighter levels,

Result: greyer and brighter levels, ensuring color content for both eyes ensuring color content for both eyes

  • Color adjustments were tweakable

Color adjustments were tweakable

slide-25
SLIDE 25

One color problem One color problem

slide-26
SLIDE 26

Content Content

  • Vertical Edges

Vertical Edges

– – Our most effective level was a forest of thin Our most effective level was a forest of thin trees trees

  • Near and far objects

Near and far objects

– – Objects on both sides of stereo window Objects on both sides of stereo window reinforce stereo effect reinforce stereo effect

  • High resolution textures and models

High resolution textures and models

– – Stereography can show details and Stereography can show details and subtleties subtleties… … ask the Mars Rover team ask the Mars Rover team

  • NOT: Racing scenarios

NOT: Racing scenarios

– – Depth cues moving too fast? Depth cues moving too fast?

slide-27
SLIDE 27
slide-28
SLIDE 28

Cables Cables

  • Video bandwidth matters

Video bandwidth matters

– – RF and Composite (single yellow RF and Composite (single yellow RCA) compress image, distorting RCA) compress image, distorting colors and brightness (your frame colors and brightness (your frame buffer RGB does not survive) buffer RGB does not survive) – – S S-

  • Video cables better

Video cables better – – Composite cables the best Composite cables the best

  • Our biggest error

Our biggest error

– – Not including in Not including in-

  • game cable

game cable information or display calibration information or display calibration (Spy Kids DVD does this) (Spy Kids DVD does this)

  • Result: Many customers had a

Result: Many customers had a so so-

  • so experience

so experience

slide-29
SLIDE 29

What we What we’ ’ve learned ve learned

  • Cameras Matter

Cameras Matter

– – Both stereo window and parallax Both stereo window and parallax angle should be determined angle should be determined carefully carefully

  • Colors Matter

Colors Matter

– – Grayscales, yellows, magentas are Grayscales, yellows, magentas are best best

  • Content Matters

Content Matters

– – Vertical edges, near/ far objects, Vertical edges, near/ far objects, and and detail detail

  • Cables Matter

Cables Matter

– – Educate your customers Educate your customers

slide-30
SLIDE 30

Questions? Answers! Questions? Answers!

www.suckerpunch.com local.wasp.uwa.edu.au/ ~ pbourke/ projection