Drawing the Visible Objects

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

Computer Graphics. Lecture 9 Hidden Surface Removal. Taku Komura

Computer Graphics II

Hidden surface removal. Computer Graphics

8. Hidden Surface Elimination

Computer Graphics. Bing-Yu Chen National Taiwan University

Spatial Data Structures

Spatial Data Structures

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

Hidden Surface Elimination: BSP trees

9. Visible-Surface Detection Methods

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

CSE528 Computer Graphics: Theory, Algorithms, and Applications

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

Spatial Data Structures

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

CEng 477 Introduction to Computer Graphics Fall 2007

Spatial Data Structures

Advanced 3D-Data Structures

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

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

The Visibility Problem and Binary Space Partition. (slides by Nati Srebro)

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

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

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

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

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

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

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

Topic #1: Rasterization (Scan Conversion)

Solid Modeling. Thomas Funkhouser Princeton University C0S 426, Fall Represent solid interiors of objects

VIII. Visibility algorithms (II)

Universiteit Leiden Computer Science

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

Computer Graphics. Shadows

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

Visible Surface Detection Methods

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

Rasterization Overview

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

Hidden Surface Removal

Werner Purgathofer

Speeding up your game

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

Chapter 11 Global Illumination. Part 1 Ray Tracing. Reading: Angel s Interactive Computer Graphics (6 th ed.) Sections 11.1, 11.2, 11.

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

Computer Graphics: 8-Hidden Surface Removal

Pipeline Operations. CS 4620 Lecture 10

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

More Hidden Surface Removal

Hidden Surfaces II. Week 9, Mon Mar 15

8. Hidden Surface Elimination

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

Z-Buffer hold pixel's distance from camera. Z buffer

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

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

Visibility: Z Buffering

CS4620/5620: Lecture 14 Pipeline

Visibility and Occlusion Culling

Pipeline Operations. CS 4620 Lecture 14

4.5 VISIBLE SURFACE DETECTION METHODES

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

THE DEPTH-BUFFER VISIBLE SURFACE ALGORITHM

Computer Graphics (CS 543) Lecture 13b Ray Tracing (Part 1) Prof Emmanuel Agu. Computer Science Dept. Worcester Polytechnic Institute (WPI)

Binary Space Partitions for Orthogonal Segments and Hyperrectangles Adrian Dumitrescu Joe Mitchell Micha Sharir

Binary Space Partition Trees. Overview. Binary Space Partitioning Trees (Fuchs, Kedem and Naylor `80)

Real-Time Rendering (Echtzeitgraphik) Dr. Michael Wimmer

Hidden Surface Elimination Raytracing. Pre-lecture business. Outline for today. Review Quiz. Image-Space vs. Object-Space

Computer Graphics Lecture 11

Spatial Data Structures for Computer Graphics

Interpolation using scanline algorithm

Scene Management. Video Game Technologies 11498: MSc in Computer Science and Engineering 11156: MSc in Game Design and Development

CS 381 Computer Graphics, Fall 2008 Midterm Exam Solutions. The Midterm Exam was given in class on Thursday, October 23, 2008.

Accelerating Geometric Queries. Computer Graphics CMU /15-662, Fall 2016

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

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

Hidden-Surface Removal.

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

Accelerated Raytracing

CSE 417 Dynamic Programming (pt 4) Sub-problems on Trees

Chapter 4. Chapter 4. Computer Graphics 2006/2007 Chapter 4. Introduction to 3D 1

Visible-Surface Detection 1. 2IV60 Computer graphics set 11: Hidden Surfaces. Visible-Surface Detection 3. Visible-Surface Detection 2

(Refer Slide Time 03:00)

CS Computer Graphics: Hidden Surface Removal

Projection and viewing. Computer Graphics CSE 167 Lecture 4

CS535 Fall Department of Computer Science Purdue University

Drawing Fast The Graphics Pipeline

Algorithms for GIS:! Quadtrees

Spatial Data Structures and Acceleration Algorithms

Computer Graphics Viewing

Effects needed for Realism. Ray Tracing. Ray Tracing: History. Outline. Foundations of Computer Graphics (Spring 2012)

Robust Stencil Shadow Volumes. CEDEC 2001 Tokyo, Japan

Real-Time Shadows. André Offringa Timo Laman

Culling. Computer Graphics CSE 167 Lecture 12

Sung-Eui Yoon ( 윤성의 )

Ray Tracing. Computer Graphics CMU /15-662, Fall 2016

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

: Mesh Processing. Chapter 8

Transcription:

Drawing the Visible Objects We want to generate the image that the eye would see, given the objects in our space How do we draw the correct object at each pixel, given that some objects may obscure others in the scene? Hidden surface removal

A Simple Solution: Keep a buffer that holds the z-depth of the pixel currently at each point on screen Draw each polygon: for each pixel, test its depth versus current screen depth to decide if we draw it or not Z-buffer

Drawbacks to Z-buffering This used to be a very expensive solution! Requires memory for the z-buffer extra hardware cost was prohibitive Requires extra z-test for every pixel So, a software solution was developed

The Painter's Algorithm Avoid extra z-test & space costs by scan converting polygons in back-to-front order From wikipedia 2 3 1 Is there always a correct back-to-front order?

How Do We Deal With Cycles? In 3 dimensions, polygons can overlap, creating cycles in which no depth ordering would draw correctly How do we deal with these cases?

How Do We Deal With Cycles? We can break one polygon into two and order them separately Which polygon? Where? View dependent

BSP Trees Having a pre-built BSP tree will allow us to get a correct depth order of polygons in our scene for any point in space. We will build a data structure based on the polygons in our scene, that can be queried with any point input to return an ordering of those polygons.

The Big Picture Assume that no objects in our space overlap Use planes to recursively split our object space, keeping a tree structure of these recursive splits.

Choose a Splitting Line Choose a splitting plane, dividing our objects into three sets those on each side of the plane, and those fully contained on the plane.

Choose More Splitting Lines What do we do when an object (like object 1) is divided by a splitting plane? It is divided into two objects, one on each side of the plane.

Split Recursively Until Done When we reach a convex space containing exactly zero or one objects, that is a leaf node.

Continue

Continue

Finished Once the tree is constructed, every root-toleaf path describes a single convex subspace.

Querying the Tree If a point is in the positive half-space of a plane, everything in the negative half-space is farther away -- so draw it first, using this algorithm recursively draw objects on the splitting plane draw objects into the positive half-space, recursively

What Order Is Generated From This Eye Point? How much time does it take to query the BSP tree, asymptotically?

Structure of a BSP Tree Each internal node has a +half space, a -half space, and a list of objects contained entirely within that plane (if any exist). Each leaf has a list of zero or one objects inside it, and no subtrees The size of a BSP tree is the total number of objects stored in the leaves & nodes of the tree This can be larger than the number of objects in our scene because of splitting K-d tree and Octree are special cases of BSP

Building a BSP Tree How do we pick splitting lines/planes?

Building a BSP Tree From Line Segments in the Plane We ll now deal with a formal algorithm for building a BSP tree for line segments in the 2D plane. This will generalize for building trees of D-1 dimensional objects within D-dimensional spaces.

Auto-Partitioning Auto-partitioning: splitting only along planes coincident on objects in our space

Algorithm for the 2d Case If we only have one segment 's', return a leaf node containing s. Otherwise, choose a line segment 's' along which to split For all other line segments, one of four cases will be true: 1) The segment is in the +half space of s 2) The segment is in the -half space of s 3) The segment crosses the line through s 4) The segment is entirely contained within the line through s Split all segments who cross 's' into two new segments -- one in the +half space, and one in the -half space Create a new BSP tree from the set of segments in the +half space of s, and another on the set of segments in the -half space Return a new node whose children are these +/- half space BSP s, and which contains the list of segments entirely contained along the line through s.

How Small Is the BSP Different orderings result in different trees Greedy approach? pick the line with fewest intersections doesn't always work -- sometimes it does very badly it is costly to find

Random Approach Works Well If we randomly order segments before building the tree, then we do well in the average case Expected number of fragments, i.e., size of leaves O(n log n) Expected running time: O(n 2 log n)

Optimization: Free Splits Sometimes a segment will entirely cross a convex region described by some interior node -- if we choose that segment to split on next, we get a "free split" -- no splitting needs to occur on the other segments since it crosses the region.

Our Building Algorithm Extends to 3D! The same procedure we used to build a tree from two-dimensional objects can be used in the 3D case we merely use polygonal faces as splitting planes, rather than line segments.

More analysis: How good are auto-partitions? There are sets of triangles in 3-space for which auto-partitions guarantee Ω(n 2 ) fragments Can we do better by not using autopartitions?

Sometimes, No There are actually sets of triangles for which any BSP will have Ω(n 2 ) fragments! Fortunately, these cases are artificial and rarely seen BSP usually performs well in practice

More applications Querying a point to find out what convex space it exists within Shadows Visibility Blending Opengl stuff