Computer Graphics. Rendering. by Brian Wyvill University of Calgary. cpsc/enel P 1

Similar documents
Identifying those parts of a scene that are visible from a chosen viewing position, and only process (scan convert) those parts

Visible-Surface Detection Methods. Chapter? Intro. to Computer Graphics Spring 2008, Y. G. Shin

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

Computer Graphics. Bing-Yu Chen National Taiwan University

Computer Graphics. Bing-Yu Chen National Taiwan University The University of Tokyo

Werner Purgathofer

Computing Visibility. Backface Culling for General Visibility. One More Trick with Planes. BSP Trees Ray Casting Depth Buffering Quiz

Visibility: Z Buffering

Pipeline Operations. CS 4620 Lecture 10

Visibility and Occlusion Culling

FROM VERTICES TO FRAGMENTS. Lecture 5 Comp3080 Computer Graphics HKBU

Visible Surface Detection Methods

CHAPTER 1 Graphics Systems and Models 3

CSE528 Computer Graphics: Theory, Algorithms, and Applications

Visible Surface Detection. (Chapt. 15 in FVD, Chapt. 13 in Hearn & Baker)

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

Class of Algorithms. Visible Surface Determination. Back Face Culling Test. Back Face Culling: Object Space v. Back Face Culling: Object Space.

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

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

Topic 12: Texture Mapping. Motivation Sources of texture Texture coordinates Bump mapping, mip-mapping & env mapping

Topic 11: Texture Mapping 11/13/2017. Texture sources: Solid textures. Texture sources: Synthesized

3D Rasterization II COS 426

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

Topic 11: Texture Mapping 10/21/2015. Photographs. Solid textures. Procedural

RASTERISED RENDERING

8. Hidden Surface Elimination

CEng 477 Introduction to Computer Graphics Fall 2007

Two basic types: image-precision and object-precision. Image-precision For each pixel, determine which object is visable Requires np operations

Visibility. Tom Funkhouser COS 526, Fall Slides mostly by Frédo Durand

Computer Graphics: 8-Hidden Surface Removal

Ray tracing. Computer Graphics COMP 770 (236) Spring Instructor: Brandon Lloyd 3/19/07 1

Hidden surface removal. Computer Graphics

9. Visible-Surface Detection Methods

Pipeline Operations. CS 4620 Lecture 14

Topics and things to know about them:

Shadow Algorithms. CSE 781 Winter Han-Wei Shen

8. Hidden Surface Elimination

Hidden Surfaces II. Week 9, Mon Mar 15

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

Sung-Eui Yoon ( 윤성의 )

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

SUMMARY. CS380: Introduction to Computer Graphics Ray tracing Chapter 20. Min H. Kim KAIST School of Computing 18/05/29. Modeling

Determination (Penentuan Permukaan Tampak)

Last Time: Acceleration Data Structures for Ray Tracing. Schedule. Today. Shadows & Light Sources. Shadows

The University of Calgary

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

VIII. Visibility algorithms (II)

CS4620/5620: Lecture 14 Pipeline

COMPUTER GRAPHICS COURSE. Rendering Pipelines

4.5 VISIBLE SURFACE DETECTION METHODES

Spatial Data Structures

Interactive Computer Graphics A TOP-DOWN APPROACH WITH SHADER-BASED OPENGL

graphics pipeline computer graphics graphics pipeline 2009 fabio pellacini 1

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

Computer Graphics. Lecture 9 Hidden Surface Removal. Taku Komura

graphics pipeline computer graphics graphics pipeline 2009 fabio pellacini 1

COMP371 COMPUTER GRAPHICS

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

Topic #1: Rasterization (Scan Conversion)

Spatial Data Structures

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

Visible Surface Determination: Intro

Graphics for VEs. Ruth Aylett

3D Object Representation

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

Introduction to Visualization and Computer Graphics

CS 464 Review. Review of Computer Graphics for Final Exam

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

The Traditional Graphics Pipeline

CS 488. More Shading and Illumination. Luc RENAMBOT

Standard Graphics Pipeline

Computer Graphics II

CS559: Computer Graphics. Lecture 12: Antialiasing & Visibility Li Zhang Spring 2008

Ray Tracing III. Wen-Chieh (Steve) Lin National Chiao-Tung University

Motivation. Culling Don t draw what you can t see! What can t we see? Low-level Culling

Graphics and Interaction Rendering pipeline & object modelling

MIT EECS 6.837, Teller and Durand 1

REYES REYES REYES. Goals of REYES. REYES Design Principles

CS184 : Foundations of Computer Graphics Professor David Forsyth Final Examination

Rendering. Basic Math Review. Rasterizing Lines and Polygons Hidden Surface Remove Multi-pass Rendering with Accumulation Buffers.

Spatial Data Structures

Line Drawing. Foundations of Computer Graphics Torsten Möller

Computer Graphics Viewing

Spatial Data Structures

GLOBAL EDITION. Interactive Computer Graphics. A Top-Down Approach with WebGL SEVENTH EDITION. Edward Angel Dave Shreiner

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

Announcements. Written Assignment 2 out (due March 8) Computer Graphics

COMP30019 Graphics and Interaction Scan Converting Polygons and Lines

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

CPSC GLOBAL ILLUMINATION

The Traditional Graphics Pipeline

Hidden Surface Removal

Incremental Form. Idea. More efficient if we look at d k, the value of the decision variable at x = k

Triangle Rasterization

The Traditional Graphics Pipeline

Other Rendering Techniques CSE 872 Fall Intro You have seen Scanline converter (+z-buffer) Painter s algorithm Radiosity CSE 872 Fall

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

Computer Graphics I Lecture 11

CS488. Visible-Surface Determination. Luc RENAMBOT

Image Precision Silhouette Edges

Transcription:

Computer Graphics Rendering by Brian Wyvill University of Calgary cpsc/enel P

Rendering Techniques Wire Frame Z Buffer Ray Tracing A Buffer cpsc/enel P 2

Rendering Visible Surface Determination Many Algorithms, image space, object space and hybrid. Requirements for quality vs. Speed. Realisitic Optical Effects Shading (local or global illumination model), shadowing, reflection, refraction, caustics. Improving The Image textures, antialiasing, depth of field. cpsc/enel P 3

Visible Surface Determination Image Space Algorithms Complexity = O(pixels * objects) e.g. 286*24 pixels and million polygons Complexity = O(.3 * 2 ) Object Space Algorithms Worst case might have to compare n objects with n objects: Complexity = O(n 2 ) e.g. million polygons Complexity = O( 2 ) cpsc/enel P 4

Reducing the Complexity Exploit Coherance Object Coherance: If objects are well separated, compare objects not faces. Face Coherance: If faces vary smoothly, can modify face incrementally. Can put constraints on models, such as no interpenetration. Edge Coherance: An edge changes visibility only when it crosses another edge or face. Scan line Coherance: Set of visible object spans typically does not vary much between scan lines. cpsc/enel P 5

Types of Coherance Area Coherance: Groups of adjacent pixels often covered by the same visible face. Depth Coherance: Adjacent parts of the same surface are typically close in depth. Zs= D/Ze D/F Frame Coherance: In animation, frames adjacent in time are likely to be very similar. cpsc/enel P 6

Finding Polygon Normals Ax + By +Cz + D = Normal Vector: N=(A, B, C) N Q N Q R N Q = QR X QP P In many cases the vertex normals have been calculated by a polygoniser. Normals and cross products must be normalised (normally). cpsc/enel P 7

Visible Surface Determination: Plane Equation Ax + By +Cz + D = Plane equation Can store plane as a point and a normal vector or store A,B,C,D. To determine coefficients given 3 non colinear points: (A/D)x i + (B/D)y i + (C/D)z i = Using cramer s rule: y z A = y 2 z 2 y 3 z 3 x z B = x 2 z 2 x 3 z 3 x y C = x 2 y 2 x 3 y 3 x y z D = x 2 y 2 z 2 x 3 y 3 z 3 Expanding: A = y (z 2 z 3 )+y 2 (z 3 z )+y 2 (z 3 z ) etc. cpsc/enel P 8

Back Face Culling Many renderers consider counter clockwise polygons as outwards facing. Take dot product with View Plane Normal If (+)ve or zero discard polygon. Q=Normalized View Plane Normal dotp = N.Q + + if dotp (+)ve Backfacing Polygon Normal N if dotp ( )ve Frontfacing Q if dotp = Edge On View Plane Plane of polygon Assuming perspective projection. Polygon is backfacing if Z component of normal is ( )ve in the eye system. cpsc/enel P 9 F&VD Page 663

Culling by comparing extents Modeling Space x Extents Overlap Objects don t Screen Space Extents and Objects don t Overlap Can try culling whole objects before hierarchical subdivision eventually to primitives. z cpsc/enel P

Scan Line Algorithms E.g. Z buffer, A buffer etc. Z Buffer. Store Background Colour in buffer. 2. Scan Convert Each Polygon 3. At each Pixel determine if Z value (in eye system) is nearer (lower z) than current stored z value. If it is lower than swap current colour for stored colour. cpsc/enel P

Determining Z Depth left right y,z y 2,z 2 Z y = y 2 y Z x = Z 2 Z z r z l x r x l Or if we have the plane equation: Ax + By +Cz + D = Normal Vector: N=(A, B, C) Insert known x,y into plane eqn. and solve for z: z = ( Ax By D)/C So incrementing across a scan line: z i+ = ( A(x+) By D)/C z i+ = z i A/C across scan line z j+ = z ij B/C between scanlines cpsc/enel P 2

Advantages and Disadvantages of Z buffer Needs large memory to keep Z values Can be implemented in hardware Can do infinite number of primitives. Handles cyclic and penetrating polygons. Handles Polygon Stream in any order throws away polygon once processed Transparency? cpsc/enel P 3

The Rendering Pipeline with Z buffer Data Base Traversal Modelling Transform tions Back Face Culling Viewing/ Perspective Transform ation viewbox clipping divide by W Rasteriz ation and lighting Display cpsc/enel P 4

Warnock s Algorithm Surrounding Intersecting Contained Disjoint Can keep subdividing to a sub pixel level supersampling result can be averaged to find pixel colour. cpsc/enel P 5

Blinn s Triage Table (Warnock also used it after a suggestion by Ivan Sutherland) In fact the polygons can be divided into 3 categories: Surrounders Intersectors E SubWindow 2 C D B Disjoint Only intersectors and surrounders are visible. A Window F After subdivision of the window : (into a SubWindow SW 2) A disjoint polygon remains disjoint from the SW (polygon E) A Surrounder remains a surrounder of the SW (polygon F) Some intersectors change to surrounders, (Polygon B). Some to disjoint (Polygon A) Some remain intersectors (polygon D) cpsc/enel P 6

Blinn s Triage Table (continued) Only Intersectors have to be recategorised after subdivision. Surrounders FI Intersectors FD Disjoint A B C D FI FD To move A to the disjoint list swap A and D and adjust FD. To move B to the surrounder list swap B and D and adjust FI. D B C A FI FD B D C A C D B A SubWindow 2 Window At each subwindow push FI and FD on the stack. When returning to a subwindow simply pop the state. The order of polygons will have altered but not their correct place that categorises them. cpsc/enel P 7

Binary Space Partitioning (BSP) Trees Fuchs 98 (See SIGGRAPH 8) Trades complex initial tree building for fast viewing Tree built by partitioning along plane of each polygon. Polygons in front of plane go to left back polygons go to right. 3 5a 4 5a 5b 6 5b 2 4 Relationship between polygons remains constant but view changes. 2 6 3 If viewer is in root s front half space. First display polygons in root s rear half space, then in root s front half space. (Painter s algorithm) F&VD Page 677 cpsc/enel P 8

Hierarchical Z buffer Visibility Greene et al 993 (See SIGGRAPH 93) An ideal visibility algorithm: a) Reject hidden geometry quickly (e.g. Ray Casting with Spatial Subdivision) b) Exploit spatial coherance of image (e.g. Z buffer) This algorithm does well on both. cpsc/enel P 9

The A Buffer Algorithm A buffer is a version of Z buffer with anti aliasing. Catmull approach clips each overlapping polygon against the pixel, then calculate area by clipping fragments to each other. Carpenter proposed trade per pixel object precision area sampling with per pixel image precision operations performed on a sub pixel grid. Discrete approx. to area sampling with box filter. Assume Square Pixel Catmull used Weiler Atherton Polygon clipping Carpenter used area sampling divide pixel into areas. cpsc/enel P 2

Anti Aliasing Light Video Digital Digital Video Frame Camera Digitizer Processing Buffer Monitor D/A Light a c (x) a c (x) a c (x) Continuous Signal x Discrete Signal x x Reconstructed Signal A filter is a black box that inputs one signal and outputs another. Simple filters convolve the input signal a(x) with the filter function h(x) to produce the output signal b(x): 8 b(x) = a(t)h(x t)dt +8 Convolution of continuous signal + 8 b(n) = Σ a(k)h(n k)dt k= 8 Convolution of discrete signal cpsc/enel P 2

Filtering Low Pass filter blurs a signal smoothing it out useful for eliminating noise and anti aliasing. Input Signal Filter Output Signal Name * = Example * = Impulse * = Box cpsc/enel P 2 2

cpsc/enel P 2 3 Meanwhile the A Buffer Algorithm Each polygon fragment is associated with a 8x4 grid = List of polygon fragments

cpsc/enel P 2 4 XOR Computing the bit mask = An edge mask has ones on the edge and to the right of the edge on those rows through which the edge passes.

The A Buffer Algorithm Continued When all polygons have been processed select fragments in depth sorted order. use their bit masks to clip further fragments. Z information kept but assumes whole fragment has that z. The above uses only one pixel sample. I.e. unweighted area sampling. For better antialiasing use wider filter. Take into account fragment under wider filter by weighting by distance from the centre of the filter this is done by look up table for each filter. Filter with wider support represented by an array of weights. cpsc/enel P 2 5

Eye Space Vs. Screen Space What is the problem with linear interpolation method? Beware of large polygons Beware of coincident polygons Zs= Zs Zs 2 Zs= D/Ze D/F Zs= Ze=D Ze Ze Ze=F Perspective transformation (viewbox tranformation) to normalize z to range [:] cpsc/enel P 2 6

Back Face Culling Can this be done in perspective space? i.e. transform polygon normal, N to perspective space, test and if it is rejected poly need not be transformed. If projection matrix is M: Polygon Normal N V = [ ][M ] c to find V.N (eye space) in perspective space: N =N[L] where L is M without the translation. V View Plane a c Plane of polygon This is not correct as the position of the of the polygon, c, must also be considered. cpsc/enel P 2 7