Advanced Rendering Techniques Lecture Rendering Pipeline (Part I) Professor Leandro Augusto Frata Fernandes laffernandes@ic.uff.br Lecture notes available in http://www.ic.uff.br/~laffernandes/teaching/0./topicos_rendering Part of this material was adapted from the slides presented by Comba, Dietrich, Pagot and Scheidegger in the tutorial "Computation on GPUs: from a Programmable Pipeline to an Efficient Stream Processor" at SIBGRAPI'0, and extended by Oliveira for its course at PPGC-UFRGS (CMP9). Used with permission. Rendering Images Turn a set of geometric models, textures and parameters into a synthetic picture Rendering Algorithm Geometric Model Synthetic Picture Advanced Rendering Techniques (0.)
The Visualization Problem Each element has its own coordinate system Need to change coordinate systems and render visible objects only! OCS CCS This object is not visible within the viewport Viewing Volume We want this picture OCS Screen (Viewport) WCS OCS OCS: Object coordinate system WCS: World coordinate system CCS: Camera coordinate system Advanced Rendering Techniques (0.) Texturing Model Model + Shading Model + Shading + Textures Advanced Rendering Techniques (0.)
The Graphics Pipeline (Overview) Per vertex lighting (Gouraud shading) and Z-Buffer are assumed **This is a rather simplified representation of a pipeline Advanced Rendering Techniques (0.) 5 D model in OCS Synthetic viewpoint and camera model Light source parameters Lighting model, Textures, etc. Advanced Rendering Techniques (0.) 6
Map from OCS to CCS Clipping in D Per vertex lighting Advanced Rendering Techniques (0.) 7 Map from OCS to CCS Clipping in D Per vertex lighting Perspective division Map from CCS to viewport Texture Coordinates + Screen Coordinates + Depth +... (Per ) Advanced Rendering Techniques (0.) 8
Map from OCS to CCS Clipping in D Per vertex lighting Perspective division Map from CCS to viewport Back/Front face culling Texturing Interpolate values Handle occlusion Advanced Rendering Techniques (0.) 9 Map from OCS to CCS Clipping in D Per vertex lighting Perspective division Map from CCS to viewport Back/Front face culling Texturing Interpolate values Handle occlusion Advanced Rendering Techniques (0.) 0 5
Graphics Hardware Fixed Pipeline commands connectivity Advanced Rendering Techniques (0.) Graphics Hardware Fixed Pipeline commands glbegin(gl_tringles); glf(0.0f, 0.0f, 0.0f); glf(.0f, 0.0f, 0.0f); glvertesf(0.5f,.0f,.0f);... glend(); connectivity Advanced Rendering Techniques (0.) 6
Graphics Hardware Fixed Pipeline Data Software/Hardware Interface commands Driver (HAL) Graphics Hardware connectivity Advanced Rendering Techniques (0.) Graphics Hardware Fixed Pipeline commands connectivity Object Modeling Transform World Matrix World ModelView Matrix View Transform View Matrix Camera Lighting Transform Matrix Homogeneous Clip Perspective Divide Normalized Device Viewport Transform Window Advanced Rendering Techniques (0.) 7
Per- Operations Positions Per- Operation ModelView Matrix Homogeneous Clip Perspective Divide Normalized Device Viewpoint Transform Window Normals ModelView Inverse Transpose Normals Texture Coordinates Base Color Texture Matrix Lighting Calculation Texture Coordinates Color positions are transformed by the ModelView and matrices Normals are transformed by the inverse transpose of the upper leftmost x submatrix of the ModelView Texture coordinates are transformed by texture matrices Lighting calculations are applied Advanced Rendering Techniques (0.) 5 Graphics Hardware Fixed Pipeline commands connectivity 6 8
Graphics Hardware Fixed Pipeline commands connectivity 7 Graphics Hardware Fixed Pipeline commands Collect Data Into Primitives, Clipping and Culling Clipping Division by W Viewport Back/Front face culling connectivity 8 9
Graphics Hardware Fixed Pipeline commands Primitives are decomposed into smaller units () corresponding to pixels A fragment has several attributes Window coordinates, depth, color, texture coordinates, etc. Attribute values are determined by interpolation from the values specified at the Antialiasing is performed at this stage connectivity 9 Graphics Hardware Fixed Pipeline commands connectivity 0 0
Graphics Hardware Fixed Pipeline commands Scissor test Alpha test Stencil test Depth test Blending Dithering Logical operations connectivity Graphics Hardware Pipeline Parallelization commands Performance is improved by processing multiple or in parallel connectivity Ver. Trans. & Light. Ver. Trans. & Light. Frag. Tex. & Col. Frag. Tex. & Col. Ver. Trans. & Light. Frag. Tex. & Col. Frag. Tex. & Col. Frag. Tex. & Col.