ComputerGraphics课件制作:贾世宇主讲:何辰ApplicationsofComputerGraphics•GUI(GraphicalUserInterface)(图形用户接口)•ComputerAidedDesign(CAD)(计算机辅助设计)•DataVisualization(数据可视化)•VirtualReality(虚拟现实)•Simulators(模型)•Moviespecialeffects(动画特殊效果)•Games(游戏)TheGraphicsRenderingPipeline(图形渲染流水线)3DSCENECollectionof3Dprimitive(几何模型)IMAGEArrayofpixelsPrimitives:Basicgeometricstructures(points,lines,triangles,polygons)3DPrimitives2DPrimitivesPixelsGeometryStageRasterizationStageVertexProcessingPixelProcessingCoordinateTransformationLightingCalculationPrimitiveRasterizationVertexAttributeInterpolationTextureMappingRasterOperation(ROP)ScissorTestAlphaTestStencilTestDepth(Z)TestColorBlending光栅扫描VideoMemoryComputerGraphicsHardwareCPUSystemMemoryFrameBufferVideoControllerVideoDisplayDeviceGraphicsControllerPrimitiveDataTextureDataMotherboardGraphicsCardBus(PCI,AGP,PCIExpress)GraphicsHardwareArchitectureVideoDisplayDevicesCRT(Cathode-RayTube)ElectronGunFocusingSystemHorizontalDeflectionPlatesVerticalDeflectionPlatesElectronBeamPhosphor-CoatedScreen电子枪垂直ColorCRTElectronGunRedBlueGreenShadowMaskScreenPhosphor-DotTriangleRaster-ScanDisplaysHorizontalRetraceVerticalRetraceScanline(rowofpixels)Progressive-scan:Scanlinesarerepaintedonebyone.Refreshrate:Numberoftimesanentirescreenisrepaintedinasecond.Interlace:Repainteven-numberedscanlines,thenodd-numberedscanlines.Random-ScanDisplays(VectorDisplays)Displaylist:Sequenceofline-drawingcommands.Line(0,0)-(100,0)Line(100,0)-(50,50)Line(50,50)-(0,0)DisplaylistLCD(Liquid-crystalDisplay)Passive-matrixLCDLiquidCrystalVerticalTransparentConductorHorizontalTransparentConductorLightPolarizerLightPolarizerLightActive-matrixLCDTransistorateachpixellocation.TFT(Thin-FilmTransistor)Flat-PanelDisplays液晶显示器PlasmaDisplayGas(Neonmixture)VerticalTransparentConductorHorizontalTransparentConductorThree-DimensionalViewingDevicesStereoscopicvision:twodifferentviewsforleftandrighteye.1.Red-Greenglasses.2.Polarizedglasses.3.Synchronizedshutterglasses.4.Newdevicewithoutglasses.LCDwithopticalrasterandmotiontracker.LefteyeRighteyeTheframebuffer:Videomemorythatholdsscreenpixelvalues.Resolution:Numberofhorizontalandverticalpixelsonthescreen.TheFrameBuffer00h-1w-1(x,y)xyPixelvalueColorvalueDepth(Z)valueStencilvalueFrameBufferStencilBufferColorBufferDepth(Z)buffer定位Colordepth(Colorbits):Numberofbitsincolorbufferthatrepresentscolorvalueofonepixel.1bit:monochrome.Bitmap8bit:256color16bit:highcolor24bit:truecolor(真彩色)(8bitforred,green,blue)32bit:truecolorplusalphavalue(transparency)Thecolorvaluecandirectlydescribecolorcomponents,oritcanbeacolorindexintoacolortable.Depthbits:Numberofbitsindepthbufferthatrepresentsdepthvalueofonepixel.Stencilbits:Numberofbitsinstencilbufferthatrepresentsstencilvalueofonepixel.HorizontalresolutionwVerticalresolutionhColorbitsncDepthbitsndStencilbitsnsNumberofbytesneededforcolorbuffer:whnc/8Numberofbytesneededfordepthbuffer:whnd/8Numberofbytesneededforstencilbuffer:whns/8Addressofpixel(x,y)incolorbuffer:)(80addr),(addrxywnyxcDoublebufferFrontstageandbackstageswappingforanimation.colorbuffer1colorbuffer2FrontstagepointerBackstagepointercolorbuffer1colorbuffer2FrontstagepointerBackstagepointerTwocolorbuffers.Frontstagefordisplay.Backstagefordrawing.TriplebufferThreecolorbuffers.Onefrontstageandtwobackstages.VideoControllerMainfunction:Periodicallyreadpixelcolorvaluesfromcolorbuffer,convertsthemintovideosignalsandsendvideosignalstovideodisplaydevices.Otherfunctions:•Doublebufferortriplebufferoperation•Colortablelookup•VideooverlayGraphicsControllerTheevolutionofgraphicscontrollerBefore1995:PrimitiveRasterization1995-1998:3DAccelerator.TexturemappingandHardwareZ-buffer1999-2000:GPU.HardwareTransformationandLightingCalculation(HardwareTnL)2001:ProgrammableVertexShader2002-today:ProgrammablePixelShaderGraphicsControllerRasterizationStage1995-1998:3DAcceleratorCPUSystemMemoryGraphicsApplicationGeometryStage2DPrimitivesTexturesRasterizerTextureUnitVideoMemoryROPUnit2DPrimitivesTexturesFrameBufferBus(PCI)Representativeproducts:•3dfxVoodooseries•NVidiaTNTseries•ATIRageseries•MatroxMystique•RenditionVerite•S3SavageFeatures:•Primitiverasterization•Texturemapping•HardwareZ-buffer1999-2000:GPU(GraphicsProcessingUnit)GPURasterizationStageCPUSystemMemoryGraphicsApplication3DPrimitivesTexturesRasterizerMultiTextureUnitVideoMemoryROPUnit3DPrimitivesTexturesFrameBufferBus(AGP)TextureCombinerGeometryStageTransformationAndLightingUnitRepresentativeproducts:•NVidiaGeforce256•ATIRadeon7500Features:•Hardwaretransformationandlighting(TnL)•Superscalarstructure(Multiplevertexandpixelprocessingunitsworkinginparallel)•HardwareZ-bufferandStencil-buffer2001:ProgrammableVertexShaderGPURasterizationStageCPUSystemMemoryGraphicsApplication3DPrimitivesTexturesRasterizerMultiTextureUnitVideoMemoryROPUnit3DPrimitivesTexturesFrameBufferBus(AGP)TextureCombinerGeometryStageVertexShaderUnitShader:Partofgraphicshardwarepipelinethatcanbeprogrammed.Representativeproducts:•NVidiaGeforce3•ATIRadeon8500VertexShaderUnit:Programmableunitthatcontrols