SUBJECT : COMPUTER GRAPHICS

Slides:



Advertisements
Similar presentations
CS 4731: Computer Graphics Lecture 20: Raster Graphics Part 1 Emmanuel Agu.
Advertisements

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.
OUTPUT PRIMITIVES Screen vs. World coordinate systems ● Objects positions are specified in a Cartesian coordinate system called World Coordinate.
CS 352: Computer Graphics Chapter 7: The Rendering Pipeline.
David Breen, William Regli and Maxim Peysakhov
Vertices and Fragments I CS4395: Computer Graphics 1 Mohan Sridharan Based on slides created by Edward Angel.
Modelling. Outline  Modelling methods  Editing models – adding detail  Polygonal models  Representing curves  Patched surfaces.
1 Jinxiang Chai CSCE 441 Computer Graphics. 2 Midterm Time: 10:10pm-11:20pm, 10/20 Location: HRBB 113.
Graphics Systems I-Chen Lin’s CG slides, Doug James’s CG slides Angel, Interactive Computer Graphics, Chap 1 Introduction to Graphics Pipeline.
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Models and Architectures Ed Angel Professor of Computer Science, Electrical and Computer.
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Implementation I Ed Angel Professor of Computer Science, Electrical and Computer Engineering,
Computer Graphics Panos Trahanias ΗΥ358 Spring 2009.
Jehee Lee Seoul National University
Computer Graphics An Introduction. What’s this course all about? 06/10/2015 Lecture 1 2 We will cover… Graphics programming and algorithms Graphics data.
C O M P U T E R G R A P H I C S Guoying Zhao 1 / 14 C O M P U T E R G R A P H I C S Guoying Zhao 1 / 14 Going-through.
CS 480/680 Computer Graphics Shading in OpenGL Dr. Frederick C Harris, Jr. Fall 2013.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
CS 325 Introduction to Computer Graphics 03 / 29 / 2010 Instructor: Michael Eckmann.
Review on Graphics Basics. Outline Polygon rendering pipeline Affine transformations Projective transformations Lighting and shading From vertices to.
Subject Name: Computer Graphics Subject Code: Textbook: “Computer Graphics”, C Version By Hearn and Baker Credits: 6 1.
CS COMPUTER GRAPHICS LABORATORY. LIST OF EXPERIMENTS 1.Implementation of Bresenhams Algorithm – Line, Circle, Ellipse. 2.Implementation of Line,
Handle By, S.JENILA AP/IT
CS559: Computer Graphics Final Review Li Zhang Spring 2010.
1Computer Graphics Implementation 1 Lecture 15 John Shearer Culture Lab – space 2
Lecture 13: Raster Graphics and Scan Conversion
Chapter 1 Graphics Systems and Models Models and Architectures.
1 Chapter 1: Introduction to Graphics. 2 What is computer graphics.
Applications and Rendering pipeline
Scan Conversion of Line Segments. What is Scan conversion? Final step of rasterization (the process of taking geometric shapes and converting them into.
Chapter 71 Computer Graphics - Chapter 7 From Vertices to Fragments Objectives are: How your program are processed by the system that you are using, Learning.
Chapter 10: Computer Graphics
Visible Surface Detection
- Introduction - Graphics Pipeline
Computer Graphics.
Photorealistic Rendering vs. Interactive 3D Graphics
Computer Graphics CC416 Week 13 Clipping.
Transformations contd.
Computer Graphics Shading in OpenGL
CS 4731: Computer Graphics Lecture 20: Raster Graphics Part 1
University of New Mexico
3D Graphics Rendering PPT By Ricardo Veguilla.
The Graphics Rendering Pipeline
CS451Real-time Rendering Pipeline
Real-time Computer Graphics Overview
Models and Architectures
Implementation I Ed Angel
Chapter 14 Shading Models.
Models and Architectures
Models and Architectures
Introduction to Computer Graphics with WebGL
3D Rendering Pipeline Hidden Surface Removal 3D Primitives
Implementation II Ed Angel Professor Emeritus of Computer Science
Introduction to Computer Graphics
Computer Graphics One of the central components of three-dimensional graphics has been a basic system that renders objects represented by a set of polygons.
Introduction to Computer Graphics with WebGL
Lecture 13 Clipping & Scan Conversion
Models and Architectures
COMP 575/770 Review Session May 4, 2016.
Models and Architectures
CS 4731: Computer Graphics Final review
Chapter 3 Graphics Output Primitives
Chapter 14 Shading Models.
Type to enter a caption. Computer Graphics Week 1Lecture 1.
Introduction to spagetti and meatballs
Implementation I Ed Angel Professor Emeritus of Computer Science
Implementation II Ed Angel Professor Emeritus of Computer Science
Introduction to 3D Graphics
Introduction to Computer Graphics
Presentation transcript:

SUBJECT : COMPUTER GRAPHICS ANJUMAN COLLEGE OF ENGINEERING & TECHNOLOGY Department of Computer Science & Engineering SUBJECT : COMPUTER GRAPHICS 5TH SEMESTER Prepared By: Ms. Sadia Patka Asst. Professor, CSE Dept.

SYLLABUS: Unit 1: Introduction to Computer Graphics Overview of Computer Graphics, Computer Graphics Application and Software, Graphics Areas, Graphics Pipeline, Graphics API’s, Numerical issues, Efficiency Display and Hardcopy Technologies, Display Technologies – Raster scan Display System, Video Controller – Vector scan display system, Random Scan Display Processor, Input Devices for Operator Interaction, Image Scanners Unit 2: Basic Raster Graphics Algorithms for Drawing 2D primitives, aliasing and ant aliasing, Polygon filling methods: Scan Conversion Algorithms: Simple Ordered edge list, Edge Fill, Fence fill and Edge Flag Algorithm. ,Seed fill Algorithms: Simple and Scan Line Seed Fill Algorithm, Halftoning techniques Unit 3: Graphics Programming using OPENGL: Why OpenGL, Features in OpenGL, OpenGL operations, Abstractions in OpenGL – GL, GLU & GLUT, 3D viewing pipeline, viewing matrix specifications, a few examples and demos of OpenGL programs, Animations in openGL

Unit 4: 2D Clipping algorithms for regular and irregular windows: Sutherland Cohen Outcode, Sutherland Cohen Subdivision, Mid-Point subdivision, Cyrus Beck and Sutherland Hodgeman, Cohen-Sutherland Polygon clipping Algorithm. Clipping about Concave regions. 2D Transformations, Translation, Rotation, Reflection, Scaling, Shearing Combined Transformation, Rotation and Reflection about an Arbitrary Line Unit 5: Normalized Device Coordinates and Viewing Transformations, 3D System Basics and 3D Transformations, 3D graphics projections, parallel, perspective, viewing transformations. 3D graphics hidden surfaces and line removal, painter’s algorithm, Z -buffers, Warnock’s algorithm. Unit 6: Basic Ray tracing Algorithm, Perspective, Computing Viewing Rays, Ray-Object Intersection Shading, A Ray tracing Program, Shadows, Ideal Specular Reflection. Curves and Surfaces: Polygon Mesh, Parametric Cubic Curves, Parametric Bicubic Surfaces, Quadratic Surface, Bezier Curves and B-spline curves.

COURSE OBJECTIVES: The main objective of the course is to introduce students with fundamental concepts and theory of computer graphics (CG). It presents the important drawing algorithm, polygon fitting, clipping and 2D transformation curves and an introduction to 3D transformation. It provides the basics of OpenGL application programming interface which allows students to develop programming skills in CG.

COURSE OUTCOMES: Upon the completion of the course students will be able to :- CO1: Explain the applications, areas, and graphic pipeline, display and hardcopy technologies. CO2: Apply and compare the algorithms for drawing 2D images also explain aliasing, anti aliasing and half toning techniques. CO3: Discuss OpenGL application programming Interface and apply it for 2D & 3D computer graphics. CO4: Analyze and apply clipping algorithms and transformation on 2D images. CO5: Solve the problems on viewing transformations and explain the projection and hidden surface removal algorithms. CO6: Explain basic ray tracing algorithm, shading, shadows, curves and surfaces and also solve the problems of curves.

Digital Differential Analyzer (DDA) LINE DRAWING ALGORITHM WITH SOLVED EXAMPLES

DDA LINE DRAWING ALGORITHM The line (vector) generation algorithms which determine the pixels that should be turned ON are called as digital differential analyzer (DDA). It is one of the technique for obtaining a rasterized straight line. This algorithm can be used to draw the line in all the quadrants.

DDA ALGORITHM Assumption: (x1, y1) and (x2, y2) are the two end points of a line and are not equal. Floor integer function is used to convert the real values into integer value. e.g.: if value is +8.5 then it is converted to 8 and if value is -8.5 then it is converted to 9. 3. Sign function is used which returns +1, 0, -1 for the arguments >0, =0, <0. e.g.: sign(5) = +1 , sign(0) = 0, sign(-1) = -1, sign (1) = 1

CONTD…. Step 1: Approximate the line length if abs(x2-x1)>= abs(y2-y1) then length = abs(x2-x1) else length = abs(y2-y1) end if   Step 2: Decide increment Δx = (x2-x1) / length Δy = (y2-y1) / length

CONTD…. Step 3: Decide flow (round the values rather than truncate to handle central pixel addressing correctly) x = x1 + 0.5 * sign(Δx) y = y1 + 0.5 * sign(Δy) Step 4: Begin main loop i = 1 while (i <= length) setpixel (intger x, integer y) x = x + Δx y = y + Δy i = i + 1 end while finish

Examples Q. 1 Rasterize the line from (0, 0) to (5,5) using DDA algorithm. Solution:

Solution of Q.1 CONTD….

Solution of Q.1 CONTD…. Result :- The points obtain to rasterize a line from (0, 0) to (5, 5) are : (0, 0) (1, 1) (2, 2) (3, 3) (4, 4)

Note In Question 1, the end points to draw the line are given directly so, the steps of the algorithm are followed to implement it. But if the end points are not given and instead the equation is given then first we have to find the end points of a line from that equation and then follow the steps of algorithm. The procedure is demonstrated in Q.2 by solving the question asked in university paper.

Q. 2 Rasterize the line for the equation x/2 + y/10 = 1 using DDA line algorithm. Solution: Given is x/2 + y/10 = 1 --------eq. (1) Put x = 0 in eq. 1 , then y = 10 the 1st end point (x1,y1) is (0,10) Put y = 0 in eq. 1 , then x = 2 the 2nd end point (x2,y2) is (2,0) Here, x1=0 , y1=10 , x2=2 , y2=0

Solution of Q.2 CONTD…. Step 1: abs(x2-x1) = abs(2-0) = 2 abs(y2-y1) = abs(0-10) = 10 Here, abs (y2-y1)> abs(x2-x1) length =10 Step 2: Δx = (x2-x1) / length = (2-0)/10 = 0.2 Δy = (y2-y1) / length = (0-10)/10 = -1

Solution of Q.2 CONTD…. Step 3: x = x1 + 0.5 * sign(Δx) x = 0 + 0.5 * sign (0.2) x = 0 + 0.5 * 1  x = 0.5 y = y1 + 0.5 * sign(Δy) y = 10 + 0.5 * sign (-1) y = 10 + 0.5 * -1  x = 9.5

Step 4: Solution of Q.2 CONTD…. 1 (0,9) 0.5 9.5 2 (0,8) 0.7 8.5 3 Set pixel x y 1 (0,9) 0.5 9.5 2 (0,8) 0.7 8.5 3 (0,7) 0.9 7.5 4 (1,6) 1.1 6.5 5 (1,5) 1.3 5.5 6 (1,4) 1.5 4.5 7 (1,3) 1.7 3.5 8 (1,2) 1.9 2.5 9 (2,1) 2.1 10 (2,0) 2.3 11 END -0.5

Solution of Q.2 CONTD…. Result :- 10 The points obtain to rasterize a line for the equation x/2 + y/10 = 1 are : (0,9) (0,8) (0,7) (1,6) (1,5) (1,4) (1,3) (1,2) (2,1) (2,0) 9 8 7 6 5 4 3 2 1 1 2 3 4 5 6

Advantages and Disadvantages of DDA Simplest line drawing algorithm No special skills required for its implementation DDA draws the line faster than drawing the line by directly using the line equation. Disadvantages : It dependents on orientation which makes the end point accuracy poor. It requires floating point addition to determine each successive point which is time consuming. Error due to limited precision in floating point representation may cause calculated points to shift away from their actual position when the line is relatively long.

THANK YOU