9 camera models

Upload: akshay-mehta

Post on 04-Feb-2018

222 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/21/2019 9 Camera Models

    1/45

    Introduction to Computer Graphics

    Camera ModelsCamera Models

  • 7/21/2019 9 Camera Models

    2/45

    Rendering with Natural Light

  • 7/21/2019 9 Camera Models

    3/45

    Fiat Lux

  • 7/21/2019 9 Camera Models

    4/45

    Light Stage

  • 7/21/2019 9 Camera Models

    5/45

    Moving the Camera or the World?

    Two equivalent operationsTwo equivalent operations

    Initial OpenGL camera position is at origin, looking along -ZInitial OpenGL camera position is at origin, looking along -Z

    Now create a unit square parallel to camera at z = -10Now create a unit square parallel to camera at z = -10

    I we put a z-translation matri! o " on stack, w#at #appens$I we put a z-translation matri! o " on stack, w#at #appens$% &amera mo'es to z = -"&amera mo'es to z = -"

    Note OpenGL mo(els 'iewing in let-#an( coor(inatesNote OpenGL mo(els 'iewing in let-#an( coor(inates

    %&amera sta)s put, *ut square mo'es to -+&amera sta)s put, *ut square mo'es to -+

    Image at camera is t#e same wit# *ot#Image at camera is t#e same wit# *ot#

  • 7/21/2019 9 Camera Models

    6/45

    !" Scene

    Notice the presence ofNotice the presence ofthe camera, thethe camera, the

    projection plane, andprojection plane, and

    the worldthe world

    coordinate axescoordinate axes

    Viewing transformations define how to acquire the imageViewing transformations define how to acquire the image

    on the projection planeon the projection plane

  • 7/21/2019 9 Camera Models

    7/45

    #iewing $rans%ormations

    Goal: To create a cameracentered viewGoal: To create a cameracentered view

    Camera is at originCamera is at origin

    Camera is loo!ing along negative "axisCamera is loo!ing along negative "axisCamera#s $up# is aligned with %axisCamera#s $up# is aligned with %axis &what does this mean'(&what does this mean'(

  • 7/21/2019 9 Camera Models

    8/45

  • 7/21/2019 9 Camera Models

    9/45

    & 'asic Steps

    )tep -: Translate to align world and camera)tep -: Translate to align world and camera

    originsorigins

  • 7/21/2019 9 Camera Models

    10/45

  • 7/21/2019 9 Camera Models

    11/45

    Constructing #iewing

    $rans%ormation( #

    Create a vector from e%epoint to loo!atpointCreate a vector from e%epoint to loo!atpoint

    Normali"e the vectorNormali"e the vector

    3esired rotation matrix should map this vector3esired rotation matrix should map this vector

    to 45, 5, *6to 45, 5, *6TT 7h%'7h%'

  • 7/21/2019 9 Camera Models

    12/45

    Constructing #iewing

    $rans%ormation( #

    Construct another important vector from theConstruct another important vector from thecross product of the loo!atvector and the vupcross product of the loo!atvector and the vup

    vectorvector

    This vector, when normali"ed, should align withThis vector, when normali"ed, should align with

    4*, 5, 564*, 5, 56TT7h%'7h%'

  • 7/21/2019 9 Camera Models

    13/45

    Constructing #iewing

    $rans%ormation( #

    8ne more vector to define98ne more vector to define9

    This vector, when normali"ed, should align with 45, *, 56This vector, when normali"ed, should align with 45, *, 56TT

    Now let#s compose the resultsNow let#s compose the results

  • 7/21/2019 9 Camera Models

    14/45

    Composing Matrices to Form #

    7e !now the three world axis vectors &x, %, "(7e !now the three world axis vectors &x, %, "(

    7e !now the three camera axis vectors &u, v, n(7e !now the three camera axis vectors &u, v, n(

    Viewing transformation, V, must convert from world toViewing transformation, V, must convert from world to

    camera coordinate s%stemscamera coordinate s%stems

  • 7/21/2019 9 Camera Models

    15/45

    Composing Matrices to Form #

    .ememer.ememer ac# camera a!is 'ector is unit lengt#ac# camera a!is 'ector is unit lengt#

    ac# camera a!is 'ector is perpen(icular to ot#ersac# camera a!is 'ector is perpen(icular to ot#ers

    Camera matrix is orthogonal and normali"edCamera matrix is orthogonal and normali"ed

    Ort#onormalOrt#onormal

    Therefore, MTherefore, M**0 M0 MTT

  • 7/21/2019 9 Camera Models

    16/45

    Composing Matrices to Form #

    Therefore, rotation component of viewingTherefore, rotation component of viewingtransformation is just transpose of computedtransformation is just transpose of computed

    vectorsvectors

  • 7/21/2019 9 Camera Models

    17/45

    Composing Matrices to Form #

    Translation component tooTranslation component too

    Multipl% it throughMultipl% it through

  • 7/21/2019 9 Camera Models

    18/45

    Final #iewing $rans%ormation( #

    To transform vertices, use this matrix:To transform vertices, use this matrix:

    +nd %ou get this:+nd %ou get this:

  • 7/21/2019 9 Camera Models

    19/45

    Canonical #iew #olume

    + standardi"ed viewing volume representation+ standardi"ed viewing volume representation

    /arallel &8rthogonal( /erspective/arallel &8rthogonal( /erspective

    x or y

    -z

    x or y

    -z

    1

    -1

    -1

    Front

    Plane

    Front

    Plane

    Back

    Plane

    Back

    Plane

    x or y = +/- z

  • 7/21/2019 9 Camera Models

    20/45

    Wh) do we care?

    Canonical View Volume /ermits )tandardi"ationCanonical View Volume /ermits )tandardi"ation &lipping&lipping

    % asier to (etermine i an ar*itrar) point is enclose( inasier to (etermine i an ar*itrar) point is enclose( in

    'olume'olume% &onsi(er clipping to si! ar*itrar) planes o a 'iewing&onsi(er clipping to si! ar*itrar) planes o a 'iewing

    'olume 'ersus canonical 'iew 'olume'olume 'ersus canonical 'iew 'olume

    .en(ering.en(ering

    % /roection an( rasterization algorit#ms can *e reuse(/roection an( rasterization algorit#ms can *e reuse(

  • 7/21/2019 9 Camera Models

    21/45

    *ro+ection Normali,ation

    8ne additional step of standardi"ation8ne additional step of standardi"ation &on'ert perspecti'e 'iew 'olume to ort#ogonal 'iew 'olume&on'ert perspecti'e 'iew 'olume to ort#ogonal 'iew 'olume

    to urt#er stan(ar(ize camera representationto urt#er stan(ar(ize camera representation

    % &on'ert all proections into ort#ogonal proections *)&on'ert all proections into ort#ogonal proections *)(istorting points in t#ree space actuall) our space(istorting points in t#ree space actuall) our space

    *ecause we inclu(e #omogeneous coor( w2*ecause we inclu(e #omogeneous coor( w2

    3istort o*ects using transormation matri!3istort o*ects using transormation matri!

  • 7/21/2019 9 Camera Models

    22/45

    *ro+ection Normali,ation

    uilding a transformationuilding a transformationmatrixmatrix

    4ow (o we *uil( a matri! t#at4ow (o we *uil( a matri! t#at

    % 5arps an) 'iew 'olume to5arps an) 'iew 'olume to

    canonical ort#ograp#ic 'iewcanonical ort#ograp#ic 'iew

    'olume'olume

    % /ermits ren(ering wit#/ermits ren(ering wit#

    ort#ograp#ic cameraort#ograp#ic camera

    +ll scenes rendered+ll scenes renderedwith orthographicwith orthographic

    cameracamera

  • 7/21/2019 9 Camera Models

    23/45

    *ro+ection Normali,ation - .rtho

    Normali"ing 8rthographic CamerasNormali"ing 8rthographic Cameras Not all ort#ograp#ic cameras (eine 'iewing 'olumes o rig#tNot all ort#ograp#ic cameras (eine 'iewing 'olumes o rig#t

    size an( location canonical 'iew 'olume2size an( location canonical 'iew 'olume2

    6ransormation must map76ransormation must map7

  • 7/21/2019 9 Camera Models

    24/45

    *ro+ection Normali,ation - .rtho

    Two stepsTwo steps 6ranslate center to 0, 0, 026ranslate center to 0, 0, 02

    % 8o'e ! *) %!8o'e ! *) %!ma!ma!9 !9 !minmin2 : ;2 : ;

  • 7/21/2019 9 Camera Models

    25/45

    *ro+ection Normali,ation - *ersp

    /erspective Normali"ation is Tric!ier/erspective Normali"ation is Tric!ier

  • 7/21/2019 9 Camera Models

    26/45

    *erspective Normali,ation

    Consider N0Consider N0

    +fter multipl%ing:+fter multipl%ing:

    p = Npp = Np

    0100

    00

    00100001

  • 7/21/2019 9 Camera Models

    27/45

    *erspective Normali,ation

    +fter dividing % w#, p# ; p##+fter dividing % w#, p# ; p##

  • 7/21/2019 9 Camera Models

    28/45

    *erspective Normali,ation

  • 7/21/2019 9 Camera Models

    29/45

    *erspective Normali,ation

    7hat aout "'7hat aout "' i z = zi z = zma!ma!

    i z = zi z = z

    minmin

    -1 an( zma! ->1suc# t#at zmin -> -1 an( zma! ->1

    .esulting z is nonlinear, *ut preser'es or(ering o points.esulting z is nonlinear, *ut preser'es or(ering o points

    % I zI z11? z? z;;@ z@ z11? z? z;;

  • 7/21/2019 9 Camera Models

    30/45

    *erspective Normali,ation

    7e did it= 1sing matrix, N7e did it= 1sing matrix, N /erspecti'e 'iewing rustum transorme( to cu*e/erspecti'e 'iewing rustum transorme( to cu*e

    Ort#ograp#ic ren(ering o cu*e pro(uces same image asOrt#ograp#ic ren(ering o cu*e pro(uces same image as

    perspecti'e ren(ering o original rustumperspecti'e ren(ering o original rustum

  • 7/21/2019 9 Camera Models

    31/45

    Color

    Next topic:Next topic: &olor&olor

    6o un(erstan( #ow to make realistic images, we nee( a6o un(erstan( #ow to make realistic images, we nee( a

    *asic un(erstan(ing o t#e p#)sics an( p#)siolog) o*asic un(erstan(ing o t#e p#)sics an( p#)siolog) o'ision 4ere we step awa) rom t#e co(e an( mat# or a *'ision 4ere we step awa) rom t#e co(e an( mat# or a *

    to talk a*out *asic principlesto talk a*out *asic principles

  • 7/21/2019 9 Camera Models

    32/45

  • 7/21/2019 9 Camera Models

    33/45

    'asics o% Color

    /h%sics:/h%sics: IlluminationIllumination

    % lectromagnetic spectralectromagnetic spectra

    .election.election

    % 8aterial properties8aterial properties%

  • 7/21/2019 9 Camera Models

    34/45

    *h)siolog) o% #ision

    The e%e:The e%e:

    The retinaThe retina

    .o(s.o(s

    &ones&ones

    % &olorA&olorA

  • 7/21/2019 9 Camera Models

    35/45

    *h)siolog) o% #ision

    The center of the retina is a densel% pac!edThe center of the retina is a densel% pac!edregion called theregion called the %ovea%ovea==

    &ones muc# (enser #ere t#an t#e&ones muc# (enser #ere t#an t#e peripheryperiphery

  • 7/21/2019 9 Camera Models

    36/45

  • 7/21/2019 9 Camera Models

    37/45

    *h)siolog) o% #ision/ $he Retina

    )trangel%, rods and cones are)trangel%, rods and cones areat theat the 0ac10ac1of the retina,of the retina,ehind a mostl%transparentehind a mostl%transparentneural structure thatneural structure that

    collects their response=collects their response=http:??www=trueorigin=org?retina=asphttp:??www=trueorigin=org?retina=asp

  • 7/21/2019 9 Camera Models

    38/45

    *erception/ Metamers

    + given perceptual sensation of color derives+ given perceptual sensation of color derivesfrom the stimulus of all three cone t%pesfrom the stimulus of all three cone t%pes

    2dentical perceptions of color can thus e caused2dentical perceptions of color can thus e caused% ver% different spectra% ver% different spectra

  • 7/21/2019 9 Camera Models

    39/45

    *erception/ .ther Gotchas

    Color perception is also difficult ecause:Color perception is also difficult ecause: It 'aries rom person to personIt 'aries rom person to person

    It is aecte( *) a(aptation stare at a lig#t *ul*@ (ont2It is aecte( *) a(aptation stare at a lig#t *ul*@ (ont2

    It is aecte( *) surroun(ing color7It is aecte( *) surroun(ing color7

  • 7/21/2019 9 Camera Models

    40/45

    *erception/ Relative Intensit)

    7e are not good at judging asolute intensit%7e are not good at judging asolute intensit%@et#s illuminate pixels with white light on scale of 5 *=5@et#s illuminate pixels with white light on scale of 5 *=5

    2ntensit% difference of neighoring colored rectangles2ntensit% difference of neighoring colored rectangleswith intensities:with intensities:

    010 -> 011 10E c#ange2010 -> 011 10E c#ange2 0C0 -> 0CC 10E c#ange20C0 -> 0CC 10E c#ange2

    will loo! the samewill loo! the same

    7e perceive7e perceive relativerelativeintensities, not asoluteintensities, not asolute

  • 7/21/2019 9 Camera Models

    41/45

    Representing Intensities

    .emaining in the world of lac! and white9.emaining in the world of lac! and white91se photometer to otain min and max rightness of1se photometer to otain min and max rightness of

    monitormonitor

    This is theThis is the d%namic ranged%namic range

    2ntensit% ranges from min, 22ntensit% ranges from min, 255, to max, *=5, to max, *=5

    Aow do we represent -B shades of gra%'Aow do we represent -B shades of gra%'

  • 7/21/2019 9 Camera Models

    42/45

    Representing Intensities

    >qual distriution etween min and max fails>qual distriution etween min and max fails

    relati'e c#ange near ma! is muc# smaller t#an near Irelati'e c#ange near ma! is muc# smaller t#an near I00

    !7 F, , H, 1!7 F, , H, 1

    /reserve D change/reserve D change

    !7 1:, F, , 1!7 1:, F, , 1

    IInn= I= I00J rJ rnnII00, n > 0, n > 0

    2255020255

    22**0 r20 r255

    22--0 r20 r2**0 r0 r--2255

    99

    22-BB-BB0r20r2-BE-BE0r0r-BB-BB2255

  • 7/21/2019 9 Camera Models

    43/45

    ")namic Ranges

    3%namic .ange3%namic .ange

    Max F ofMax F of

    3ispla% 3ispla% &max ? min illum(&max ? min illum(/erceived/erceived2ntensities &r0*=5*(2ntensities &r0*=5*(

    C.T:C.T: B5-55B5-55 E55B5E55B5

    /hoto &print(/hoto &print( *55*55 EBEB

    /hoto &slide(/hoto &slide( *555*555 H55H55

    ?7 printout?7 printout *55*55 EBEB

    Color printoutColor printout B5B5 E55E55

    NewspaperNewspaper *5*5 -E-E

  • 7/21/2019 9 Camera Models

    44/45

    Gamma Correction

    ut most displa% devices are inherentl% nonlinear:ut most displa% devices are inherentl% nonlinear:2ntensit% 02ntensit% 0 11&voltage(&voltage(

    ie, *rig#tness J 'oltage A= ;J*rig#tness2 J 'oltage:;2ie, *rig#tness J 'oltage A= ;J*rig#tness2 J 'oltage:;2

    is *etween ;; an( ;C on most monitorsis *etween ;; an( ;C on most monitors

    Common solution:Common solution: gamma correctiongamma correction

    /ost-transormation on intensities to map t#em to linear range on/ost-transormation on intensities to map t#em to linear range on

    (ispla) (e'ice7(ispla) (e'ice7

    &an #a'e separate&an #a'e separate or ., G, Kor ., G, K 1

    xy =

  • 7/21/2019 9 Camera Models

    45/45

    Gamma Correction

    )ome monitors perform the gamma correction in)ome monitors perform the gamma correction inhardware &)G2#s(hardware &)G2#s(

    8thers do not &most /Cs(8thers do not &most /Cs(

    Tough to generate images that loo! good on othTough to generate images that loo! good on othplatforms &i=e= images from we pages(platforms &i=e= images from we pages(