EF432. Introduction to spagetti and meatballs

Similar documents
Topic 0. Introduction: What Is Computer Graphics? CSC 418/2504: Computer Graphics EF432. Today s Topics. What is Computer Graphics?

EF432. Introduction to spagetti and meatballs

0. Introduction: What is Computer Graphics? 1. Basics of scan conversion (line drawing) 2. Representing 2D curves

CSCD18: Computer Graphics. Instructor: Leonid Sigal

Rendering. A simple X program to illustrate rendering

From Ver(ces to Fragments: Rasteriza(on

COMP371 COMPUTER GRAPHICS

Rendering. A simple X program to illustrate rendering

Lecture 6 of 41. Scan Conversion 1 of 2: Midpoint Algorithm for Lines and Ellipses

Lecture 6 of 41. Scan Conversion 1 of 2: Midpoint Algorithm for Lines and Ellipses

Tópicos de Computação Gráfica Topics in Computer Graphics 10509: Doutoramento em Engenharia Informática. Chap. 2 Rasterization.

Line Drawing. Foundations of Computer Graphics Torsten Möller

Scan Conversion. Drawing Lines Drawing Circles

From Vertices to Fragments: Rasterization. Reading Assignment: Chapter 7. Special memory where pixel colors are stored.

Announcements. Midterms graded back at the end of class Help session on Assignment 3 for last ~20 minutes of class. Computer Graphics

CS 4731: Computer Graphics Lecture 21: Raster Graphics: Drawing Lines. Emmanuel Agu

Line Drawing. Introduction to Computer Graphics Torsten Möller / Mike Phillips. Machiraju/Zhang/Möller

Scan Conversion. CMP 477 Computer Graphics S. A. Arekete

OpenGL Graphics System. 2D Graphics Primitives. Drawing 2D Graphics Primitives. 2D Graphics Primitives. Mathematical 2D Primitives.

Topic #1: Rasterization (Scan Conversion)

Computer Graphics. - Rasterization - Philipp Slusallek

CS 543: Computer Graphics. Rasterization

The Traditional Graphics Pipeline

CHAPTER 1 Graphics Systems and Models 3

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

Computer Graphics (CS 543) Lecture 10: Rasterization and Antialiasing

The Traditional Graphics Pipeline

FROM VERTICES TO FRAGMENTS. Lecture 5 Comp3080 Computer Graphics HKBU

Realtime 3D Computer Graphics Virtual Reality

2D rendering takes a photo of the 2D scene with a virtual camera that selects an axis aligned rectangle from the scene. The photograph is placed into

Fall CSCI 420: Computer Graphics. 7.1 Rasterization. Hao Li.

CSCI 420 Computer Graphics Lecture 14. Rasterization. Scan Conversion Antialiasing [Angel Ch. 6] Jernej Barbic University of Southern California

Raster Displays and Scan Conversion. Computer Graphics, CSCD18 Fall 2008 Instructor: Leonid Sigal

Chapter 8: Implementation- Clipping and Rasterization

Rasterization. Rasterization (scan conversion) Digital Differential Analyzer (DDA) Rasterizing a line. Digital Differential Analyzer (DDA)

COMP30019 Graphics and Interaction Scan Converting Polygons and Lines

Department of Computer Sciences Graphics Fall 2003 (Lecture 2) Pixels

The Traditional Graphics Pipeline

About the Tutorial. Audience. Prerequisites. Copyright & Disclaimer. Computer Graphics

graphics pipeline computer graphics graphics pipeline 2009 fabio pellacini 1

Display Technologies: CRTs Raster Displays

graphics pipeline computer graphics graphics pipeline 2009 fabio pellacini 1

Computer Graphics. Lecture 2. Doç. Dr. Mehmet Gokturk

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

CS 130 Final. Fall 2015

CIS 581 Interactive Computer Graphics (slides based on Dr. Han-Wei Shen s slides) Requirements. Reference Books. Textbook

CPSC / Scan Conversion

Computer Graphics D Graphics Algorithms

Rasterization: Geometric Primitives

Output Primitives Lecture: 3. Lecture 3. Output Primitives. Assuming we have a raster display, a picture is completely specified by:

Chapter - 2: Geometry and Line Generations

Computer Graphics Introduction. Taku Komura

Graphics (Output) Primitives. Chapters 3 & 4

1 Introduction to Graphics

Introduction to Computer Graphics. Knowledge basic concepts 2D and 3D computer graphics

UNIT -8 IMPLEMENTATION

Lecturer Athanasios Nikolaidis

Einführung in Visual Computing

Computer Graphics Disciplines. Grading. Textbooks. Course Overview. Assignment Policies. Computer Graphics Goals I

Overview of Computer Graphics

Computer Graphics D Graphics Algorithms

Renderer Implementation: Basics and Clipping. Overview. Preliminaries. David Carr Virtual Environments, Fundamentals Spring 2005

Course Title: Computer Graphics Course no: CSC209

Computer Graphics. Instructor: Oren Kapah. Office Hours: T.B.A.

Lahore University of Management Sciences. CS 452 Computer Graphics

History of computer graphics

Today. Rendering algorithms. Rendering algorithms. Images. Images. Rendering Algorithms. Course overview Organization Introduction to ray tracing

Rasterization, or What is glbegin(gl_lines) really doing?

Animation & Rendering

Outline. Properties of Piecewise Linear Interpolations. The de Casteljau Algorithm. Recall: Linear Interpolation

2D Image Synthesis. 2D image synthesis. Raster graphics systems. Modeling transformation. Vectorization. u x u y 0. o x o y 1

Today. Rendering algorithms. Rendering algorithms. Images. Images. Rendering Algorithms. Course overview Organization Introduction to ray tracing

Introduction to Computer Graphics (CS602) Lecture 05 Line Drawing Techniques

CS 130. Scan Conversion. Raster Graphics

RASTERIZING POLYGONS IN IMAGE SPACE

From 3D World to 2D Screen. Hendrik Speleers

Computer Graphics I Lecture 11

Computer Graphics: Graphics Output Primitives Line Drawing Algorithms

Outline. The de Casteljau Algorithm. Properties of Piecewise Linear Interpolations. Recall: Linear Interpolation

Topics and things to know about them:

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

Introduction to Visualization and Computer Graphics

Institutionen för systemteknik

Lahore University of Management Sciences. CS 452 Computer Graphics

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

Painter s HSR Algorithm

From Vertices To Fragments-1

CS 130 Exam I. Fall 2015

Line Drawing Week 6, Lecture 9

CS 248 Assignment 2 Polygon Scan Converter. CS248 Presented by Abe Davis Stanford University October 17, 2008

Clipping and Scan Conversion

Graphics and Interaction Rendering pipeline & object modelling

Lecture 0 of 41: Part A Course Organization. Introduction to Computer Graphics: Course Organization and Survey

CHETTINAD COLLEGE OF ENGINEERING & TECHNOLOGY CS2401 COMPUTER GRAPHICS QUESTION BANK

CS123 INTRODUCTION TO COMPUTER GRAPHICS. Describing Shapes. Constructing Objects in Computer Graphics 1/15

CS Rasterization. Junqiao Zhao 赵君峤

CIS 581 Interactive Computer Graphics

CSE328 Fundamentals of Computer Graphics: Concepts, Theory, Algorithms, and Applications

More Raster Line Issues. Bresenham Circles. Once More: 8-Pt Symmetry. Only 1 Octant Needed. Spring 2013 CS5600

Cs602-computer graphics MCQS MIDTERM EXAMINATION SOLVED BY ~ LIBRIANSMINE ~

Transcription:

EF432 Introduction to spagetti and meatballs

CSC 418/2504: Computer Graphics Course web site (includes course information sheet): http://www.dgp.toronto.edu/~karan/courses/418/fall2015 Instructor: Karan Singh Office: BA 5258 Phone: 978-7201 Email: karan@dgp.toronto.edu Hours: W 2-4 (or by appointment) Textbooks: Fundamentals of Computer Graphics OpenGL Programming Guide & Reference Tutorials: (first tutorial next week)

Today s Topics 0. Introduction: What is Computer Graphics? 1. Basics of scan conversion (line drawing) 2. Representing 2D curves

Topic 0. Introduction: What Is Computer Graphics?

What is Computer Graphics? Computers: accept, process, transform and present information. Computer Graphics: accept, process, transform and present information in a visual form.

Ok but what is the course really about? The science of turning the rules of geometry, motion and physics into (digital) pictures that mean something to people What its not about? Photoshop, AutoCAD, Maya, Renderman, Graphics APIs. wow, heavy math and computer science!!

Movies Movies define directions in CG Set quality standards Driving medium for CG

Games Games emphasize the interactivity and AI Push CG hardware to the limits (for real time performance)

Design CG for prototyping and fabrication Requires precision modeling and engineering visualization

Scientific and Medical Visualization, Operation Requires handling large datasets May need device integration Real-time interactive modeling & visualization

GUIs, AR/VR, scanners Interaction with software & hardware, I/O of 3D data Emphasis on usability

Computer Graphics: Basic Questions Form (modeling) How do we represent (2D or 3D) objects & environments? How do we build these representations? Function, Behavior (animation) How do we represent the way objects move? How do we define & control their motion? Appearance (rendering) How do we represent the appearance of objects? How do we simulate the image-forming process?

What is an Image? Image = distribution of light energy on 2D film Digital images represented as rectangular arrays of pixels

Form & Appearance in CG illumination camera shape/surface geometry & reflectance pixel array

The Graphics Pipeline Modeling Animation Rendering Geometry: points, curves, & surfaces Scene Objects: parts, relations, & pose Texture and reflectance (e.g., color, diffusivity, opacity, refractions) Key-frame, motion capture, inverse kinematics, dynamics, behaviors, motion planning, Visibility Simulation of light (e.g., illuminants, emissive surfaces, scattering, transmission, diffraction, ) Special effects (e.g., antialiasing, motion blur, nonphotorealism)

Graphics Pipeline: Modeling How do we represent an object geometrically on a computer? How do we represent an object geometrically on a computer? Point clouds Polygon meshes Texture maps Smooth surface patches Parametric curves

Graphics Pipeline: Animation Physical simulation Key-Framing Behavior rules

Graphics Pipeline: Rendering Input: Scene description, lighting, camera Output: Image that the camera will observe accounting for visibility, clipping, projection,

Course Topics Principles Theoretical & practical foundations of CG (core mathematics, physics, modeling methods) CG programming (assignments & tutorials) Experience with OpenGL (industry-standard CG library) Creating CG scenes

What You Will Take Away #1: yes, math IS useful in CS!! #2: how to turn math & physics into pictures #3: basics of image synthesis #4: how to code CG tools

Administrivia Grading: 50%: 3 assignments handed out usually on WEDNESDAY (25% 15% 10%) 50%: 1 test in class (15%) + 1 final exam (35%) First assignment: on web in two weeks Wooden Monkey assignment on web! Check web for schedule, dates, more details & policy on late assignments Tutorial sessions: Math refreshers, OpenGL tutorials, additional topics Attendance STRONGLY encouraged since I will not be lecturing on these topics in class Lecture slides & course notes, already on web.

Topic 1. Basic Raster Operations: Line Drawing A simple (but inefficient) line drawing algorithm Bresenham s algorithm Line anti-aliasing

2D Drawing Common geometric primitives: When drawing a picture, 2D geometric primitives are specified as if they are drawn on a continuous plane Drawing command: Draw a line from point (10,5) to point (80,60) y (80,60) (10,5) x

2D Drawing In reality, computer displays are arrays of pixels, not abstract mathematical continuous planes Continuous line (80,60) Digital line y y (10,5) x x In graphics, the conversion from continuous to discrete 2D primitives is called scan conversion or rasterization

Basic Raster Operations (for 2D lines) 1. Scan conversion Given a pair of pixels defining the line s endpoints & a color, paint all pixels that lie on the line 2. Clipping If one or more endpoints is out of bounds, paint only the line segment that is within bounds 3. Region filling

Line Scan Conversion: Key Objectives Accuracy: pixels should approximate line closely. Speed: line drawing should be efficient Digital line Visual Quality: No discernable artifacts.

Equation of a Line Explicit : y = mx + b Parametric : x(t) = x0 + (x1 x0)*t y(t) = y0 + (y1 y0)*t P = P0 + (P1-P0)*t P = P0*(1-t) + P1*t (weighted sum) Implicit : (x-x0)dy - (y-y0)dx = 0

Algorithm I DDA (Digital Differential Analyzer) Explicit form: y= dy/dx * (x-x0) + y0 float y; int x; dx = x1-x0; dy = y1 y0; m = dy/dx; y= y0 + 0.5; for ( x=x0; x<=x1; x++) { setpixel (x, floor(y)); y= y + m; }

Algorithm I DDA (Digital Differential Analyzer) Explicit form: y= dy/dx * (x-x0) + y0 float y; int x; dx = x1-x0; dy = y1 y0; m = dy/dx; y= y0 + 0.5; for ( x=x0; x<=x1; x++) { setpixel (x, floor(y)); y= y + m; }

Algorithm II Bresenham Algorithm Slope is rational (ratio of two integers). m = (y1 - y0) / (x1 - x0). Assume line slope <1 (first quadrant), implying that in y i+1 = y i + m, y i+1 is never more than one unit away from y i. If we only maintained the fractional part of y, we could draw a line by incrementing y when this fraction exceeded one. fraction += m; if (fraction >= 1) { y = y + 1; fraction -= 1; } If we initialize fraction with 0.5, then rounding off is handled

Algorithm II Bresenham Algorithm: Implicit View f(x,y) = x*dy y*dx =0 // for points on the line >0 // below the line <0 // above the line f(x+1,y+ 0.5) = f(x,y) + dy - 0.5*dx f(1,0.5) = dy - 0.5*dx -ve: pick (1,0) +ve: pick (1,1) (1,1) (0,0) (1,0) err = 2f(x+1,y+ 0.5) = 2f(x,y) + 2dy dx // getting rid of the float -ve: 2f(x+1,y) = 2f(x,y) + 2dy +ve: 2f(x+1,y+1) = f(x,y) +dy-dx err = err + 2dy err = err + 2dy - 2dx

Aliasing Raster line drawing can produce a jaggy appearance. Jaggy Jaggies are an instance of a phenomenon called aliasing. Removal of these artifacts is called anti-aliasing.

Anti-Aliasing How can we make a digital line appear less jaggy? Aliased line Anti-aliased line Intensity proportional to pixel area covered by thick line Main idea: Rather than just drawing in 0 s and 1 s, use inbetween values in neighborhood of the mathematical line.

Anti-Aliasing: Example Aliased line Anti-aliased line

Topic 2. 2D Curve Representations Explicit representation Parametric representation Implicit representation Tangent & normal vectors

Explicit Curve Representations: Definition Curve represented by a function f such that: y=f(x) line: y=mx+b f(a) a

Explicit Curve Representations: Limitations Curve represented by a function f such that: y=f(x) f(a) a

Parametric Curve Representation: Definition Curve represented by two functions f x, f y And an interval [a,b] such that: (x,y)=( f x (t), f y (t) ) are points on the curve for t in [a,b] ( f x (t), f y (t) ) A curve is closed when??

Parametric Representation of a Line Segment p(t) = p0 + (p1 p0)*t, 0 t 1 0 t : ray from p0 through p1 p1 - t : line through p0 and p1 p0 In general if p(t) = a0 + a1*t, how do you solve for a0, a1?

Line Segment as interpolation p(t) = a0 + a1*t p1 p3 p0 p2

Curve as interpolation (Catmull-Romm) p(t) = a0 + a1*t + a2*t 2 + a3*t 3 p1 p3 p0 p2

Polygons Polygon: A continuous piecewise linear closed curve. Simple polygon: non-self intersecting. Convex: all angle less than 180 degrees. Regular: simple, equilateral, equiangular. n-gon: pi = r(cos(2πi/n), sin(2πi/n)), 0 i <n p0 p2 p1

Representations of a Circle Parametric: p(t) = r(cos(2πt), sin(2πt)), 0 t 1 Implicit: r x 2 +y 2 -r 2 =0

Representations of an Ellipse Parametric: p(t) = (a*cos(2πt), b*sin(2πt)), 0 t 1 Implicit: x 2 /a 2 +y 2 /b 2-1=0 b a

Curve tangent and normal Parametric: p(t) = (x(t),y(t)). Tangent: (x (t),y (t)). Implicit: f(x,y) =0. Normal: gradient(f(x,y)).