Rendering.

Slides:



Advertisements
Similar presentations
Visible-Surface Detection(identification)
Advertisements

Graphics Primitives: line
CS 4731: Computer Graphics Lecture 20: Raster Graphics Part 1 Emmanuel Agu.
Section 3-1 to 3-2, 3-5 Drawing Lines Some of the material in these slides may have been adapted from university of Virginia, MIT, and Åbo Akademi University.
1 King ABDUL AZIZ University Faculty Of Computing and Information Technology CS 454 Computer graphics Drawing Elementary Figures Dr. Eng. Farag Elnagahy.
CS 450: COMPUTER GRAPHICS REVIEW: DRAWING LINES AND CIRCLES SPRING 2015 DR. MICHAEL J. REALE.
Line Drawing Algorithms. Rasterization-Process of determining which pixels give the best approximation to a desired line on the screen. Scan Conversion-Digitizing.
30/9/2008Lecture 21 Computer Graphics Assistant Professor Dr. Sana’a Wafa Al-Sayegh 2 nd Semester ITGD3107 University of Palestine.
Drawing lines. Line algorithm 1: DDA Simple, but uses floating point values Xdifference = (Xend-Xstart) Ydifference = (Yend-Ystart) y = Ystart delta_Y.
Part I: Basics of Computer Graphics
Output Primitives Computer Graphics.
Implementation Dr. Amy Zhang. Reading 2  Hill, Chapters  Hill, Chapter 10.
Chapter 6: Vertices to Fragments Part 2 E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley Mohan Sridharan Based on Slides.
Implementation III Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico.
Computer Graphics 14: Surface Detection Methods
Hidden Surface Elimination Wen-Chieh (Steve) Lin Institute of Multimedia Engineering I-Chen Lin’ CG Slides, Rich Riesenfeld’s CG Slides, Shirley, Fundamentals.
1 CSCE 441: Computer Graphics Hidden Surface Removal (Cont.) Jinxiang Chai.
Vertices and Fragments III Mohan Sridharan Based on slides created by Edward Angel 1 CS4395: Computer Graphics.
Line Drawing by Algorithm. Line Drawing Algorithms Line drawn as pixels Graphics system –Projects the endpoints to their pixel locations in the frame.
CS 450: COMPUTER GRAPHICS DRAWING LINES AND CIRCLES SPRING 2015 DR. MICHAEL J. REALE.
Scan Conversion Line and Circle
Technology and Historical Overview. Introduction to 3d Computer Graphics  3D computer graphics is the science, study, and method of projecting a mathematical.
Informationsteknologi Monday, November 26, 2007Computer Graphics - Class 121 Today’s class Drawing lines Bresenham’s algorithm Compositing Polygon filling.
Triangle Scan Conversion. 2 Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009 Rasterization Rasterization (scan conversion) –Determine which.
CS 325 Introduction to Computer Graphics 02 / 01 / 2010 Instructor: Michael Eckmann.
Graphics Pipeline Rasterization CMSC 435/634. Drawing Terms Primitive – Basic shape, drawn directly – Compare to building from simpler shapes Rasterization.
1Computer Graphics Implementation III Lecture 17 John Shearer Culture Lab – space 2
Introduction to Computer Graphics with WebGL
CS 480/680 Computer Graphics Implementation III Dr. Frederick C Harris, Jr. Fall 2011.
Advanced Computer Graphics Depth & Stencil Buffers / Rendering to Textures CO2409 Computer Graphics Week 19.
10/26/04© University of Wisconsin, CS559 Fall 2004 Last Time Drawing lines Polygon fill rules Midterm Oct 28.
Visible-Surface Detection Jehee Lee Seoul National University.
Quadratic Surfaces. SPLINE REPRESENTATIONS a spline is a flexible strip used to produce a smooth curve through a designated set of points. We.
Hidden Surface Removal 1.  Suppose that we have the polyhedron which has 3 totally visible surfaces, 4 totally invisible/hidden surfaces, and 1 partially.
Scan Conversion. Last step in the graphics pipeline Efficiency is a central issue Common primitives – Lines (done last class) – Polygons (fill polygons,
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
1Computer Graphics Implementation II Lecture 16 John Shearer Culture Lab – space 2
Implementation II Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico.
1 Perception and VR MONT 104S, Fall 2008 Lecture 21 More Graphics for VR.
Chris Mayer & Nic Shulver Hidden Surface Wire frame drawings Wire frame drawings are quick to produce but are often confusing It is difficult to determine.
Hidden Surface Removal
Implementation II.
CS-321 Dr. Mark L. Hornick 1 Line Drawing Algorithms.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2013 Tamara Munzner Rasterization.
Institute for Visualization and Perception Research 1 © Copyright 2000 Haim Levkowitz Primitives Points … Lines … Circles, ellipses, conics, curves, disks.
GEOMETRY AND LINE GENERATION Geometry and Line Generation Chapter 2.
In the name of God Computer Graphics. Today Introduction Sampling Graphic Output Primitives 1.Line 2.Circle 3.Curve 4.polygon.
Computer Graphics I, Fall 2010 Implementation II.
Learning Objectives Classification of Visible Surface Detection Algorithms Classification of Visible Surface Detection Algorithms Back-Face Detection Back-Face.
Visible-Surface Detection Methods. To identify those parts of a scene that are visible from a chosen viewing position. Surfaces which are obscured by.
Computer Graphics Inf4/MSc Computer Graphics Lecture 4 Line & Circle Drawing.
10/10/2006TCSS458A Isabelle Bichindaritz1 Line and Circle Drawing Algorithms.
Scan Conversion of Line Segments. What is Scan conversion? Final step of rasterization (the process of taking geometric shapes and converting them into.
Computer Graphics : output primitives.. 2 of 32 T1 – pp. 103–123, 137–145, 147–150, 164–171 Points and LinesPoints Line Drawing AlgorithmsLine Mid–Point.
Computer Graphics I, Fall 2010 Scan conversion algorithms.
Rasterization, or “What is glBegin(GL_LINES) really doing?” Course web page: February 23, 2012  Lecture 4.
Computer Graphics Implementation II
Lecture 8 Shear and Line Drawing Algorithms
University of New Mexico
Implementation III.
Introduction to Computer Graphics with WebGL
3D Rendering Pipeline Hidden Surface Removal 3D Primitives
2D Scan-line Conversion
Rasterization and Antialiasing
Visibility (hidden surface removal)
Computer Graphics Implementation III
Rasterization and Antialiasing
Primitive Drawing Algorithm
Primitive Drawing Algorithm
Implementation III Ed Angel Professor Emeritus of Computer Science
Presentation transcript:

Rendering

Contents Objective Rendering of lines Polygons rendering DDA algorithm Bresenham algorithm Polygons rendering Polygons filling Visible surface detection

Rendering There is information about: The objective is to calculate: Topology of the scene Coordinates of the projected vertexes Intensity in the vertex or in each point Z coordinate in the vertex The objective is to calculate: Color in each pixel

Rendering of lines Input data: the coordinates of the two vertex It must be calculated the pixels that must be set It produces an incorrect solution to set all the pixels where the line goes through. Incorrect solution Correct solution

DDA algorith (Digital Diferential Analyzer) dx = xb - xa dy = yb - ya x = xa y = ya If (Abs(dx) > Abs(dy)) Then steps = Abs(dx) Else steps = Abs(dy) End If xIncrement = dx / steps yIncrement = dy / steps Call Plot(x, y) For k = 0 To steps - 1 x = x + xIncrement y = y + yIncrement Next k

Bresenham algorithm DDA works with real numbers Bresenham algorithm was developed for digital plotters It is based on: Incrementing the biggest dimension The other coordinate increments 0 or 1 The error is controlled with the difference between the line and the start of the nearest pixel 1/2 1

Bresenham algorithm The error increments with the value of the slope: e = e + dy/dx When error > 1/2: It increments y It subtracts 1 from error The process starts with: e = -1/2 The control is made with e > 0

Bresenham algorithm Operations with e: x and y are integer e is real initialization: e = dy/dx - 1/2 increments: e = e + dy/dx Control: if (e>0) then e = e -1, x = x + 1 x and y are integer e is real To work with integers, we multiply error by 2 • dx

Bresenham algorithm dx = Abs(xa - xb) dy = Abs(ya - yb) e = 2 * dy - dx If (xa > xb) Then x = xb y = yb xEnd = xa Else x = xa y = ya xEnd = xb End If Call Plot(x, y) Do While (x < xEnd) x = x + 1 If (e > 0) Then y = y + 1 e = e - 2 * dx End If e = e + 2 * dy Loop

Polygons rendering It is processed line by line (scan line) It is filled inside the start and end of each edge For the polygon, only the red pixels are need

Rendering of edges of polygons There is need a pixel by horizontal line (scan line) The algorithms are modifications of the DDA or Bresenham algorithms, example with modification of DDA: dx = xb - xa dy = yb - ya x = xa increment = dx / dy For y = ya To yb Call Plot(x, y) x = x + increment Next y

Filling between edges In each line (scan line) there is an even number of edges. In convex polygons there are always 2 edges. In the filling process, the shading and z coordinate is calculated. The rendering can be done in two ways: scan line (one line at a time) polygon by polygon

Scan line The image is calculated line by line, starting usually by the top line. In each line: The process calculates the list of edges in that line (it is done adding new edges and eliminating the edges that have ended) In each pixel: Calculate the values of the polygon in this pixel, interpolating from the values in the edges (incrementally) Render the values of the pixel nearest to the point of view

Polygon by polygon The image is generated polygon by polygon. In each polygon: For each horizontal line between ymax and ymin of the polygon: Get the list of edges in the line. Render the pixels between this edges if this is the nearest polygon to the point of view (the z value is stored)

Elimination of hidden surfaces Historically, there has been different methods to solve this problem. One of the most known methods it the painter’s algorithm: paint the polygons from furthest to closest. Currently, the Z-buffer is used It is the method can be used in the rendering polygon by polygon It is implemented in the hardware of graphic cards.

Z buffer It uses a matrix with the values of the z coordinate for each pixel It allows rendering the polygons one on one. When rendering a polygon, the value of the z coordinate is compared with the z value stored for that pixel, if it is closest, it is rendered and their z value stored in the matrix.

Scenes creation Storyboard Models of the objects Position Initial rendering Modifications Rendering final

http://www.pixar.com/howwedoit/index.html