9IntroductionReal-time rendering is concerned with making images rapidly on the computer.The rate at which images are displayed is measured in frames per second (fps) or Hertz (Hz).Usually between 15 fps and 72 fps.Interactivity, 3D rendering, graphics acceleration hardware.Include applications such as computer games, CAD, 3D animation software (3D Max or Maya), …, etc.
10Graphics Rendering Pipeline The main function of the pipeline is to generate, or render, a two-dimensional image, given a virtual camera, 3D objects, light sources, shading equations, textures, and more.
11Pipeline Architecture A pipeline consists of several stages. The speed of the pipeline is determined by the slowest stage, no matter how fast the other stages may be.conceptual stagesfunctional stagespipeline stages
24GEOMETRY Vertex Shading ApplicationGeometryRasterizerGEOMETRY Vertex Shadingshading equationMaterials + Lighting ShadingCompute color at verticesTry to mimic how light in nature behavesHard to uses empirical models, hacks, and some real theorylightGeometryblueredgreenRasterizer
27GEOMETRY Clipping Square (cube) after projection ApplicationGeometryRasterizerGEOMETRY ClippingSquare (cube) after projectionClip primitives to square
28GEOMETRY Screen Mapping ApplicationGeometryRasterizerGEOMETRY Screen MappingScreen mapping, scales and translates square so that it ends up in a rendering windowThese screen space coordinates together with Z (depth) are sent to the rasterizer stage
34The RASTERIZER Pixel Shading ApplicationGeometryRasterizerThe RASTERIZER Pixel ShadingUsing the interpolated shading data as inputThe end result is one or more colors to be passed on to the next stageis executed by programmable GPU coresTexturing is one of the most important techniquies
35The RASTERIZER Texturing ApplicationGeometryRasterizerThe RASTERIZER TexturingOne application of texturing is to glue images onto geometrical objectUses and other applicationsMore realismBump mappingPseudo reflectionsStore lightingAlmost infinitely many uses+=
37The RASTERIZER Merging ApplicationGeometryRasterizerThe RASTERIZER MergingPixels are stored in color bufferCombine the fragment color with the pixel colorHighly configurableResolving visibility (done with Z-buffer)alpha channel for transparencystencil buffer for maskingaccumulation buffer for motion blur, depth of field, soft shadows, or antialiasing
38The RASTERIZER Z-buffering ApplicationGeometryRasterizerThe RASTERIZER Z-bufferingThe graphics hardware is pretty stupidIt just draws trianglesHowever, a triangle that is covered by a more closely located triangle should not be visibleAssume two equally large tris at different depthsTriangle 1Triangle 2Draw 1 then 2incorrectDraw 2 then 1correct
42Double BufferingFront Buffer 儲存螢幕目前顯示的內容，程式計算出的下一個畫面則先寫入 Back Buffer 中。Copy更新畫面時，在垂直回歸時間內，把 Back Buffer 拷貝至 Front Buffer：backfront程式寫入顯示在螢幕上backfront拷貝(vertical retrace)backfront顯示在螢幕上
43register 的值是在垂直回歸時才更新。 Flipping目前的顯示卡通常都具有緩衝區交換的硬體功能，可以避免拷貝而很有效率地把 Front Buffer 和 Back Buffer 互換：backfront程式寫入顯示在螢幕上registerABregister 的值是在垂直回歸時才更新。frontback程式寫入顯示在螢幕上registerAB
44And, lately… Programmable shading has become a hot topic Vertex shadersPixel shadersAdds more control and much more possibilities for the programmerApplicationGeometryRasterizerHARDWAREVertex shaderprogramPixel shader