THE DEPTH-BUFFER VISIBLE SURFACE ALGORITHM

Similar documents
RASTERIZING POLYGONS IN IMAGE SPACE

8. Hidden Surface Elimination

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

9. Visible-Surface Detection Methods

Hidden Surface Removal

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

Pipeline Operations. CS 4620 Lecture 10

Computer Graphics. Lecture 9 Hidden Surface Removal. Taku Komura

Hidden surface removal. Computer Graphics

Graphics and Games. Penny Rheingans University of Maryland Baltimore County

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

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

Shadows. COMP 575/770 Spring 2013

THE CAMERA TRANSFORM

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

Rasterization Overview

8. Hidden Surface Elimination

4.5 VISIBLE SURFACE DETECTION METHODES

Werner Purgathofer

Hidden-Surface Removal.

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

3D graphics, raster and colors CS312 Fall 2010

Visible Surface Detection Methods

CEng 477 Introduction to Computer Graphics Fall 2007

Surface Graphics. 200 polys 1,000 polys 15,000 polys. an empty foot. - a mesh of spline patches:

Computer Graphics. Bing-Yu Chen National Taiwan University

CSE 690: GPGPU. Lecture 2: Understanding the Fabric - Intro to Graphics. Klaus Mueller Stony Brook University Computer Science Department

Drawing the Visible Objects

From Vertices To Fragments-1

COMP371 COMPUTER GRAPHICS

COMP30019 Graphics and Interaction Scan Converting Polygons and Lines

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

Computer Graphics. Chapter 1 (Related to Introduction to Computer Graphics Using Java 2D and 3D)

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

Hermite Curves. Hermite curves. Interpolation versus approximation Hermite curve interpolates the control points Piecewise cubic polynomials

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

On-Line Computer Graphics Notes CLIPPING

9. Illumination and Shading

Graphics for VEs. Ruth Aylett

CS Computer Graphics: Hidden Surface Removal

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

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

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

Advanced Shading I: Shadow Rasterization Techniques

Computer Graphics II

CS4620/5620: Lecture 14 Pipeline

Faster Scan Conversion Using the TMS320C80

Computer Graphics: 8-Hidden Surface Removal

Lecture 17: Recursive Ray Tracing. Where is the way where light dwelleth? Job 38:19

CS184 : Foundations of Computer Graphics Professor David Forsyth Final Examination

Real-Time Shadows. André Offringa Timo Laman

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

Graphics and Interaction Rendering pipeline & object modelling

CS488. Visible-Surface Determination. Luc RENAMBOT

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

Computer Science 426 Midterm 3/11/04, 1:30PM-2:50PM

Chapter 5. Projections and Rendering

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

Graphics for VEs. Ruth Aylett

THE VIEWING TRANSFORMATION

Computer Graphics. Shadows

CS 112 The Rendering Pipeline. Slide 1

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

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

3D Rasterization II COS 426

Scan Conversion. Drawing Lines Drawing Circles

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

3D Rendering Pipeline (for direct illumination)

From Vertices to Fragments: Rasterization. Reading Assignment: Chapter 7. Special memory where pixel colors are stored.

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

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

Hidden Line and Surface

Computer Graphics. Lecture 9 Environment mapping, Mirroring

Surface and Solid Geometry. 3D Polygons

Lecture 8 Ray tracing Part 1: Basic concept Yong-Jin Liu.

Visualisatie BMT. Rendering. Arjan Kok

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

Course Title: Computer Graphics Course no: CSC209

Introduction to Computer Graphics with WebGL

Chapter 1 Introduction

CS 4731: Computer Graphics Lecture 21: Raster Graphics: Drawing Lines. Emmanuel Agu

Image Precision Silhouette Edges

The Traditional Graphics Pipeline

Visibility: Z Buffering

Models and Architectures. Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico

Hidden Surfaces II. Week 9, Mon Mar 15

CSE528 Computer Graphics: Theory, Algorithms, and Applications

Models and Architectures

Triangle Rasterization

Robust Stencil Shadow Volumes. CEDEC 2001 Tokyo, Japan

General Hidden Surface Removal Algorithms. Binghamton University. EngiNet. Thomas J. Watson. School of Engineering and Applied Science CS 460/560

From 3D World to 2D Screen. Hendrik Speleers

FROM VERTICES TO FRAGMENTS. Lecture 5 Comp3080 Computer Graphics HKBU

Previously... contour or image rendering in 2D

Rasteriza2on and Clipping

Graphics Systems and Models

From Ver(ces to Fragments: Rasteriza(on

The Graphics Pipeline. Interactive Computer Graphics. The Graphics Pipeline. The Graphics Pipeline. The Graphics Pipeline: Clipping

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

Output Primitives Lecture: 3. Lecture 3. Output Primitives. Assuming we have a raster display, a picture is completely specified by:

Transcription:

On-Line Computer Graphics Notes THE DEPTH-BUFFER VISIBLE SURFACE ALGORITHM Kenneth I. Joy Visualization and Graphics Research Group Department of Computer Science University of California, Davis To accurately represent a complex model, it is imperative that those surfaces normally invisible from a certain point, be also invisible in the computer generated image. This problem normally called the visiblesurface problem (determining the surfaces that are visible), or the hidden-surface problem (determining those that are invisible), and has been the fundamental research problem in computer graphics over the past 20 years. The effects of this algorithm are easily seen, even in relatively simple pictures. If we consider the following illustration, we can obtain much more information about the relative positions of the objects by using the right hand figure, rather than using the left hand one. Of all algorithms for visible surface determination, the depth-buffer is perhaps the simplest, and is the most widely used. For each pixel on the display, we keep a record of the depth of the object in the scene that is closest to the viewer, plus a record of the intensity that should be displayed to show the object. When a new polygon is to be processed, a z-value and intensity value are calculated for each pixel that lies within the boundary of the polygon. If the z-value at a pixel indicates that the polygon is closer to the viewer than the z-value in the z-buffer, the z-value and the intensity values recorded in the buffers are replaced by the polygon s values. After processing all polygons, the resulting intensity buffer can be displayed

The z-buffer algorithm works in device space and it can be easily implemented as a modification of the scan-conversion algorithms that have been discussed in previous sections. The z-buffer, from which this algorithm derives its name, is an n n array for which the (i, j)th element corresponds to the (i, j)th pixel. This array holds the image-space z value of the currently visible object at the pixel. There is also another n n array whose elements correspond to the color that is to be assigned to the pixel. We illustrate the operation of the z-buffer algorithm by considering a two-dimensional example, with an eight-pixel-wide screen and polygons represented as lines. The steps to perform the algorithm are nearly identical in three dimensions. Initially, since we have rendered no polygons yet, we set all elements of the z-buffer array to (actually, some suitably large negative number). We also initialize the color array to black (or suitable a background color). Taking each polygon, scan convert the polygon and, within the scan-conversion algorithm, perform the following steps 2

For each pixel that intersects the polygon, if the image-space z value associated with this pixel is greater than the corresponding value in the z buffer, then calculate the color associated with the pixel, insert this color into the corresponding entry in the color array, and insert the pixel s z value into the corresponding element in the z buffer. If the z value associated with this pixel is not greater than the corresponding value in the z buffer, then no action is taken. As an example, inserting one line into our two-dimensional z-buffer, we log the depth value at the center of each pixel, and obtain! "!# $ % & ' Inserting a second line in the same way, we note that the z-buffer has been accruately updated to indicate the line that is visible at each pixel 3

"! #"$ We can give a simple pseudocode implementation of the z-buffer algorithm as follows: Z-Buffer Algorithm Given List of polygons {P 1, P 2,..., P n An array z-buffer[x,y] initialized to An array Intensity[x,y] begin for each polygon P in the polygon list do { for each pixel (x,y) that intersects P do { calculate z-depth of P at (x,y) if z-depth < z-buffer[x,y] then { Intensity[x,y] = intensity of P at (x,y) z-buffer[x,y] = z-depth Display Intensity array 4

end Since any polygon can be divided into a set of trapezoids, it is sufficient to consider the z-buffer algorithm on trapezoids. We can directly modify the rasterization algorithm given in the rasterization notes to create the z-buffer algorithm above. We utilize the same update and initialize procedures as in the rasterization algorithm. All contents copyright (c) 1996, 1997, 1998, 1999 Computer Science Department, University of California, Davis All rights reserved. 5