Hidden surface removal. Computer Graphics

Similar documents
Computer Graphics. Lecture 9 Hidden Surface Removal. Taku Komura

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

Computer Graphics. Bing-Yu Chen National Taiwan University

Hidden Surface Removal

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

CEng 477 Introduction to Computer Graphics Fall 2007

CS4620/5620: Lecture 14 Pipeline

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

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

Visibility: Z Buffering

8. Hidden Surface Elimination

9. Visible-Surface Detection Methods

Drawing the Visible Objects

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

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

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

Visibility and Occlusion Culling

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

Pipeline Operations. CS 4620 Lecture 10

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

CSE528 Computer Graphics: Theory, Algorithms, and Applications

Determination (Penentuan Permukaan Tampak)

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

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

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

INFOGR Computer Graphics. J. Bikker - April-July Lecture 11: Visibility. Welcome!

CSE 167: Introduction to Computer Graphics Lecture #9: Visibility. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2018

Spatial Data Structures and Speed-Up Techniques. Tomas Akenine-Möller Department of Computer Engineering Chalmers University of Technology

Triangle Rasterization

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

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

Computer Graphics. Shadows

Computer Graphics: 8-Hidden Surface Removal

Computer Graphics. Lecture 9 Environment mapping, Mirroring

CS Computer Graphics: Hidden Surface Removal

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

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

FROM VERTICES TO FRAGMENTS. Lecture 5 Comp3080 Computer Graphics HKBU

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

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

Hidden Surfaces II. Week 9, Mon Mar 15

Spatial Data Structures

Pipeline Operations. CS 4620 Lecture 14

Graphics and Interaction Rendering pipeline & object modelling

Spatial Data Structures

8. Hidden Surface Elimination

Rasterization Overview

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

Speeding up your game

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

graphics pipeline computer graphics graphics pipeline 2009 fabio pellacini 1

3D Object Representation

graphics pipeline computer graphics graphics pipeline 2009 fabio pellacini 1

Spatial Data Structures

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

COMP30019 Graphics and Interaction Scan Converting Polygons and Lines

Real-Time Rendering (Echtzeitgraphik) Dr. Michael Wimmer

Computer Graphics II

Spatial Data Structures

CSE 167: Introduction to Computer Graphics Lecture #5: Rasterization. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2015

The Traditional Graphics Pipeline

Werner Purgathofer

Computer Graphics Inf4/MSc. Computer Graphics. Lecture 6 View Projection Taku Komura

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

PowerVR Hardware. Architecture Overview for Developers

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

The Traditional Graphics Pipeline

POWERVR MBX. Technology Overview

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

Computer Graphics 10 - Shadows

University of British Columbia CPSC 314 Computer Graphics Jan-Apr Tamara Munzner. Hidden Surfaces.

LOD and Occlusion Christian Miller CS Fall 2011

Culling. Computer Graphics CSE 167 Lecture 12

Hidden Surface Elimination: BSP trees

Announcements. Written Assignment2 is out, due March 8 Graded Programming Assignment2 next Tuesday

Spatial Data Structures

The Traditional Graphics Pipeline

Hardware-driven visibility culling

Previously... contour or image rendering in 2D

CS 563 Advanced Topics in Computer Graphics Culling and Acceleration Techniques Part 1 by Mark Vessella

Visible Surface Detection Methods

Lecture 4. Viewing, Projection and Viewport Transformations

VIII. Visibility algorithms (II)

Drawing Fast The Graphics Pipeline

CSE 167: Introduction to Computer Graphics Lecture #4: Vertex Transformation

CSE 167: Introduction to Computer Graphics Lecture #10: View Frustum Culling

COMP30019 Graphics and Interaction Ray Tracing

Notes on Assignment. Notes on Assignment. Notes on Assignment. Notes on Assignment

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

CSE 167: Introduction to Computer Graphics Lecture #11: Visibility Culling

Hidden Surfaces / Depth Test

More Visible Surface Detection. CS116B Chris Pollett Mar. 16, 2005.

Lecture 25 of 41. Spatial Sorting: Binary Space Partitioning Quadtrees & Octrees

Drawing Fast The Graphics Pipeline

Introduction Rasterization Z-buffering Shading. Graphics 2012/2013, 4th quarter. Lecture 09: graphics pipeline (rasterization and shading)

THE DEPTH-BUFFER VISIBLE SURFACE ALGORITHM

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

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

Sung-Eui Yoon ( 윤성의 )

Computer Graphics. Lecture 13. Global Illumination 1: Ray Tracing and Radiosity. Taku Komura

Transcription:

Lecture Hidden Surface Removal and Rasterization Taku Komura Hidden surface removal Drawing polygonal faces on screen consumes CPU cycles Illumination We cannot see every surface in scene We don t want to waste time rendering primitives which don t contribute to the final image. Visibility (hidden surface removal) A correct rendering requires correct visibility calculations Correct visibility when multiple opaque polygons cover the same screen space, only the closest one is visible (remove the other hidden surfaces) Visibility of primitives A scene primitive can be invisible for reasons: Primitive lies outside field of view Primitive is back-facing Primitive is occluded by one or more objects nearer the viewer wrong visibility correct visibility Definitions: Visible surface algorithms. Object space techniques: applied before vertices are mapped to pixels Back face culling, Painter s algorithm, BSP trees Image space techniques: applied while the vertices are rasterized Z-buffering The vertices of polyhedra are oriented in an anticlockwise manner when viewed from outside surface normal N points out. Project a polygon. Test z component of surface normal. If negative cull, since normal points away from viewer. Back face culling. Or if N. V > 0 we are viewing the back face so polygon is obscured. 6

Painters algorithm (object space). BSP (Binary Space Partitioning) Tree. Draw surfaces in back to order nearer polygons paint over farther ones. Supports transparency. Key issue is order determination. Doesn t always work see image at right. One of class of list-priority algorithms returns ordered list of polygon fragments for specified view point (static pre-processing stage). Divide scene into (relative to normal) and back half-spaces. Choose a polygon from each side split scene again. Recursively divide each side until each node contains only polygon. View of scene from above 7 a b a b Divide scene into (relative to normal) and back half-spaces. Divide scene into (relative to normal) and back half-spaces. Choose a polygon from each side split scene again. back Choose a polygon from each side split scene again. back Recursively divide each side until each node contains only polygon. a b Recursively divide each side until each node contains only polygon. a b Lecture 9 9/0/0079 Displaying a BSP tree. Divide scene into (relative to normal) and back half-spaces. Choose a polygon from each side split scene again. Recursively divide each side until each node contains only polygon. a a b back b Once we have the regions need priority list BSP tree can be traversed to yield a correct priority list for an arbitrary viewpoint. Start at root polygon. If viewer is in half-space, draw polygons behind root first, then the root polygon, then polygons in. If polygon is on edge either can be used. Recursively descend the tree. If eye is in rear half-space for a polygon then can back face cull. Lecture 9 9/0/007

BSP performance measure A lot of computation required at start. Try to split polygons along good dividing plane Intersecting polygon splitting may be costly Cheap to check visibility once tree is set up. Can be used to generate correct visibility for arbitrary views. Efficient when objects don t change very often in the scene. Lecture 9 9/0/007 Tree construction and traversal (object-space ordering algorithm good for relatively few static primitives, precise) Overdraw: maximum Front-to-back traversal is more efficient Record which region has been filled in already Terminate when all regions of the screen is filled in S. Chen and D. Gordon. Front-to-Back Display of BSP Trees. IEEE & Algorithms, pp 79 8. September 99. Lecture 9 9/0/007 Z-buffering : image space approach Basic Z-buffer idea: rasterize every input polygon For every pixel in the polygon interior, calculate its corresponding z value (by interpolation) Track depth values of closest polygon (smallest z) so far Paint the pixel with the color of the polygon whose z value is the closest to the eye. 6 7 8

Implementation. Initialise frame buffer to background colour. Initialise depth buffer to z = max. value for far clipping plane For each triangle Calculate value for z for each pixel inside Update both frame and depth buffer 9 0 Filling in Triangles Scan line algorithm Filling in the triangle by drawing horizontal lines from top to bottom Triangle Rasterization Consider a D triangle with vertices p0, p, p. Let p be any point in the plane. We can always find a, b, c such that Barycentric coordinates Checking whether a pixel is inside / outside the triangle We will have if and only if p is inside the triangle. We call the barycentric coordinates of p. Computing the baricentric coordinates of the interior pixels The triangle is composed of points p0 (x0,y0), p (x, y), p(x,y) (α,β,γ) : barycentric coordinates Only if 0<α,β,γ<, (x,y) is inside the triangle Depth can be computed by αz0 + βz +γz Can do the same thing for color, normals, textures Bounding box of the triangle First, identify a rectangular region on the canvas that contains all of the pixels in the triangle (excluding those that lie outside the canvas). Calculate a tight bounding box for a triangle: simply calculate pixel coordinates for each vertex, and find the minimum/maximum for each axis

Scanning inside the triangle Once we've identified the bounding box, we loop over each pixel in the box. For each pixel, we first compute the corresponding (x, y) coordinates in the canonical view volume Next we convert these into barycentric coordinates for the triangle being drawn. Only if the barycentric coordinates are within the range of [0,], we plot it (and compute the depth) Why is z-buffering so popular? Advantage Simple to implement in hardware. Memory for z-buffer is now not expensive Diversity of primitives not just polygons. Unlimited scene complexity Don t need to calculate object-object intersections. Disadvantage Extra memory and bandwidth Waste time drawing hidden objects Z-precision errors May have to use point sampling 6 Z-buffer performance Brute-force image-space algorithm scores best for complex scenes easy to implement and is very general. Storage overhead: O() Time to resolve visibility to screen precision: O(n) n: number of polygons Ex. Architectural scenes Here there can be an enormous amount of occlusion 7 Lecture 9 9/0/007 8 Occlusion at various levels Portal Culling (object-space) D F Model scene as a graph: Nodes: Cells (or rooms) Edges: Portals (or doors) C A B E G Graph gives us: Potentially visible set Lecture 9 9/0/007 9. Render the room. If portal to the next room is visible, render the connected room in the portal region. Repeat the process along the scene graph C A B D E 9/0/007 0

Summary References for hidden surface removal Z-buffer is easy to implement on hardware and is an important tool We need to combine it with an object-based method especially when there are too many polygons BSP trees, portal culling Foley et al. Chapter, all of it. Introductory text, Chapter, all of it Baricentric coordinates www.cs.caltech.edu/courses/cs7/barycent ric.pdf Or equivalents in other texts, look out for: (as well as the topics covered today) Depth sort Newell, Newell & Sancha Scan-line algorithms 6