1 / 17

What you wi l l l earn about today

What you wi l l l earn about today. C a m e r a s i n O pen GL W h e r e t h is f its i n to w or ld t r a n s for m a ti ons V a r i ou s t yp e s o f c a m e r a s. What i s mov i ng?. f ra m e1. f ra m e3. f ra m e2. Let ’ s E x a mi n e t h e C a mera.

katerinea
Download Presentation

What you wi l l l earn about today

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Whatyouwill learnabouttoday • CamerasinOpenGL • Wherethisfitsintoworldtransformations • Varioustypesofcameras

  2. Whatismoving? frame1 frame3 frame2

  3. Let’s ExaminetheCamera • IfIgaveyouaworld,andsaidIwantto renderitfromanotherviewpoint,whatinformationdoI havetogiveyou? • Position • Whichwaywearelooking • Whichwayis“up” • AspectRatio • FieldofView • NearandFar

  4. glm::lookat Orientsandpositionsthe“camera” lookat(eyex,eyey,eyez, centerx,centery,centerz, upx,upy, upz); eye– thepositionofthecamerainworld coordinates center– thecamerais pointedatthispoint up – thedirectiondefinedtobe up for thecamera

  5. Movingthecamera Howcanwe translatethecamera? add avectortotheeyeand centerparametersHowfarwillthismoveit? thelengthofthevector What happens ifyou don’t changethecenter? thecamerawillstayfixed on theoriginalpoint

  6. Camerawithoutglm::lookat? • Howcanwetranslateand orientthe camerawithout lookat? • inversetransforms:translate(-x,-y,-z);rotate(-angle,a,b,c)Wheredoesthisgo inyouropenGLprogram (using lookatornot)? • usuallyatthebeginningofyourdisplayfunction

  7. Camera:sideview View Right View Up View Normal View Direction

  8. Camera:lookingthroughthe camera View Up View Right What arethevectors?

  9. TransformationWorld->Camera View Right= u 1 0 0 camerax 0 1 0 0 0 1 0 0 0 View Up=V • camera  T y • cameraz    1 nN (n,n ,n) 123 N uV N (u,u ,u ) 123 V N View Direction=-N vnu(v1,v2,v3) u1u2u30 v v v 0 R 3 n1n2n30 0 0 0 1 12   MWCVCRT

  10. FirstPersonCamera • Howisthisimplemented? • Where is the‘eye’? • What is thelook atpoint? • What is up? • up • center • eye

  11. FirstPersonCamera • Howdo we movethecamera? • Addavectorto eyeandcenter up movedir center eye

  12. FirstPersonCamera • Howdo we rotatethecamera? • Move thecenterpoint- add avectortoit • Upvector • Sidevector:lookatx up • center • up • eye

  13. Lookatimplementationoddities • What willhappenifup ==lookatdirection? • Spins aroundtheup axisinaweird way • Whydoesthishappen? • Twoaxesof yourcameraframearealigned! • Howcanwe avoidthis? • Maintainanorthogonalcameraframe-Resettheup vectorusinglookatXside(e.g., morecommoninflight games) • Constrainthelookatdirectiontonot getto closetotheup vector(e.g.,commoninFPSgames) • Use quaternions

  14. 3rd PersonCamera • Howisthisimplemented? • Where is the‘eye’? • What is thelook atpoint? • What is up?

  15. 3rd PersonCamera • Remember,initiallythecamera is • Attheoriginlookingdown–z) • • Same as glm::lookat(0,0,0,0,0,-1,0,1,0) • Howcanthisbemoreeasilyimplemented withoutglm::lookat? • translatethecharactersoyoucanseeit • Drawthecharacter • RotatetheworldaroundYatthefixedpointofthecharacter • Translatetheworldinverselytothecharacterposition • Rendertheworld

  16. BirdsEyeCamera • Howisthisimplemented? • Where is the‘eye’? • • • • What is thelook atpoint? What is up?

  17. Review:Whatyoulearnedabout today • CamerasinOpenGL • Wherethisfitsintoworldtransformation • Thecameratransformisperformedaftertheworld transform • IS THESAMEAS: • Thecamerais alwaysat0,0,0 lookingdown–z • Theworldtransforms instead • Varioustypesofcameras • 1st,3rd, birdseye

More Related