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

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

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

Culling. Computer Graphics CSE 167 Lecture 12

CSE 167: Introduction to Computer Graphics Lecture 11: Scene Graph 2. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2013

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

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

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

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

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

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

Sung-Eui Yoon ( 윤성의 )

Problem Max. Points Total 80

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

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

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

Speeding up your game

CSE 167: Lecture #8: Lighting. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2011

Pipeline Operations. CS 4620 Lecture 14

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

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

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

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

CSE 167: Introduction to Computer Graphics Lecture #18: More Effects. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2016

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

CSE 167: Introduction to Computer Graphics. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2013

CS4620/5620: Lecture 14 Pipeline

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

CSE 167: Lecture #17: Procedural Modeling. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2011

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

LOD and Occlusion Christian Miller CS Fall 2011

Hidden surface removal. Computer Graphics

Adaptive Point Cloud Rendering

Universiteit Leiden Computer Science

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

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

CSE 167: Introduction to Computer Graphics Lecture #4: Coordinate Systems

Pipeline Operations. CS 4620 Lecture 10

Visibility and Occlusion Culling

CSE 167: Lecture 11: Textures 2. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2011

Computer Graphics. Bing-Yu Chen National Taiwan University

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

Shadows in the graphics pipeline

Spatial Data Structures and Speed-Up Techniques. Ulf Assarsson Department of Computer Science and Engineering Chalmers University of Technology

Lecture 3 Sections 2.2, 4.4. Mon, Aug 31, 2009

CS 130 Exam I. Fall 2015

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

CS 563 Advanced Topics in Computer Graphics QSplat. by Matt Maziarz

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

Spatial Data Structures

Computer Graphics Shadow Algorithms

CSE528 Computer Graphics: Theory, Algorithms, and Applications

Illumination and Geometry Techniques. Karljohan Lundin Palmerius

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

Visibility: Z Buffering

CS488. Visible-Surface Determination. Luc RENAMBOT

CSE 167: Introduction to Computer Graphics. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2016

Lecture 4. Viewing, Projection and Viewport Transformations

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

Drawing Fast The Graphics Pipeline

COMP 175: Computer Graphics April 11, 2018

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

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

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

Procedural modeling and shadow mapping. Computer Graphics CSE 167 Lecture 15

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

Sign up for crits! Announcments

CSE 167: Introduction to Computer Graphics Lecture #8: Textures. Jürgen P. Schulze, Ph.D. University of California, San Diego Spring Quarter 2016

The Traditional Graphics Pipeline

CSE 167: Introduction to Computer Graphics Lecture #9: Scene Graph. Jürgen P. Schulze, Ph.D. University of California, San Diego Spring Quarter 2016

Total 80

Wed, October 12, 2011

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

CSE 167: Introduction to Computer Graphics Lecture #3: Coordinate Systems

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

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

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

Introduction to Computer Graphics. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2011

CSE 167: Introduction to Computer Graphics Lecture #19: Wrapping Up. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2017

FROM VERTICES TO FRAGMENTS. Lecture 5 Comp3080 Computer Graphics HKBU

Spatial Data Structures

CSE 167: Introduction to Computer Graphics Lecture #5: Visibility, OpenGL

CSE 167: Introduction to Computer Graphics Lecture 12: Bézier Curves. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2013

Spatial Data Structures

CS 381 Computer Graphics, Fall 2012 Midterm Exam Solutions. The Midterm Exam was given in class on Tuesday, October 16, 2012.

Shadow Algorithms. CSE 781 Winter Han-Wei Shen

Table of Contents. Questions or problems?

Computer Graphics. Shadows

Rasterization Overview

The Traditional Graphics Pipeline

3D Polygon Rendering. Many applications use rendering of 3D polygons with direct illumination

Spatial Data Structures

Robust Stencil Shadow Volumes. CEDEC 2001 Tokyo, Japan

RASTERISED RENDERING

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

Geometric Features for Non-photorealistiic Rendering

Graphics and Interaction Rendering pipeline & object modelling

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

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

graphics pipeline computer graphics graphics pipeline 2009 fabio pellacini 1

CS 4204 Computer Graphics

Transcription:

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

Announcements Project 3 due Monday Nov 13 th at 2pm Grading in basement labs starts at 2pm Tutoring hours will be in B270 until B260 reopens Project 3 late grading is on Friday Nov 17 th 2

Mentoring for VR Club Connor Smith, VR Club President, c3smith@ucsd.edu: We have a bunch of really interesting projects going on this quarter, and helping them is a very high-impact and rewarding job. Mentoring would only be a commitment of a few hours each weekend (3-5 hours on a Saturday or Sunday). We're specifically looking for people with a wealth of Unity experience. VR in Unity experience is preferred, but not required. 3

Visibility Culling Goal: Discard geometry that does not need to be drawn to speed up rendering Types of culling: Small object culling Degenerate culling Backface culling View frustum culling Occlusion culling 4

Rendering Pipeline Primitives Model and View Transformations Vertex Shading Projection Fragment Shading Visibility Culling 5 Image

Small Object Culling Object projects to less than a specified size Cull objects whose screen-space bounding box is less than a threshold number of pixels 6

Degenerate Culling Degenerate triangle has no area Normal n=0 All vertices in a straight line All vertices in the same place Source: Computer Methods in Applied Mechanics and Engineering, Volume 194, Issues 48 49 7

Backface Culling Consider triangles as one-sided, i.e., only visible from the front Closed objects If the back of the triangle is facing away from the camera, it is not visible Gain efficiency by not drawing it (culling) Roughly 50% of triangles in a scene are back facing 8

Backface Culling Convention: Triangle is front facing if vertices are ordered counterclockwise p2 p1 p0 p0 Front-facing p1 Back-facing p2 9

Backface Culling Compute triangle normal after projection (homogeneous division) Third component of n negative: front-facing, otherwise back-facing Remember: projection matrix is such that homogeneous division flips sign of third component 10

OpenGL OpenGL allows one- or two-sided triangles One-sided triangles: glenable(gl_cull_face); glcullface(gl_back) Two-sided triangles (no backface culling): gldisable(gl_cull_face) 11 gldisable(gl_cull_face); glenable(gl_cull_face);

View Frustum Culling Triangles outside of view frustum are off-screen Done on canonical view volume Images: SGI OpenGL Optimizer Programmer's Guide 12

Videos Rendering Optimizations - Frustum Culling http://www.youtube.com/watch?v=kvvhp9wmao8 View Frustum Culling Demo http://www.youtube.com/watch?v=bjrytbgpwic 13

Bounding Volumes Simple shape that completely encloses an object Generally a box or sphere Easier to calculate culling for spheres Easier to calculate tight fits for boxes Intersect bounding volume with view frustum instead of each primitive 14

Bounding Box How to cull objects consisting of may polygons? Cull bounding box Rectangular box, parallel to object space coordinate planes Box is smallest box containing the entire object 15 Image: SGI OpenGL Optimizer Programmer's Guide

View Frustum Culling Frustum defined by 6 planes Each plane divides space into outside, inside Check each object against each plane Outside, inside, intersecting If outside all planes Outside the frustum If inside all planes Inside the frustum Else partly inside and partly out Efficiency View frustum 16

Distance to Plane A plane is described by a point p on the plane and a unit normal n Find the (perpendicular) distance from point x to the plane n x p 17

Distance to Plane The distance is the length of the projection of x-p onto n dist = ( x p ) n n x p x p 18

Distance to Plane The distance has a sign positive on the side of the plane the normal points to negative on the opposite side zero exactly on the plane Divides 3D space into two infinite half-spaces dist(x) = ( x p ) n n Positive p 19 Negative

Distance to Plane Simplification d is independent of x d is distance from the origin to the plane We can represent a plane with just d and n 20

Frustum With Signed Planes Normal of each plane points outside outside means positive distance inside means negative distance 21

Test Sphere and Plane For sphere with radius r and origin x, test the distance to the origin, and see if it is beyond the radius Three cases: dist(x)>r completely above dist(x)<-r completely below -r<dist(x)<r intersects n Positive Negative 22

Culling Summary Pre-compute the normal n and value d for each of the six planes. Given a sphere with center x and radius r For each plane: if dist(x) > r: sphere is outside! (no need to continue loop) add 1 to count if dist(x)<-r If we made it through the loop, check the count: if the count is 6, the sphere is completely inside otherwise the sphere intersects the frustum (can use a flag instead of a count) 23

Culling Groups of Objects Want to be able to cull the whole group quickly But if the group is partly in and partly out, want to be able to cull individual objects 24

Hierarchical Bounding Volumes Given hierarchy of objects Bounding volume of each node encloses the bounding volumes of all its children Start by testing the outermost bounding volume If it is entirely outside, don t draw the group at all If it is entirely inside, draw the whole group 25

Hierarchical Culling If the bounding volume is partly inside and partly outside Test each child s bounding volume individually If the child is in, draw it; if it s out cull it; if it s partly in and partly out, recurse. If recursion reaches a leaf node, draw it normally 26

Video Math for Game Developers - Frustum Culling http://www.youtube.com/watch?v=4p-e_31xopm 27

Occlusion Culling Geometry hidden behind occluder cannot be seen Many complex algorithms exist to identify occluded geometry Images: SGI OpenGL Optimizer Programmer's Guide 28

Video Umbra 3 Occlusion Culling explained http://www.youtube.com/watch?v=5h4qgdbwqhc 29

Level-of-Detail Techniques Don t draw objects smaller than a threshold Small feature culling Popping artifacts Replace 3D objects by 2D impostors Textured planes representing the objects Adapt triangle count to projected size Impostor generation Original vs. impostor 30 Size dependent mesh reduction (Data: Stanford Armadillo)