Computer Graphics
Total Page:16
File Type:pdf, Size:1020Kb
ComputerGraphics CS217 Overview • Introduction Whatiscomputergraphics? • Applications Whatisitgoodfor? • Systems&software Howdoesitrelatedtothiscourse? 11 Introduction • Whatiscomputergraphics? Luxo,Jr. Pixar Whatissuesmustbeaddressedbya computergraphicssystem? 22 Overview • Topicsincomputergraphics Imaging=representing2Dimages Modeling=representing3Dobjects Rendering=constructing2Dimagesfrom3Dmodels Animation=simulatingchangesovertime Overview • Topicsincomputergraphics Imaging=representing2Dimages Modeling=representing3Dobjects Rendering=constructing2Dimagesfrom3Dmodels Animation=simulatingchangesovertime 2DImage 33 WhatisanImage? • Animageisa2Drectilineararrayofpixels Continuousimage Digitalimage WhatisanImage? • Animageisa2Drectilineararrayofpixels Continuousimage Digitalimage AAppiixxeelliissaassaammppllee,,nnoottaalliittttlleessqquuaarree!! 44 WhatisanImage? • Animageisa2Drectilineararrayofpixels Continuousimage Digitalimage AAppiixxeelliissaassaammppllee,,nnoottaalliittttlleessqquuaarree!! RepresentingDigitalImages typedefstructpixel{ floatred,green,blue; }Pixel; typedefstructimage{ intwidth,height; Pixel*pixels; }Image; Digitalimage 55 ImageAbstractDataType /*Createanddeleteimage*/ Image*Image_new(intwidth,intheight); voidImage_free(Image*image); /*Getimageproperties*/ intImage_getWidth(Image*image); intImage_getHeight(Image*image); /*Pixelmanipulation*/ Pixel*Image_getPixel(Image*image,inti,intj); voidImage_setPixel(Image*image,inti,intj,Pixel*pixel); /*Imagemanipulation*/ voidImage_brighten(Image*image,floatfactor); voidImage_blur(Image*image,floatfactor); voidImage_swirl(Image*image,floatangle); voidImage_composite(Image*image,Image*image2,Image*mask); voidImage_morph(Image*image1,Image*image2,Array*features); etc. ProcessingDigitalImages • Examples Filtering Warping Composition Morphing ImageWarping ImageComposition ImageMorphing (MichaelBostock,CS426,Fall99) (AllstudentsinCS426,Fall98) 66 ProcessingDigitalImages • Examplefromthemovies… TheMatrix Reloaded (Warner) Overview • Topicsincomputergraphics Imaging=representing2Dimages Modeling=representing3Dobjects Rendering=constructing2Dimagesfrom3Dmodels Animation=simulatingchangesovertime 3DModel 77 GeometricModeling Howcanthisobjectberepresentedina computer? Example:3DPolygons typedefstructpoint{ floatx,y,z; }Point; typedefstructpolygon{ intnpoints; Point*points; }Polygon; typedefstructobject{ intnpolygons; Polygon*polygons; }Object; typedefstructscene{ intnobjects; Object*objects; }Scene; 88 Example:3DPolygons typedefstruct point{ floatx,y,z; (x,y,z) }Point; typedefstruct polygon{ intnpoints; Point*points; }Polygon; typedefstruct object{ intnpolygons; Polygon*polygons; }Object; typedefstruct scene{ intnobjects; Object*objects; }Scene; Example:3DPolygons typedefstruct point{ floatx,y,z; (x1,y1,z1) }Point; (x2,y2,z2) typedefstruct polygon{ intnpoints; Point*points; }Polygon; typedefstruct object{ intnpolygons; Polygon*polygons; }Object; (x3,y3,z3) typedefstruct scene{ intnobjects; Object*objects; }Scene; 99 Example:3DPolygons typedefstruct point{ floatx,y,z; }Point; typedefstruct polygon{ intnpoints; Point*points; }Polygon; typedefstruct object{ intnpolygons; Polygon*polygons; }Object; typedefstruct scene{ intnobjects; Object*objects; }Scene; Example:3DPolygons typedefstructpoint{ floatx,y,z; }Point; typedefstructpolygon{ intnpoints; Point*points; }Polygon; typedefstructobject{ intnpolygons; Polygon*polygons; }Object; typedefstructscene{ intnobjects; Object*objects; }Scene; 1100 PolygonalMeshes • Canmakecomplexobjects PolygonalMeshes • Canmakeverycomplexobjects StanfordGraphicsLaboratory 1111 PolygonalMeshes • Canmakeverycomplexobjects StanfordGraphicsLaboratory MoreGeometricRepresentations SubdivisionSurfaces StanfordGraphicsLaboratory Solids H&BFigure10.46 Spline Surfaces 1122 TinToy Pixar Overview • Topicsincomputergraphics Imaging=representing2Dimages Modeling=representing3Dobjects Rendering=constructing2Dimagesfrom3Dmodels Animation=simulatingchangesovertime 1133 RenderingExample Whatissuesmustbeaddressedbya computergraphicsrenderingalgorithm? RenderingMethods • Mathematicalmodelsfor: Lightsources Light Surface reflectances Source Cameraresponse • Algorithmstofind: Visiblesurfaces Surface Indirectlightpaths etc. Camera 1144 RenderingMethods • Mathematicalmodelsfor: Lightsources Light Surface reflectances Source Cameraresponse • Algorithmstofind: Visiblesurfaces Surface Indirectlightpaths etc. Camera SimpleRenderingAlgorithm • Foreachpixel… Constructrayfromeyepositionthroughpixel Findfront-mostsurfaceintersectedbyray Computecolorofsamplebasedonmodelsoflight sourcesandsurfacereflectances 1155 SimpleRenderingAlgorithm • Foreachpixel… Constructrayfromeyepositionthroughpixel Findfront-mostsurfaceintersectedbyray Computecolorofsamplebasedonmodelsoflight sourcesandsurface reflectances SimpleRenderingAlgorithm • Foreachpxiel … Constructrayfromeyepositionthroughpixel Findfront-mostsurfaceintersectedbyray Computecolorofsamplebasedonmodelsoflight sourcesandsurface reflectances 1166 SimpleRenderingAlgorithm IImmaaggee **RRaayyCCaasstt((CCaammeerraa**ccaammeerraa,,LLiigghhttss**lliigghhttss,,SScceennee **sscceennee,, iinntt wwiiddtthh,,iinntt hheeiigghhtt)) {{ IImmaaggee**iimmaaggee ==IImmaaggee__nneeww((wwiiddtthh,,hheeiigghhtt));; ffoorr((iinntt ii==00;;ii<<wwiiddtthh;;ii++++)){{ ffoorr((iinntt jj==00;;jj<<hheeiigghhtt;;jj++++)){{ RRaayyrraayy==CCoonnssttrruuccttRRaayyTThhrroouugghhPPiixxeell((ccaammeerraa,,ii,,jj));; PPooiinnttiinntteerrsseeccttiioonn ==FFiinnddIInntteerrsseeccttiioonn((rraayy,,sscceennee));; CCoolloorr==CCoommppuutteeRReefflleeccttaannccee((lliigghhttss,,iinntteerrsseeccttiioonn,,sscceennee));; SSeettPPiixxeell((iimmaaggee,,ii,,jj,,));; }} }} rreettuurrnniimmaaggee;; }} BetterRenderingAlgorithms • Considerindirectlightpaths Inter-objectreflections Caustics etc. Trike RenderingCaustics (JamesPercy,CS426,Fall99) (MichaelBostock,JamesPercy&CaseyMcTaggert, CS426,Fall99) 1177 Red’sDream Pixar Overview • Topicsincomputergraphics Imaging=representing2Dimages Modeling=representing3Dobjects Rendering=constructing2Dimagesfrom3Dmodels Animation=simulatingchangesovertime 1188 Animation • Describinghowmodelsmove Kinematics Dynamics Planning Learning (Lasseter87) Animation • Difficultcombinationof: Desiredbehavior Simulatingphysics Artisticcontrol Hodgins etal. Chen,Guan, Liu,and Qie CS426,Fall98 Baraff&Witkin 1199 Monsters,Inc. Pixar ComputerGraphicsApplications • Entertainment • Computer-aideddesign • Scientificvisualization • Training • Education • E-commerce • Computerart 2200 ComputerGraphicsApplications • Entertainment • Computer-aideddesign • Scientificvisualization • Training JurasicPark (Industrial,Light,&Magic) • Education • E-commerce Geri’sGame • Computerart (Pixar AnimationStudios) Quake (IdSoftware) ComputerGraphicsApplications • Entertainment • Computer-aideddesign • Scientificvisualization • Training LosAngelesAirport (BillJepson,UCLA) • Education • E-commerce • Computerart GearShaftDesign (IntergraphCorporation) Boeing777Airplane (BoeingCorporation) 2211 ComputerGraphicsApplications • Entertainment • Computer-aideddesign • Scientificvisualization AirflowInsideaThunderstorm • Training (Bob Wilhelmson, UniversityofIllinoisatUrbana-Champaign) • Education • E-commerce • Computerart ApoA-1 (TheoreticalBiophysicsGroup, VisibleHuman UniversityofIllinoisatUrbana-Champaign) (NationalLibraryofMedicine) ComputerGraphicsApplications • Entertainment • Computer-aideddesign • Scientificvisualization DrivingSimulation • Training (Evans&Sutherland) • Education • E-commerce • Computerart DeskAssembly (SiliconGraphics,Inc.) FlightSimulation (NASA) 2222 ComputerGraphicsApplications • Entertainment • Computer-aideddesign • Scientificvisualization • Training • Education • E-commerce • Computerart HumanSkeleton ForumofTrajan (SGI) (BillJepson,UCLA) ComputerGraphicsApplications • Entertainment • Computer-aideddesign • Scientificvisualization • Training InteractiveKitchenPlanner (Matsushita) • Education • E-commerce • Computerart VirtualPhoneStore (LucentTechnologies) 2233 ComputerGraphicsApplications • Entertainment • Computer-aideddesign • Scientificvisualization • Training • Education • E-commerce • Computerart BlairArch (MarissaRange&AdamFinkelstein, PrincetonUniversity)c HowIsThisRelatedtotheCourse? • Computergraphicsuses… Parsers(lexicalandsyntacticanalysis) Abstractdatatypes Memorymanagement Multipleprocesses Networking 2244 HowIsThisRelatedtotheCourse? • Computergraphicsuses… Parsers(lexicalandsyntacticanalysis) Abstractdatatypes Memorymanagement Multipleprocesses Networking Assemblycode (maybe,alittle) AloneintheDark4 (Darkworks/Infogrames) 2255.