- Rasterization. Geometry. Scan Conversion. Rasterization

Similar documents
Pipeline Operations. CS 4620 Lecture 10

Pipeline Operations. CS 4620 Lecture 14

Pipeline Operations. CS 4620 Lecture Steve Marschner. Cornell CS4620 Spring 2018 Lecture 11

Rasterization Overview

CS4620/5620: Lecture 14 Pipeline

Scanline Rendering 2 1/42

CS 130 Final. Fall 2015

CS 130 Exam I. Fall 2015

Mach band effect. The Mach band effect increases the visual unpleasant representation of curved surface using flat shading.

CSE 167: Introduction to Computer Graphics Lecture #5: Rasterization. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2015

CS451Real-time Rendering Pipeline

For each question, indicate whether the statement is true or false by circling T or F, respectively.

Scan Conversion- Polygons

3D Rasterization II COS 426

CS230 : Computer Graphics Lecture 4. Tamar Shinar Computer Science & Engineering UC Riverside

Illumination and Shading

CS 464 Review. Review of Computer Graphics for Final Exam

Rendering. Converting a 3D scene to a 2D image. Camera. Light. Rendering. View Plane

Module Contact: Dr Stephen Laycock, CMP Copyright of the University of East Anglia Version 1

How do we draw a picture?

CHAPTER 1 Graphics Systems and Models 3

Interpolation using scanline algorithm

graphics pipeline computer graphics graphics pipeline 2009 fabio pellacini 1

The Graphics Pipeline

Graphics Hardware and Display Devices

graphics pipeline computer graphics graphics pipeline 2009 fabio pellacini 1

Rasterization and Graphics Hardware. Not just about fancy 3D! Rendering/Rasterization. The simplest case: Points. When do we care?

The Traditional Graphics Pipeline

CS 498 VR. Lecture 18-4/4/18. go.illinois.edu/vrlect18

Surface Graphics. 200 polys 1,000 polys 15,000 polys. an empty foot. - a mesh of spline patches:

Shading. Introduction to Computer Graphics Torsten Möller. Machiraju/Zhang/Möller/Fuhrmann

The Traditional Graphics Pipeline

Real-Time Graphics Architecture

Today. Rendering pipeline. Rendering pipeline. Object vs. Image order. Rendering engine Rendering engine (jtrt) Computergrafik. Rendering pipeline

Institutionen för systemteknik

Computer Graphics 1. Chapter 7 (June 17th, 2010, 2-4pm): Shading and rendering. LMU München Medieninformatik Andreas Butz Computergraphik 1 SS2010

The Traditional Graphics Pipeline

Lets assume each object has a defined colour. Hence our illumination model is looks unrealistic.

Drawing Fast The Graphics Pipeline

Rasterization. MIT EECS Frédo Durand and Barb Cutler. MIT EECS 6.837, Cutler and Durand 1

CPSC 314 LIGHTING AND SHADING

Rendering approaches. 1.image-oriented. 2.object-oriented. foreach pixel... 3D rendering pipeline. foreach object...

9. Illumination and Shading

Graphics Hardware. Instructor Stephen J. Guy

C P S C 314 S H A D E R S, O P E N G L, & J S RENDERING PIPELINE. Mikhail Bessmeltsev

Spring 2009 Prof. Hyesoon Kim

Computer Graphics. - Rasterization - Philipp Slusallek

CS 112 The Rendering Pipeline. Slide 1

Chapter 7 - Light, Materials, Appearance

Reading. 18. Projections and Z-buffers. Required: Watt, Section , 6.3, 6.6 (esp. intro and subsections 1, 4, and 8 10), Further reading:

Graphics Pipeline. CS535 Fall Daniel G. Aliaga Department of Computer Science Purdue University

Hidden Surfaces II. Week 9, Mon Mar 15

Real-Time Rendering (Echtzeitgraphik) Michael Wimmer

Introduction to 3D Graphics

Drawing Fast The Graphics Pipeline

Computer Graphics. Illumination and Shading

TDA362/DIT223 Computer Graphics EXAM (Same exam for both CTH- and GU students)

Illumination and Shading

CPSC / Illumination and Shading

Shading/Texturing. Dr. Scott Schaefer

Pipeline and Rasterization. COMP770 Fall 2011

CSE528 Computer Graphics: Theory, Algorithms, and Applications

X. GPU Programming. Jacobs University Visualization and Computer Graphics Lab : Advanced Graphics - Chapter X 1

OpenGL: Open Graphics Library. Introduction to OpenGL Part II. How do I render a geometric primitive? What is OpenGL

Lecture 2. Shaders, GLSL and GPGPU

CS452/552; EE465/505. Clipping & Scan Conversion

Rasterization. COMP 575/770 Spring 2013

Computer Graphics Fundamentals. Jon Macey

Rasterization. CS 4620 Lecture Kavita Bala w/ prior instructor Steve Marschner. Cornell CS4620 Fall 2015 Lecture 16

Advanced Rendering Techniques

Graphics Hardware, Graphics APIs, and Computation on GPUs. Mark Segal

Models and Architectures

CSE 690: GPGPU. Lecture 2: Understanding the Fabric - Intro to Graphics. Klaus Mueller Stony Brook University Computer Science Department

CSE 167: Lecture #5: Rasterization. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2012

CSE Intro to Computer Graphics. ANSWER KEY: Midterm Examination. November 18, Instructor: Sam Buss, UC San Diego

Drawing Fast The Graphics Pipeline

Texture Mapping and Sampling

The graphics pipeline. Pipeline and Rasterization. Primitives. Pipeline

Computer Graphics with OpenGL ES (J. Han) Chapter VII Rasterizer

CS 130 Exam I. Fall 2015

CS770/870 Fall 2015 Advanced GLSL

Chapter 2 A top-down approach - How to make shaded images?

TSBK03 Screen-Space Ambient Occlusion

EECE 478. Learning Objectives. Learning Objectives. Rasterization & Scenes. Rasterization. Compositing

Shaders (some slides taken from David M. course)

The Viewing Pipeline Coordinate Systems

Realtime 3D Computer Graphics Virtual Reality

Introduction Rasterization Z-buffering Shading. Graphics 2012/2013, 4th quarter. Lecture 09: graphics pipeline (rasterization and shading)

Spring 2011 Prof. Hyesoon Kim

Rasterizing triangles

CS 498 VR. Lecture 19-4/9/18. go.illinois.edu/vrlect19

Sign up for crits! Announcments

RASTERISED RENDERING

The Rasterization Pipeline

CS2401 COMPUTER GRAPHICS ANNA UNIV QUESTION BANK

Rendering. Illumination Model. Wireframe rendering simple, ambiguous Color filling flat without any 3D information

Real-Time Graphics Architecture

Surface shading: lights and rasterization. Computer Graphics CSE 167 Lecture 6

E.Order of Operations

SUMMARY. CS380: Introduction to Computer Graphics Varying Variables Chapter 13. Min H. Kim KAIST School of Computing 18/04/26.

Transcription:

Computer Graphics - The graphics pipeline - Geometry Modelview Geometry Processing Lighting Perspective Clipping Scan Conversion Texturing Fragment Tests Blending Framebuffer Fragment Processing - So far, projection of vertices into view space (done in the geometry stage) - Now, conversion of geometric primitives into fragments - Fragment: - Represents a point of geometry - Has color, texcoord, depth etc. - Associated with a pixel - But not yet a pixel (not stored in the framebuffer) - Scan conversion of geometric primitives - For each covered pixel a fragment is generated - Attributes like color, depth, texture coordinates etc. are generated from projected vertex attributes - During fragment generation OpenGL states, e.g. shading model, line width, polygon mode etc. are taken into account - Pixel: - Color of a pixel in the framebuffer - of geometric data Geometry processing Vertex transformation Lighting Clipping... Screen coord (X,Y) Depth (z) Color (RGBα) TexCoords (u,v,w)... Fragment Processing Texturing Per-fragment tests Per-fragment comparison Blending... - of triangles - Using OpenGL, everything is broken into triangles - Find all fragments covered by a triangle // most simple rasterizer Rasterize(vertex v[3]) { int x, y; bbox b; getbbox(v,, &b); for (y= b.ymin; ; y < b.ymax; ; y++) for (x= b.xmin; ; x < b.xmax; ; x++) if (inside(v,, x, y)) fragment(x,y); }

- Scanline algorithm - Edge table: - Stores list of all edges in increasing y min -order y min, x min, y max, dx/dy - Active edge table: - Contains all edges that intersect current scanline in increasing x-order x, y max, dx/dy - Scanline algorithm scanconvert(vertex v0, v,... vn) { AEL = NULL; foreach(scanline y) { remove edges from AEL with y max y; foreach(edge AEL) x = x + dx/dy; insert edges into AEL with y min == y; sort AEL by increasing x; draw scanline segments xx, x3x4,... } } - Once a fragment is generated, per-vertex attributes need to be assigned properly - Determination of color and other properties for all pixels along a scanline is called Shading - This is done via interpolation (see exercise for more information) wire frame scanline v 0 v v - Flat shading - Per surface (polygon) lighting - Take normal of one distinct vertex as triangle normal - Constant color for polygon - Mach band effect flat shading

- Smooth or Gouraud shading (97) - Idea: better quality by respecting color variations on the polygon - Per vertex lighting - Linear interpolation of color using barycentric interpolation in triangles - In object space during ray-tracing - In screen space during scan conversion (OpenGL) - How to determine barycentric coordinates efficiently for every pixel A a D a C P E B a D = A + ( C A) a + a a a = A C a a + + a + a a a = A + C a + a a + a - Similar - Similar C C A a a b b b D P E E = B + C b + b b + b b B A a a b c c D P E P = D + E c + c c + c c c b B Gouraud shading Polygon shading - Does this algorithm work for polygons, i.e. non- triangles? 3

- Problems of Gouraud shading: - Loosing surface structure - No internal highlights - Phong shading (975): higher quality shading by interpolating normals rather than colors - Evaluates lighting model for every pixel Has to be done in object space Not supported by OpenGL Phong shading - Shading problems - Smooth surfaces, but polygonal borders (silhouette) - Inconsistencies in vertices - T-vertex (hanging node) - OpenGL shading Phong lighting Gouraud shading Phong lighting and shading - Scan conversion of primitives scanline v 0 Interpolation of per-vertex attributes along scanlines v v z Depth values: non-linear in [Z near, Z far ] due to perspective projection Z near Z far 4

- For perspective views,, linear interpolation of vertex parameters like color, texcoords, normals in screen space leads to wrong results - Linear (left( left) ) and rational linear (right) interpolation of texture coordinates in screen space Wrong interpolation in screen space P a A P A=0.5 Line with parameters P 0,P at vertices viewpoint P b B P =0.5 (P + P ) viewplane P B=0.5 P - Texture interpolation without perspective correction - Refinement in,4,64 Quads (=,8,8 Tris) - Relationship between spaces in CG Object-affine spaces Screen-affine spaces Object space World space Texture space (u,v) Homogeneous screen space (xw,yw,w) divby/w divbyw Homogeneous texture space (u/w,v/w,/w) Screen space (x,y) - Perspective correction (given:a,b; looking for A,B) a b P ' P = P + P ; P = a + b a + b w A B Aw + Bw P ' = P ' + P ' w = A + B A + B A + B ap ' / w + bp ' / w AP ' + BP ' P = = A = a + b Aw + Bw a / wp ' + b / w P ' P ' = a / w + b / w a w, B = b w Interpolate x/w, y/w, z/w, /w and divide through /w per pixel - (Wrong) algorithm for polygon rendering with linear interpolation - Associate parameters p,...,p n with each vertex - vertex object space coords to homogeneous screen space coords (xw,yw,zw,w) - Perform homogeneous division (x,y,z,) - Scan convert in screen space by linear interpolation of all parameters 5

- (Correct) algorithm for polygon rendering with linear interpolation Next: fragment processing - Operations on fragments before the become pixels - Associate parameters p,...,p n with each vertex - vertex object space coords to homogeneous screen space coords (xw,yw,zw,w) - At each vertex construct variable list (x,y,z,s,...,s n+ ) with s i =p i /w, s n+ =/w - Scan convert in screen space by linear interpolation of all parameters; ; at each pixel compute p i =s i /s /s n+ Geometry Scan Conversion Modelview Texturing Geometry Processing Lighting Fragment Tests Perspective Blending Clipping Framebuffer Fragment Processing 6