0% found this document useful (0 votes)
25 views24 pages

Unit 3 CG

Uploaded by

Priyanka
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
25 views24 pages

Unit 3 CG

Uploaded by

Priyanka
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 24
UNIT € Syllabue q ¥ clacettal and computer ee FP Viewmg with & computer, e portion g the Camera 4 Serople projections . Y projections in open gr. + Helden sunpace Removal ¥ tnteractrre mesh Dosplays + paralte/ prajechien roatyioes | ¥ Perspective Prafectron mate ces | ¥ prepections and Shadows , ~ THlours Ahab; Fuman & VIVERAMAND SA INST) TUIe OF TEC VTUPianet [etaseread AND COMPUTER VIEWING) + Mere ave four types of clactical views ( profectans ) a snopraphic Projectrons As Axonomestric PTY eC Hong | 2. oblique a ees 4 pevepective Pryections | pogaphte projection FIN all obthographic vaws, the Prapectore are Pempendieular 70 the prapecteon plane. * Fig shows obtnegraphic grep Prefection . 4 Uceealty three Views are used in AN Ortho raphe a, fo Weplay the obs ecg “front View ~ Top ‘ee Side view side view Ady sip preserves both dictancee and anghe , Since tpeve i no Atetortion > (FL well Surbed [or ald drawings, A x0 naetrle_projecons YoU es guch a Projection In Which ‘the Projector te sty oT thogonal to the Projection plone | but the Presectiy plore can hare an onlentation Wt the object. Citing thie vi v E tT thé. ew, move than one Principle g the ob] eek would po verble , fy VTUPlanet Pe tf the pryectton plane ws placed syrmmetr cally wired the three primetpat paces that meet at a comer v1 our rechangular objeck, Phen we haye an war (sometere vey ¥ Y the projection plane ts placed syrmmetrcaly wrt two a the prinerpa pacer, then the vrew ig ad 4 the general cate fe a trleme a \ pane Dimetric | a ‘| | a” 7 1 tn E, Pxonume frte Cares) projection Momepere , Pbligue propecho gift i one of the Mbt general eg Profeetone, ¥ Mis propection te ebtarned by allowing the Prijectore to make an arbyerary angle with ime profectin plane | 4 Angles of the objects pace that are parallel to the ae plane ove preserved + obeque views ( projection) are moe leg frente to Construcy bq hand. they are Somewhat unnatural. Z / : Aa oblique Wiew « her eianet Fi ob ¢ ylewing , tit Suh & ct IN Which the Viewer ie loca hed eed, wit the projection plane» Au perspective Projectors are characterized by dirimution, of 612e # when objec are moved farther thelr images become Maller, Fit £1ze change gives perepectrye Projection fis naturel Appearance Hence ie ie rordely uted in architecture and animation om the Vitwer, ft figure Shows erepectre projections, ¥ there are three ty pet of per specinve views = ane point porepective ~ two point Perspect ive ~ three pout perspective . based on hew many RB. >]. the thee parerpal directions in the object are parallel to “the Prejechon plone | tl most general case, Sapo perspective, the Paralle| tings 7 20th of the three incipal ditectrons converge at me pont catted «vanishing PrP ty (@)> # tn ge point perspective, inec im onty two q the principal direction’ converge at vantshing points. < tyt> Fin Lpuink perspective , two J the Prine pal directeng cunverge AY a eengle vantenng port fFyVTUPlanet 3 point a port pome peg 19 OD) Hy w nope: planar Projeenong a Movane) : perspective a \ 4» oblique ortios raphe Ipomt 9 pornp 3 po Ing NN fret Side To, PXonomepsic Whew) vlely View MIE WING ¥ Vrewrng 4eing computers involve two findomental operarions h aeag and eee) the cameya whith can be atheeved ba using the mode} view matrix - 4 A COmpureg| | fa. Application of the projechm -rans{ormatien . fe porate prajection ov are mee Prejechon whith Can be achieved ung Preopechon matrix Une op Pry @ fy VTUPlanet [POSITIONING OF THE CAMERA | # Camera can be pocitroned using open GL be modi ying ‘the model -Vilwr matrix the modet view matrix (an eee game and the object jrame ’ initially ratrin and hence the Camera would be (dentital af £hown below, [pea “" 5 () z y movement of camera and object frames. Ca) tnitel aes Ob) Conpguration ater change ID Model —VleWe matrix 2,Ze ¥ wlth re cad arrangement, all the objects present in the ¢cene may not be vuKtble ang hente we wilh have fo Change Me model-view ratsra Sultably 4 posttion the Camera at the desired focation, (reper Fae) ye Suppose that the uter Le Moteretted 17 Viewsng tf the object jem the -ve zaxls, En the Camera can be postttonedt using , IMatrixMode Cae. moper VIEW); gllvad Identity ¢); fitranciate C00, bo, «as fy Vue! anet _— egd: Cuppote that user kk interested In looting at the " “come object vom tre 2% Quit. han the camera can be podttruned using, qiMatritMode C6L-moselview ); qltoad Edentiy 00; gl Pravclate ¢ C0.0, 0-0, +d); qtRotate C ~90.0, 0, ho, 0); obtain aN jometrie view of the cube when I entered at the ortgin and alramed with the anes 7 we must place the cometa angwhere along the tine Jrom the wr ‘through the poinh Ctr,7). This Can be Achwvod acing, IMatrixMeode (Ge. Moder View); gi tead Tdentity C): jlhranstatey Coo, 010, -d J; glRotate Cts. 9, 0:0, 1:0, 0.0): qlRotake 026.26, 10, 0-0, ay: ¥ fheve tt an altogether ay jerent appreach thak can be used to position the camera, thie approach is ugec in PHlgs and fxs -2p Cwhich wore one oF te earliest 7 haphees pactages ). the steps followed are: l. [he Camera (& acsumed to be (ntta lly past troned ar origin, Jointing inthe ~¥e Z dltrecten, 4S alesired location ic ryerred to ac the yew leferente point (YRAI which can be fpectf red at follows fy VTUPlanet Set. view _welerenre pome (x ui ride ® orientation f the Camera con be SPeeivied using the Vieeo plane-normal (VPM) ating , web. veew. plane~noimal Cnt, ng nel; 2: fhe up direction po» the perspective 4 the Camera tan be specified acing the vow-up(vup) a4 thown below, set-vrew- up C Vpn, vuh gy, vup-z) s ¥ Another approath ff fo tute the lookAt Junchen as shown béfow, gi MarrixM ode CG L-MopeL view) 5 gl toad (dent ty C); qiadoonat Ceger, ‘yey 1 Yee, att, aby , alz, Pe MPY Ope): [+ dehine objects heve af 4 Another appreath ts to pec y the Azimuth and the fl st angle to poston the camera, [fmne_ prove ct tere are two types 4 simple Projections ~ perspective a 2chony : parallel Corthepeapial) Priyectons . fy VTUPlanet er _peeepective projection . : ¥ Suppece that the Comera (6 located ab the ottgin pomting in the negative Zz vderectin Docume thar the Pecan plane won prent 4 camera . wth the aboye. arrangement , a port m space at the point Cony gd ig propected along a preyector into the point (xp, Yr 2p) Ar projectors pecs tracuah the at Shown, (ut) : t Gia (yO Cnty | a fe da a 5 | | E ein? | | top trem _ v. side wen. | theree~-dimensiona) ylew, 4 From the above ,1t Can be noticed that ney Lad | From top view , we see that two similar triangles whose tangents MmULh be Lame i De ch ec <> lxp= — eg TP oy frero Side yew, ae = [ye Thece eqns are non linear, The aivityen he z detcribec a ¢ n eee ane eas, t pAVToPIanet a ¥ the above equatims can be obtained tn the Mafux yom ag fhown below . consider the point in pace ae me Consider the mabrix M ag Mo on) ° ° o 1 0 Oo o 0 } o o 0 Vd o VY The matrin My ‘toane}omms the pointe P fo the por . qe Map. 1 0 6 ” ce vos ope [Fl _ o 8 o fz] = oo "a 6 Ie} z/4 Ba dividing Just three terms with the fourth ferm, we get, qe wa = |*P a _ Aad YP = =p ; | Be VTUPI lanet -Ife- ¥ Or thogenal projeckons ape Suth prepections A whith the carmeras have infinite focal length, Gr it a thown below , 4 F projectoec are perpendrcular to the view plane a Above diagram Shows a projeckun plane bith zso. fe points are projected an to thik plane, Mt Can bo norced that the retain wethelr 4 andy valuer te deminutton does not ftakec place. fhevepore , 1 oxthogonal prajecten , Pere) CietT Py=?] ¥ Above equestrians fon be obtamed 19 matrix mode ac shown below, Consider the point im space ac Ba Pe ly rs L consider the matrix M futh Phat Me ' eoto ° oO ° L fy VTUPlanet y the vow volume ic a then we can obtain orthogona | projection of the pont by rou tesplying Mand p ag shinn below , qe Map = fro a aT ae oro vie] Y a 90 0 Z Looes t _ ft Xp ye) y a zp Tons tal opertgu| heta fee how vetwvelume ave fpecipied in opengl. vy veer volume te alco weferred to af 7 objects fallen Within the yew volume ore Aes ployed where as the objeth polrrg outside the wew Volume are chp ped out of the Lcene. vite Volume Bark clipping ane truncated. Py taemed With He apex OF center of project (COP ) QL Shown 10 the ine fe meee janet op ene ¥ gpen §L provides two punttons fer tpeenpy rng perspective wew volume and ene function jo cpecipying powetie yew volume eropective Viewing In open Me Mle Wm 10. OPO Ge ¥ pexspecyrye véew volume tan be specified Ufing ~ , 0 giMainixMocle (gi-PRoTECTION ) 3 giles tdentity yy giFrattum (tops rright, bottom, top, Near, per: t thts cpecef ication creates the patteving view volume \ Gagne, top, “near ) lebt, boHtom, “near) tgs Speaeation of a jruttum NY Apelor a puttin. Zz t fhe powspecnye yew Volume Can alco. be specifred by prescribing Abe ingle for, acpect rato Gane yp midth 's be ight neat & far parameters ak Shown below - ImatrixnMode (C&t- PROJECTION ): glload Identity (J: gluPe rs pective cpevy » acpeet ; near, far De py = fee q view, QV TUPlanet ¥ this £peerfi tation crettes “the Jellowng view volume . opengl . ¥ OAT EY Te veewrmg volume can be spocipred 1 opengy using , : glMatrixnmode CGL-PROISCTION ) 5 qt Load Ldentity Gis porto Chyt Tight, Rotem, top, near, Jord: a bes specrp Caden creates the fees view volume , e-Gagn BP ze “pet view volume . x “ Ces t, bottom, near) fy VTUPlanet KH PARALL lets Dovive the matrix for ordnugenal and oblique projectrone 1 openge . + Rosicatty phere are two Hgpes 4 paraliel projections namely ~ ~ 0Fthagonal pre]ectin a Oblrgne Pree ction. Quthogenal projection. + orthogonal projection maton can be Obfained by Performing the following Steps - morrices Shep ls Creating a View volume equal to the Canonical Wew volume whith rs a cube defined dg the moder xe ty , Ye Pr ,and z= 7! This step Can be performed as thown below = (marrixMods CGt-PROTScrion ) 5 plead dentity 0); glortho (-r0, ho, 10, he, “00, 10); Cotght top fa?) (a) eG 1D Cleft, bortiom near) figs mapping of ew volume to the Canonical view velume . fy Vue! anet Mapping of the paiginal view volume tp the Canvnical view volume this chep can be perpotmed hy _ ‘translating . the center of the original viewvolume to the Center the cononitas view volume and then Scahog the original view volume to the Canonica) View volume Hence the two drangpormationc to pe Pesgermed ane: Translation (eignr +lgO)2 , ~ Gop t bortem) j 2, +Gar 4 rea2}/2)) fealing Ca/ yt leprae OY op ~bortem J ; 2/Ggar-nenr ) Hey are concatenated togetnar to peo the Prejechen matrin a Shown below. a hi aoa oe eaberEh pests $ ee 0 —A- a — Tept Bottom ‘bottorn~ top Top Boom 0 0 2 _ fartnear fatenear [Ate near o ° ° ' opens fo ig? bjpine ‘Transpecmations fer norrahradion . Rear et eae 0 rojection Adaprixn ¥ obleque prejeciion Mapex tan be Obttined by pesjorreirg te pe Steps. step 1! shear of objects by H(8,9) hep 2 Create a view Volurre equal to Consolta cep 2 fa canonica) ep 3 1 vew volume Mopping the original wen volum, view volume fy performing Trantlation and. aby [arp and Shp? are Same as in prevrout cose 7] ¥ consider the fellowng obleque clipping volume Back chipping plane front clipping plone P : Preyectree plane tn pop a 4» wendow figs obhique oy ve a [eg + tbtgue prepertion C4) Fop view Cb} Sede view Wyre lanet ¥ from the above I'e- it (an be noticed that — Xp r x + tore (Oy [rem top view, yr y + 2c0e@ + stand = = Xp ~ 7 Ze 0 7% in y oe can Waite these, terms F a homoge neour cverdinate matrix 1 0 Coho 0 lee 1 cots 0 D 0 Oo 0 | 0 D Oo ! 4 mit matri can be expretced as te concatenation Cproduct ) 4 orthog rap hie projection roatrin Mosing) and ghear matrix H(6, gp) aS Shown OO. (0 Cone oO Pe Morting * HCP) ds 100 }g] oF cog o | Cae Po! Oo ho t acs ai) Lee @ 4 + However, Since scaling and Transjormatin alco bos fo be prvpormred * make the Original View volume equal fo canonical view volume , the Prgection matrix { oblique Projection would be — es | Z pi fy Vtue! anet “Ne PERSPECTIVE _ ROTLTION MATRICES lets Dewve the enatvix fer Perspective prefechin in open GL. vy pecspoctive _ project pespormnivg peloning hep — step ittostion (Normals zatun ) a the object flere! perperm ee eae eae matrix tan be oebtamed by Wy: wodredor ton % objects Ca) perspective view (Paine Ovtogr ophre projection If Atetortet Distore a OnFrog apo: | - tL tnwster> | 17 | a 7 | Ig: Norm olizotron ty ay forester VTUPlanet +A sermple prepection maprix pe the prepetiien plane ar Z=-} ahd the Cop ab the Cae Se 1 0 0 © |» simple erepechive m=}]O loo ao motrin OO Ff 9 0 0-0 # contider the matrin — ° Q which is similar to MM but S30 a “ Coane Rg / Oo} o oo B 0, we Consider the pome - + by applying N on p we gt Where, x! =x ' ee] yt wey ul ee Gace Ww! a # Ajter divi ting w', we have the 2p point = 4 be [Xz VY}. [rte " (x + Me) f " t te aegore , we get boy ok Yee wo] yo [** =] VY TUPlanet { L “21 y The game wesult Can be obtained y applying an Cute fat projection we jer : +N ortho Seer ° when this oF thogbaphic PEuyzty . weg a ~—SChreEeEeEeM Ca _ we get Xp thevep ore Af applying A the fame ‘Tésule we fel ecaen ae) Zax opp! we ating the 2-anis fon pen id applied on the port 7 m j J aise cHy on the port grids the on thogr-aphic on and then pryjecting the pins “ original vew volume can be nosmalized Ye peaspective view volume canonical Tight = left xe pt CBS ae hear yet tep- behem A near Ze -near Ze peor ot therefore, the veculting perspective project an mareit ie ab Pasay = by aly ~denear nighttlepe ie Tanrtepe night legs caenear oP tho Mem o Yep bottom “Yop ~ porte t a _ [artnear afar ¥neq viteaast jor Heed PRoysTION AND SHAD OME | lets see how Chadows can be creaked ard Projected asing oper gu. x Sonple chadows can be created in per ge . Althougp shadows are not goometria objects oe they are lenporta np Components 4 reals tre Imaget and. jive many vical eyes | ¢ Shodows vequire a light cource to be Present for sumplecnty , oe Ofsume that the shadow ae on woyro. ¢ A thadow i jor phipgon and Ut the Preston x the arigenal plygem onte the euaace Cpreurd y 4 is at shown below - ee 7 ¥ The light Source present at AY (% fe, Zi) musk be bought the origin by petformirg a Transtohon T (oki, fen 20) then we have fo perform a 7 > x simple perspeciive — “A through the origin. LE sg The praechio matrix bk __ mde oe z [ My 8 | by TORIES Tren we mut Lrantlaje the tient tource back to (2, Ye ,2e)) @ the toncakenatun thir matyix and the two dranslahvn materces Projects the verpex Guy.z) to ea ee Ce ee =0 my _ 2oZe [or Fru] [w=] |» 0p] fy Vue! anet - 22- nobes thew we got thic 7 [* io 2) td) sono. 100 x | ip _ O10 hlyfoloo ‘#¥ oto [pp rpo ot 24 oo lo Oona lee te 00 ve) oy ee ° 772 | » |x Premcsree t ‘OG Hiln Up 6 lie _ Zeke ul Oa : J Odelev 4 With opengl program , we can alter Medel Vrew } matrix te er the desired polygon as prone. Gtploar mens; el etoae et) aaa bl [or Ciro; fem; tr MLIT©O OG, mloy= mrsy= mLiwlrho: mE = ~hol gy gi toler IV Cpolygoncoler ) ; gba ( Ge-Polygon ); _ 7% Draw the polyger a netmatty #) glee oH fy VTUPlanet IMatreMade (61. Mopsivis w); qifush Mahi bos gl (eanslatey OX 1 4¢, 28); IMuterpalrixg Cm); gi frantlate Cota Ye, 20): ghColors} Cthadow- color) ; iBegin ($L-PoLy6on 9 } gender; gi lop Matrix oe imfevectiye res Se Save Stak ¥/ Pi Trans/afe back #/ Cx project ¥/ Ce move (ight to origin 41 /e Draw the polygon again a} 7% beltore cfate +] fy VTUPlanet

You might also like