Visibility and Occlusion Culling

Similar documents
CS535 Fall Department of Computer Science Purdue University

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

Computer Graphics. Bing-Yu Chen National Taiwan University

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

Real-Time Rendering (Echtzeitgraphik) Dr. Michael Wimmer

Hidden surface removal. Computer Graphics

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

Computer Graphics. Lecture 9 Hidden Surface Removal. Taku Komura

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

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

LOD and Occlusion Christian Miller CS Fall 2011

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

Spatial Data Structures and Acceleration Algorithms

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

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

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

CSE528 Computer Graphics: Theory, Algorithms, and Applications

CS4620/5620: Lecture 14 Pipeline

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

CEng 477 Introduction to Computer Graphics Fall 2007

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

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

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

Determination (Penentuan Permukaan Tampak)

Project Gotham Racing 2 (Xbox) Real-Time Rendering. Microsoft Flighsimulator. Halflife 2

Visibility: Z Buffering

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

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

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

Speeding up your game

Werner Purgathofer

TDA362/DIT223 Computer Graphics EXAM (Same exam for both CTH- and GU students)

Sung-Eui Yoon ( 윤성의 )

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

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

Hardware-driven visibility culling

Visible Surface Detection Methods

Many rendering scenarios, such as battle scenes or urban environments, require rendering of large numbers of autonomous characters.

9. Visible-Surface Detection Methods

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

Culling. Computer Graphics CSE 167 Lecture 12

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

Hidden Surface Removal

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

Row Tracing with Hierarchical Occlusion Maps

A Survey of Visibility for Walkthrough Applications

A Survey of Visibility for Walkthrough Applications

Comparison of hierarchies for occlusion culling based on occlusion queries

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

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

Spatial Data Structures

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

RASTERISED RENDERING

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

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

FROM VERTICES TO FRAGMENTS. Lecture 5 Comp3080 Computer Graphics HKBU

Computer Graphics Shadow Algorithms

Universiteit Leiden Computer Science

Deferred Splatting. Gaël GUENNEBAUD Loïc BARTHE Mathias PAULIN IRIT UPS CNRS TOULOUSE FRANCE.

graphics pipeline computer graphics graphics pipeline 2009 fabio pellacini 1

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

Frédo Durand, George Drettakis, Joëlle Thollot and Claude Puech

graphics pipeline computer graphics graphics pipeline 2009 fabio pellacini 1

Rasterization Overview

Adaptive Point Cloud Rendering

Painter s HSR Algorithm

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

COMP 175: Computer Graphics April 11, 2018

Spatial Data Structures

ICS RESEARCH TECHNICAL TALK DRAKE TETREAULT, ICS H197 FALL 2013

Computer Graphics II

Spatial Data Structures

Performance OpenGL Programming (for whatever reason)

Triangle Rasterization

Spatial Data Structures

VIII. Visibility algorithms (II)

DiFi: Distance Fields - Fast Computation Using Graphics Hardware

Hardware-driven Visibility Culling Jeong Hyun Kim

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

Goal. Interactive Walkthroughs using Multiple GPUs. Boeing 777. DoubleEagle Tanker Model

Real-Time Shadows. Last Time? Today. Why are Shadows Important? Shadows as a Depth Cue. For Intuition about Scene Lighting

Lecture 11: Ray tracing (cont.)

Real-Time Voxelization for Global Illumination

Pipeline Operations. CS 4620 Lecture 10

Ray Casting on Programmable Graphics Hardware. Martin Kraus PURPL group, Purdue University

Overview. A real-time shadow approach for an Augmented Reality application using shadow volumes. Augmented Reality.

Applications of Explicit Early-Z Culling

Accelerating Ray Tracing

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

Occlusion Culling Using Minimum Occluder Set and Opacity Map

Last Time. Why are Shadows Important? Today. Graphics Pipeline. Clipping. Rasterization. Why are Shadows Important?

Images for Accelerating Architectural Walkthroughs

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

Homework #2. Hidden Surfaces, Projections, Shading and Texture, Ray Tracing, and Parametric Curves

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

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

Point based Rendering

Acknowledgement: Images and many slides from presentations by Mark J. Kilgard and other Nvidia folks, from slides on developer.nvidia.

Drawing the Visible Objects

Transcription:

Visibility and Occlusion Culling CS535 Fall 2014 Daniel G. Aliaga Department of Computer Science Purdue University [some slides based on those of Benjamin Mora]

Why? To avoid processing geometry that does not need to be processed. Useful when having millions (or billions) of triangles. Can be done at the triangle or pixel level.

Topics Older Concerns View Frustum Culling Back Face Culling Portal Culling Occlusion Culling Hierarchical Z Buffer Hierarchical Occlusion Maps Some others

Topics Older Concerns View Frustum Culling Back Face Culling Portal Culling Occlusion Culling Hierarchical Z Buffer Hierarchical Occlusion Maps Some others

Hidden Surfaces Removal Needed before raster-graphics and high memory availability [From Roger Crawfis]

Painter s Algorithm Primitive can be projected from the farthest one to the closest (Back-to-Front) without any need to find the closest intersection. All the primitives being on the same side of the viewpoint (A) will be intersected first, so a front-to-back analysis is more efficient. (A) (B)

Priority List/BSP Trees (Fuchs) 2 1 2 1 3 4 5 4 5 3

Priority List/BSP Trees (Fuch) Proposed by Henry Fuchs (1980) By preprocessing the scene and creating a binary space subdivision, primitives can then be projected in a visibility order. Handles Transparency correctly. In practice, constructing a Binary Space Partitioning tree is difficult!

Area Subdivision Algorithms Warnock Algorithm (1969) Not really used anymore Hierarchical method Quadtree structure Assumes no overlapping Visibility is computed on a per-block basis

Area Subdivision Algorithms Weiler-Atherton algorithm Kevin Weiler, Peter Atherton, Hidden surface removal using polygon area sorting, Siggraph 1977. Works on 3D primitives instead of using screen space subdivisions. Maintains a list of clipped (visible) polygons. Every time a new polygon is processed, clipping with all the (visible) polygons is performed and a new list of polygons is generated. Once all the polygons processed, the clipped parts can be used for the final image.

Area Subdivision Algorithms Weiler Atherton algorithm. Provides a general clipping algorithm for concave polygons. Subject Polygon Clip Polygon Other algorithm for clipping: Sutherland- Hodgman algorithm

Possible Issues with these algorithms Could be too complex (e.g., 2D clipping). Lead to several cases and bugs in implementations. Not fast enough. E.g. clipping. Hardly parallelizable. Not suitable to hardware acceleration.

Topics Older Concerns View Frustum Culling Back Face Culling Portal Culling Occlusion Culling Hierarchical Z Buffer Hierarchical Occlusion Maps Some others

Culling View Frustum Culling. Primitives outside of the view frustum discarded. Often implemented on graphics cards Note: not the same as clipping! Viewing pyramid Viewpoint Visible Triangle Culled triangles

Culling Can be accelerated (software) by grouping triangle and computing the frustum intersection only for the bounding box. Don t need to process these triangles. Frustum Bounding Box

Hierarchical View Frustum Culling O

Topics Older Concerns View Frustum Culling Back Face Culling Portal Culling Occlusion Culling Hierarchical Z Buffer Hierarchical Occlusion Maps Some others

Back Face Culling #1 If the viewpoint is fronting the backface, then the triangle is not processed. Hardware accelerated Can be enabled/disabled. Orientation given by the order of projected vertices. #3 #2 Projected Triangle (Visible) #1 #2 #3 Wrong vertex order (Triangle is culled)

Topics Older Concerns View Frustum Culling Back Face Culling Portal Culling Occlusion Culling Hierarchical Z Buffer Hierarchical Occlusion Maps Some others

Cells and Portals Culling

Cells and Portals Culling A visibility graph is constructed and used for macro-level scene culling A A E F D B C B C F E D

Image-based C &P Culling Increase interactive rendering performance of architectural walkthroughs Cull away non visible areas Replace geometry behind portals (doorways and windows) with images warped to the current eye position Reduce the rendering complexity with a small number of image samples

Portal Images

Adding Portal Image Warping McMillan & Bishop Warping Equation: x 2 = d(x 1 ) P 2-1 (c 1 - c 2 ) + P 2-1 P 1 x 1 Move pixels based on distance to eye ~Texture mapping Per-pixel distance values are used to warp pixels to their correct location for the current eye position

Portal Image Warping eye Reference COP Projecting the eye onto the reference image partitions it into 1, 2 or 4 sheets A raster scan of each sheet produces a back-to-front ordering of warped pixels

Creating Portal Images Ideal portal image would be one sampled from the current eye position eye portal

Creating Portal Images Reference COPs A large number of static reference images (~120) needed to eliminate popping portal

Creating Portal Images Reference COPs With warping we use a much smaller number of reference images portal

Creating Portal Images Reference COPs Choose closest reference image and warp to current eye position eye portal

Problem: Exposure Events We observe tears in regions with unknown visibility data

Reducing Exposure Events To address this we: 1. Render multiple reference images 2. Allow warped pixels to persist and fill-in minor tears

Parallelization: Sheets eye Projection plane Eye view direction similar to reference COP view direction Since the projection plane is perpendicular to the view direction, we usually have 4 sheets We warp each sheet on a different processor

Topics Older Concerns View Frustum Culling Back Face Culling Portal Culling Occlusion Culling Hierarchical Z Buffer Hierarchical Occlusion Maps Some others

Z-Buffer test Example: Final image Final z-buffer

Z-Buffer test Used by current hardware technology Primitives can be sent to the graphics hardware in any order, thanks to the z-buffer test that will keep the closest fragments. A z value is stored for every pixel (z-buffer) Algorithm for a given pixel: If the rasterized z-value is less than the current z-value Then replace the previous color and z-value by the new ones

Hierarchical Z-buffer Proposed by Greene et al. A hierarchical z-max pyramid is constructed above the z-buffer Every time a z value is updated, the hierarchy is updated 6 5 4 2 3 5 7 6 2 5 4 2 9 1 3 2 8 6 7 9 4 8 8 9

The Z-Pyramid The content of the Z-buffer is the finest level in the pyramid Coarser levels are created by grouping together four neighbouring pixels and keeping the largest z-value The coarsest level is just one value corresponding to overall max z 37

= furthest = closer = closest The Z-Pyramid Depth taken from the z-buffer Objects are rendered 38

Using The Z-Pyramid = furthest = closer = closest 39

Maintaining the Z-Pyramid Ideally every time an object is rendered causing a change in the Z-buffer, this change is propagated through the pyramid However this is not a practical approach 40

More Realistic Implementation Make use of frame to frame coherence at start of each frame render the nodes that were visible in previous frame read the z-buffer and construct the z-pyramid now traverse the octree using the z-pyramid for occlusion but without updating it 41

HZB: Discussion It provides good acceleration in very dense scenes Getting the necessary information from the Z- buffer is costly Some hardware support exists 42

Hierarchical Occlusion Maps Occluded geometry Visible geometry Occluder geometry (all images from Hansong Zhang s dissertation)

Hierarchical Occlusion Maps Motivation Occlusion is cumulative Occluders can be fused

Hierarchical Occlusion Maps Triangles are initially grouped into separate regions of space such as bounding boxes, grids or trees. This data structure is traversed in a front to back order. The visibility of the region is given by the HOM. If region is visible, then its content (i.e., triangles) must be projected. During projection, the content of the different maps is updated every time a pixel becomes opaque.

Hierarchical Occlusion Map (HOM) The occlusion images can be readily generated by hardware; how? Just render the scene with white=visible and black=background Note that this process is fast but is also done at some selected resolution So lets change the resolution!

Hierarchical Occlusion Map (HOM) And we get this:

Hierarchical Occlusion Map (HOM) And we get this:

Hierarchical Occlusion Map (HOM) Creation algorithm for HOMs:

Hierarchical Occlusion Map (HOM) How do you use an HOM? First cull using the coarsest HOM Then the next coarsest... Until the finest level of the HOM If something is visible in all levels, then it is visible So what is the gain?

Hierarchical Occlusion Map (HOM) Observation Even at the finest level, it is not known if the object is truly visible But at the resolution you care about, it is

Hierarchical Occlusion Map (HOM) Conclusion The hierarchy is conservative Generate from the coarest HOM to the finest level you care about Only use those and select at run-time depending on performance

Example Results

Some questions? For a 2x2 grid of pixels in the occlusion map, what occlusion value do you choose? Min? Max? Average? See hierarchical z-buffers!

Occlusion Queries Current graphics hardware allows counting the number of fragments that pass the z-test. 3 steps: Lock the z-buffer and frame buffer (impossible to modify the content of these buffers). Render a bounding box. If no pixel has passed the z-test, then the region inside the BB is not visible. Unlock the Z-buffer and Frame-Buffer.

Occlusion Queries Can take advantage of fast z tests. Efficient only if the BB contains many primitives. Must wait for the answer. The program should do something before testing the answer.

Depth Peeling From Interactive Order-Independent Transparency Cass Everitt NVIDIA OpenGL Applications Engineering

Depth Peeling From Interactive Order-Independent Transparency Cass Everitt NVIDIA OpenGL Applications Engineering

Depth Peeling Z-buffer based visibility only allows finding the nearest elements of the scene. Transparency cannot correctly be handled. Solution: use a multipass algorithm to find the second nearest surface, third nearest surface, and etc for every pixel At the end, combine the different images in a front-to-back-order.

Directional Discretized Occluders (Bernardini, Klosowski, El-Sana, 2000) Pre-process an octree subdivision of the world to locate faces of octree cells that could be used as occluders Faces are marked as occluders for some subset of views A marked face indicates that, for the given range of views, it will never be seen (and so nothing behind it will be seen) To render, project cells in top down, front to back order Render occluding cell faces into a quadtree in image space Use the quadtree to cull later cells No need for depth information, because the octree imposes an ordering - things rendered later must be behind mask The pre-process to determine occluding faces is very expensive