2D Viewing. Viewing Pipeline: Window-Viewport Transf.

Similar documents
Two-Dimensional Viewing. Chapter 6

Computer Graphics: Two Dimensional Viewing

Computer Graphics. The Two-Dimensional Viewing. Somsak Walairacht, Computer Engineering, KMITL

Computer Graphics Viewing Objective

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

CSCI 4620/8626. Computer Graphics Clipping Algorithms (Chapter 8-5 )

Part IV. 2D Clipping

3D Rendering Pipeline (for direct illumination)

Unit 3 Transformations and Clipping

From Vertices To Fragments-1

DHANALAKSHMI COLLEGE OF ENGINEERING, CHENNAI

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

Chapter 8: Implementation- Clipping and Rasterization

Werner Purgathofer

Overview. Pipeline implementation I. Overview. Required Tasks. Preliminaries Clipping. Hidden Surface removal

Clipping Algorithms; 8-5. Computer Graphics. Spring CS4815

Viewing Transformation. Clipping. 2-D Viewing Transformation

Clipping Points Consider a clip window which is rectangular in shape. P(x, y) is a point to be displayed.

Clipping and Scan Conversion

CS184 : Foundations of Computer Graphics Professor David Forsyth Final Examination

Last class. A vertex (w x, w y, w z, w) - clipping is in the - windowing and viewport normalized view volume if: - scan conversion/ rasterization

3D Graphics Pipeline II Clipping. Instructor Stephen J. Guy

Clipping. Angel and Shreiner: Interactive Computer Graphics 7E Addison-Wesley 2015

Examples. Clipping. The Rendering Pipeline. View Frustum. Normalization. How it is done. Types of operations. Removing what is not seen on the screen

CS184 : Foundations of Computer Graphics Professor David Forsyth Final Examination (Total: 100 marks)

Computer Graphics (CS 543) Lecture 9 (Part 2): Clipping. Prof Emmanuel Agu. Computer Science Dept. Worcester Polytechnic Institute (WPI)

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

FROM VERTICES TO FRAGMENTS. Lecture 5 Comp3080 Computer Graphics HKBU

Computer Graphics. - Clipping - Philipp Slusallek & Stefan Lemme

VISIBILITY & CULLING. Don t draw what you can t see. Thomas Larsson, Afshin Ameri DVA338, Spring 2018, MDH

Einführung in Visual Computing

Clipping Lines. Dr. Scott Schaefer

window World space (Object space)

Topics. From vertices to fragments

Computer Science 474 Spring 2010 Viewing Transformation

Hidden Surfaces II. Week 9, Mon Mar 15

(a) rotating 45 0 about the origin and then translating in the direction of vector I by 4 units and (b) translating and then rotation.

CS602 MCQ,s for midterm paper with reference solved by Shahid

Realtime 3D Computer Graphics Virtual Reality

Roll No. : Invigilator's Signature :.. GRAPHICS AND MULTIMEDIA. Time Allotted : 3 Hours Full Marks : 70

Computer Graphics Geometry and Transform

MODULE - 9. Subject: Computer Science. Module: Line Clipping. Module No: CS/CGV/9

15. Clipping. Projection Transformation. Projection Matrix. Perspective Division

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

521493S Computer Graphics Exercise 1 (Chapters 1-3)

Three-Dimensional Viewing Hearn & Baker Chapter 7

3D Polygon Rendering. Many applications use rendering of 3D polygons with direct illumination

Visible Surface Detection Methods

The University of Calgary

Projection Lecture Series

OXFORD ENGINEERING COLLEGE (NAAC Accredited with B Grade) DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING LIST OF QUESTIONS

UNIT 2. Translation/ Scaling/ Rotation. Unit-02/Lecture-01

Lecture 7 of 41. Viewing 4 of 4: Culling and Clipping Lab 1b: Flash Intro

Today. CS-184: Computer Graphics. Lecture #10: Clipping and Hidden Surfaces. Clipping. Hidden Surface Removal

SE Mock Online Test 1-CG

Course Title: Computer Graphics Course no: CSC209

CS602- Computer Graphics Solved MCQS From Midterm Papers. MIDTERM EXAMINATION Spring 2013 CS602- Computer Graphics

SRM INSTITUTE OF SCIENCE AND TECHNOLOGY

CS123 INTRODUCTION TO COMPUTER GRAPHICS. Clipping. Concepts, Algorithms for line clipping. 1 of 16. Andries van Dam. Clipping - 10/12/17

Sung-Eui Yoon ( 윤성의 )

Page 1. Area-Subdivision Algorithms z-buffer Algorithm List Priority Algorithms BSP (Binary Space Partitioning Tree) Scan-line Algorithms

Windowing And Clipping (14 Marks)

CS 591B Lecture 9: The OpenGL Rendering Pipeline

UNIVERSITY OF NEBRASKA AT OMAHA Computer Science 4620/8626 Computer Graphics Spring 2014 Homework Set 1 Suggested Answers

CSE528 Computer Graphics: Theory, Algorithms, and Applications

Two Dimensional Viewing

S U N G - E U I YO O N, K A I S T R E N D E R I N G F R E E LY A VA I L A B L E O N T H E I N T E R N E T

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

CS 112 The Rendering Pipeline. Slide 1

Rasterization Overview

CSE328 Fundamentals of Computer Graphics

CS488. Implementation of projections. Luc RENAMBOT

CS 450: COMPUTER GRAPHICS REVIEW: CLIPPING SPRING 2015 DR. MICHAEL J. REALE

DC66 COMPUTER GRAPHICS JUN 2015

Computer Graphics II

From 3D World to 2D Screen. Hendrik Speleers

Clipping & Culling. Lecture 11 Spring Trivial Rejection Outcode Clipping Plane-at-a-time Clipping Backface Culling

8. Hidden Surface Elimination

Graphics Output Primitives

Set the Viewport. Set the Viewport Clipping. Set the Viewport. Set the Viewport. Set the Viewport. Resizing the Viewport W = H

Computer Graphics Geometry and Transform

Computer Graphics: 7-Polygon Rasterization, Clipping

SRM ARTS AND SCIENCE COLLEGE SRM NAGAR, KATTANKULATHUR

L1 - Introduction. Contents. Introduction of CAD/CAM system Components of CAD/CAM systems Basic concepts of graphics programming

CSCI 4620/8626. Coordinate Reference Frames

SAZ4C COMPUTER GRAPHICS. Unit : 1-5. SAZ4C Computer Graphics

Graphics and Interaction Rendering pipeline & object modelling

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

Binghamton University. EngiNet. Thomas J. Watson. School of Engineering and Applied Science. Computer Graphics. State University of New York.

CHETTINAD COLLEGE OF ENGINEERING & TECHNOLOGY CS2401 COMPUTER GRAPHICS QUESTION BANK

COMP30019 Graphics and Interaction Rendering pipeline & object modelling

Lecture outline. COMP30019 Graphics and Interaction Rendering pipeline & object modelling. Introduction to modelling

Scan Conversion of Polygons. Dr. Scott Schaefer

Introduction to Computer Graphics 5. Clipping

The Rendering Pipeline (1)

Visibility: Z Buffering

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

CS602 Midterm Subjective Solved with Reference By WELL WISHER (Aqua Leo)

Hidden surface removal. Computer Graphics

Graphics (Output) Primitives. Chapters 3 & 4

Transcription:

Viewing Pipeline: Window-Viewport Transf. 2D Viewing yw max clipping window: what to display viewport: where to be viewed translation, rotation, scaling, clipping,... Clipping Window yv max Viewport yv min yw min xw min xw max world coordinates Werner Purgathofer / Computergraphik 1 1 xv min xv max viewport coordinates 2-dim. Viewing-Transformation Pipeline Modeling construction of objects and scenes World definition of viewing area and orientation WC VC Transformation setting up a rotated world window in viewing coordinates and the corresponding normalized-coordinate viewport transformation to normalized viewing frame Normalized mapping to device dependent values Device Viewport Werner Purgathofer / Computergraphik 1 2 World Coordinates Werner Purgathofer / Computergraphik 1 3 Viewing Coordinate Reference Frame A viewingcoordinate frame is moved into coincidence with the world frame in two steps: (a) translate the viewing origin to the world origin (b) rotate to align the axes of the two systems. 2-dim. Viewing-Transformation Pipeline Modeling construction of objects and scenes transformation to normalized viewing frame World Normalized definition of viewing area and orientation mapping to device dependent values Device Werner Purgathofer / Computergraphik 1 4 Werner Purgathofer / Computergraphik 1 5 1

Window - Viewport Transform (1) point (xw,yw) in a designated window is mapped to viewport coordinates (xv,yv) so that relative positions in the two areas are the same. Window - Viewport Transform (2) linear in x and y (xw min /yw min ) (xv min /yv min ) (xw max /yw max ) (xv max /yv max ) Werner Purgathofer / Computergraphik 1 6 Werner Purgathofer / Computergraphik 1 7 t x Window - Viewport Transform (3) xw = xw min + λ ( ) where 0 λ 1 xv = xv min + λ (xv max xv min ) xw xw min λ = xw xw xv = xv min + min (xv max xv min ) xw = xv min min (xv max xv min ) + xw window-viewport transformation: xv = s x xw+t x Werner Purgathofer / Computergraphik 1 8 xv max xv min yv = s y.yw+t y s x 2-dim. Viewing-Transformation Pipeline Modeling construction of objects and scenes transformation to normalized viewing frame Werner Purgathofer / Computergraphik 1 9 World Normalized definition of viewing area and orientation mapping to device dependent values Device Workstation Transformation Viewing Window Normalized Space 1 Viewport 0 0 1 Viewport Device 1 Clipping partly visible or completely invisible parts must not be ignored and must not be drawn ignored scrolled [Mapping selected parts of a scene in normalized coordinates to different video monitors with workstation transformations] Viewport Device 2 vertices must be cut off (if possible in world coordinates) edges Werner Purgathofer / Computergraphik 1 10 Werner Purgathofer / Computergraphik 1 11 2

Clipping Operations remove objects outside a clip window clip window: rectangle, polygon, curved boundaries applied in world or viewing coordinates combined with scan conversion objects to clip: points, lines, polygons, curves, text,... 3 Possibilities for Clipping analytically = in world coordinates reduces WC DC transformations during raster conversation = as part of the rasterization algorithm efficient for complex primitives pixel by pixel test biggest effort, very primitive algorithm Werner Purgathofer / Computergraphik 1 12 Werner Purgathofer / Computergraphik 1 13 Line Clipping (1) Line Clipping (2) P 9 P 4 P 3 P 5 P 10 P 1 P 8 P P 8 P 1 6 P 6 P 5 P 7 P 2 P 2 before clipping after clipping [line clipping against a rectangular clip window] P 7 goals eliminate simple cases fast avoid intersection calculations for endpoints (x 0,y 0 ), (x end,y end ) intersect parametric representation x = x 0 + u (x end x 0 ) y = y 0 + u (y end y 0 ) with window borders: intersection 0 < u < 1 Werner Purgathofer / Computergraphik 1 14 Werner Purgathofer / Computergraphik 1 15 assignment of region codes to line endpoints bit1: left bit2: right bit3: below bit4: above binary region codes assigned to line endpoints according to relative position with respect to the clipping rectangle or of codes of both points = 0000 line entirely visible and of codes of both points 0000 line entirely invisible all others intersect! Werner Purgathofer / Computergraphik 1 16 Werner Purgathofer / Computergraphik 1 17 3

Werner Purgathofer / Computergraphik 1 18 [lines extending from one coordinate region to another may pass through the clip window, or they may intersect clipping boundaries without entering the window] remaining lines intersection test with bounding lines of clipping window left, right, bottom, top discard an outside part repeat intersection test up to four times vertical: y = y 0 + m(xw min x 0 ), y = y 0 + m(xw max x 0 ) horiz.: x = x 0 + (yw min y 0 )/m, x = x 0 + (yw max y 0 )/m Werner Purgathofer / Computergraphik 1 19 Polygon Clipping modification of line clipping goal: one or more closed areas intersects boundaries without entering clipping window passes through clipping window vertical: y = y 0 + m(xw min x 0 ), y = y 0 + m(xw max x 0 ) horiz.: x = x 0 + (yw min y 0 )/m, x = x 0 + (yw max y 0 )/m [display of a polygon processed by a lineclipping algorithm] [display of a correctly clipped polygon] Werner Purgathofer / Computergraphik 1 20 Werner Purgathofer / Computergraphik 1 21 processing polygon boundary as a whole against each window edge output: list of vertices four possible edge cases V 1 V 1 V 1 original polygon clip left clip right clipping a polygon against successive window boundaries Werner Purgathofer / Computergraphik 1 22 clip bottom clip top V 1 V V 1 1 out in output: V 1, in in successive processing of pairs of polygon vertices against the left window boundary Werner Purgathofer / Computergraphik 1 23 in out V 1 out out no output 4

for 1 edge: := 1 st vertex Sutherland-Hodgman no no V 1 visible? V 1 := :=next vertex visible? yes no yes V 1 visible? V 1 = clip edge V 1 result list result list yes [clipping a polygon against the left boundary of a window, starting with vertex 1. Primed numbers are used to label the points in the output vertex list for this window boundary] finished! Werner Purgathofer / Computergraphik 1 24 Werner Purgathofer / Computergraphik 1 25 Polygon Clip: Combination of 4 Passes the polygon is clipped against each of the 4 borders separately, that would produce 3 intermediate results. by calling the 4 tests recursively, (or by using a clipping pipeline) every result point is immediately processed on, so that only one result list is produced Werner Purgathofer / Computergraphik 1 26 Sutherland-Hodgman Clipping Example pipeline of boundary clippers to avoid intermediate vertex lists Werner Purgathofer / Computergraphik 1 27 3 1 st clip: left [Processing the polygon vertices through a boundary-clipping pipeline. After all vertices are processed through the pipeline, the vertex list for the clipped polygon is {1, 2, 2, 2 } ] 2 2 3 1 1 2 2 nd clip: bottom extraneous lines for concave polygons: split into separate parts or final check of output vertex list Text Clipping (1) [clipping the concave polygon with the Sutherland- Hodgeman clipper produces two connected areas] Werner Purgathofer / Computergraphik 1 28 1. text clipping using a bounding rectangle about the entire string Werner Purgathofer / Computergraphik 1 29 5

Text Clipping (2) Text Clipping (3) T NO. 1 TEX 2. text clipping using a bounding rectangle about individual characters 3. text clipping performed on the components of individual characters Werner Purgathofer / Computergraphik 1 30 Werner Purgathofer / Computergraphik 1 31 Summary: Clipping Cohen-Sutherland line clipping Hodgman-Sutherland polygon clipping text clipping Werner Purgathofer / Computergraphik 1 32 6