Frustum Culling in OpenGL

Slides:



Advertisements
Similar presentations
Graphics Pipeline.
Advertisements

Intersection Testing Chapter 13 Tomas Akenine-Möller Department of Computer Engineering Chalmers University of Technology.
Geometry Primer Lines and rays Planes Spheres Frustums Triangles Polygon Polyhedron.
Occlusion Culling Fall 2003 Ref: GamasutraGamasutra.
Lecture Fall 2001 Visibility Back-Face Culling Painter’s Algorithm.
Advanced Computer Graphics Spring 2014 K. H. Ko School of Mechatronics Gwangju Institute of Science and Technology.
Vertices and Fragments I CS4395: Computer Graphics 1 Mohan Sridharan Based on slides created by Edward Angel.
Tomas Mőller © 2000 Speeding up your game The scene graph Culling techniques Level-of-detail rendering (LODs) Collision detection Resources and pointers.
Fall 2006 revised1 Frustum Culling in OpenGL Ref: MarkMoley.com.
1 Advanced Scene Management System. 2 A tree-based or graph-based representation is good for 3D data management A tree-based or graph-based representation.
1 Chapter 5 Viewing. 2 Perspective Projection 3 Parallel Projection.
Introduction to 3D Graphics John E. Laird. Basic Issues u Given a internal model of a 3D world, with textures and light sources how do you project it.
2/26/04© University of Wisconsin, CS559 Spring 2004 Last Time General Orthographic Viewing –Specifying cameras in world coordinates –Building world  view.
COMP 175: Computer Graphics March 24, 2015
Week 5 - Wednesday.  What did we talk about last time?  Project 2  Normal transforms  Euler angles  Quaternions.
Week 13 - Friday.  What did we talk about last time?  Ray/sphere intersection  Ray/box intersection  Slabs method  Line segment/box overlap test.
Graphics Graphics Korea University cgvr.korea.ac.kr 3D Viewing 고려대학교 컴퓨터 그래픽스 연구실.
CSC 461: Lecture 3 1 CSC461 Lecture 3: Models and Architectures  Objectives –Learn the basic design of a graphics system –Introduce pipeline architecture.
Real-Time Rendering SPEEDING UP RENDERING Lecture 04 Marina Gavrilova.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
1Computer Graphics Lecture 4 - Models and Architectures John Shearer Culture Lab – space 2
CAP4730: Computational Structures in Computer Graphics 3D Transformations.
CS 450: COMPUTER GRAPHICS PROJECTIONS SPRING 2015 DR. MICHAEL J. REALE.
1 Visiblity: Culling and Clipping Computer Graphics COMP 770 (236) Spring 2009 January 21 & 26: 2009.
David Luebke11/26/2015 CS 551 / 645: Introductory Computer Graphics David Luebke
OpenGL The Viewing Pipeline: Definition: a series of operations that are applied to the OpenGL matrices, in order to create a 2D representation from 3D.
Mark Nelson 3d projections Fall 2013
Basic Perspective Projection Watt Section 5.2, some typos Define a focal distance, d, and shift the origin to be at that distance (note d is negative)
Review on Graphics Basics. Outline Polygon rendering pipeline Affine transformations Projective transformations Lighting and shading From vertices to.
Three-Dimensional Viewing
Rendering Pipeline Fall, D Polygon Rendering Many applications use rendering of 3D polygons with direct illumination.
1 CSCE 441: Computer Graphics Hidden Surface Removal Jinxiang Chai.
Coordinate Systems Lecture 1 Fri, Sep 2, The Coordinate Systems The points we create are transformed through a series of coordinate systems before.
1 E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012 Models and Architectures 靜宜大學 資訊工程系 蔡奇偉 副教授 2012.
Viewing. Classical Viewing Viewing requires three basic elements - One or more objects - A viewer with a projection surface - Projectors that go from.
CS552: Computer Graphics Lecture 9: Perspective Projection.
Lecture 9 From Vertices to Fragments. Objectives Introduce basic implementation strategies Clipping Rasterization hidden-surface removal.
Three Dimensional Viewing
Visible Surface Detection
Rendering Pipeline Fall, 2015.
- Introduction - Graphics Pipeline
Computer Graphics Implementation II
Bounding Volume Hierarchies and Spatial Partitioning
3D Viewing cgvr.korea.ac.kr.
Rendering Pipeline Aaron Bloomfield CS 445: Introduction to Graphics
BACK FACE DETECTION back-face detection Determination of whether a face of an object is facing backward and therefore invisible. The usual test is whether.
Computer Graphics Viewing
CSCE 441 Computer Graphics 3-D Viewing
Bounding Volume Hierarchies and Spatial Partitioning
Modeling 101 For the moment assume that all geometry consists of points, lines and faces Line: A segment between two endpoints Face: A planar area bounded.
CENG 477 Introduction to Computer Graphics
3D Clipping.
Models and Architectures
Models and Architectures
CSCE 441: Computer Graphics Hidden Surface Removal
Models and Architectures
Introduction to Computer Graphics with WebGL
Three Dimensional Viewing
Computer Graphics Imaging
Computer Graphics Lecture 20
Implementation II Ed Angel Professor Emeritus of Computer Science
Visibility Computations
Lecture 13 Clipping & Scan Conversion
Models and Architectures
© University of Wisconsin, CS559 Fall 2004
Models and Architectures
Introduction to Computer Graphics with WebGL
Implementation II Ed Angel Professor Emeritus of Computer Science
Presentation transcript:

Frustum Culling in OpenGL Ref: MarkMoley.com Fall 2006 revised

Culling Techniques Fall 2006 revised

Outline Introduction Frustum Plane Extraction View Frustum Plane Equation Frustum Plane Extraction Frustum/Point/Sphere Inclusion Tests Fall 2006 revised

Definition (View Frustum) the volume of space that includes everything visible from a given viewpoint defined by six planes arranged in the shape of a pyramid with the top chopped off If a point is inside this volume then it's in the frustum and it's visible, and vice versa Visible here mean potentially visible. It might be behind another point that obscures it, but it's still in the frustum. … the scope of occlusion culling Fall 2006 revised

View Frustum (cont) Fall 2006 revised

Definition (Plane) Divide the space into two halves; extends to infinity any given point is (in front of | behind | on) the plane. In R3, a plane is defined by four numbers: A plane equation: Ax + By + Cz +D = 0 Fall 2006 revised

Plane Equation Fall 2006 revised

Normalized Plane Equation Fall 2006 revised

Frustum Culling Idea: Tasks: If object is not in frustum, do not send it through pipeline (it is not visible) Wrap the object in a bounding volume; test the bounding volume against frustum (in world coordinate system) Sphere, bounding boxes, … Tasks: Frustum plane extraction Inclusion tests for different bounding volumes Fall 2006 revised

Frustum Plane Extraction The rendering pipeline: P M s u t In frustum culling, s is usually a point on BV, in world coordinate Fall 2006 revised

Rendering Pipeline (cont) M s u t c : product of PM In OpenGL,clip volume is [-1,1]3 Fall 2006 revised

Frustum Plane Extraction (Left) ux uy -1 1 Left Fall 2006 revised

Left Plane (cont) The left plane in clip coordinate: ux uy -1 1 Left The left plane in clip coordinate: The corresponding equation in world coordinate: Fall 2006 revised

Frustum Plane Extraction (Right) ux uy -1 1 Right Fall 2006 revised

Right Plane (cont) The right plane in clip coordinate: ux uy -1 1 Right The right plane in clip coordinate: The corresponding equation in world coordinate: Fall 2006 revised

Summary Fall 2006 revised

The valid sides of all halfspaces are > 0 PointInFrustum Test A point in frustumin all 6 halfspaces The valid sides of all halfspaces are > 0 Fall 2006 revised

SphereInFrustum Test PointInOffsetFrustum Test Minkowski sum of sphere and frustum Fall 2006 revised

Minkowski Sum Coordinate dependent! Fall 2006 revised

Signed Distance to Left Plane Plane equations are further normalized to facilitate distance computation ux uy -1 1 Left d<0 Fall 2006 revised

Remarks Use bounding spheres Can be conservative if the object is slender Use hierarchical bounding volume where appropriate (see next page) BoxInFrustum: complicated and expensive AABB: already so OBB: more so Fall 2006 revised

How can bounding volume hierarchies help? View-frustum culling Ray-tracing Collision detection Fall 2006 revised

How can bounding volume hierarchies help? View-frustum culling Ray-tracing Collision detection Fall 2006 revised

How can bounding volume hierarchies help? View-frustum culling Ray-tracing Collision detection Fall 2006 revised

How can bounding volume hierarchies help? View-frustum culling Ray-tracing Collision detection Fall 2006 revised

Example (Culling Off: FPS 15.5) Fall 2006 revised

Example (Culling On: FPS 31.0) Fall 2006 revised

Portal rendering World coordinates?! Plane representation in R3 Epilogue Portal rendering World coordinates?! Plane representation in R3 Fall 2006 revised

Indoor Scenes Similar to building walkthrough Occlusions in scene are common (culling important) Geometric database can be huge; preprocessing is required to facilitate smooth viewing Fall 2006 revised

Preprocessing for Indoor Scenes Potential visible set (PVS) only load the rooms that are visible from the current room Fall 2006 revised

Portal Rendering M R K L Ki B C E 1 2 3 4 5 6 7 8 M B 1 4 E 2 C 7 3 6 Fall 2006 revised Ki

Portal Rendering only render the other rooms in PVS if the “portal surfaces” are in sight Fall 2006 revised

But aren’t s local coordinates? Earlier, we said… P M s u t But aren’t s local coordinates? Fall 2006 revised

Recall Pipeline… Modelview Matrix Fall 2006 revised world coordinates Transform Viewing Modelview Matrix world coordinates Fall 2006 revised

Frustum Culling Scenario the scene is (mostly) static and specified in their world coordinate (the modeling transform is identity) the viewer navigates around them, changing the viewing transform only Fall 2006 revised

Therefore … I t u s t = PMs M : viewing transform s : world coordinate Model Transform Viewing Modelview Matrix world coordinates I t u s t = PMs M : viewing transform s : world coordinate Fall 2006 revised

Verification L R X Z x–z+10 –x–z+10 Fall 2006 revised

Supplement: Representing a Plane in R3 x: pivot variable Fall 2006 revised

Plane in R3 (cont) n x p Fall 2006 revised

Summary Algebraic equation Parametric equation Vector equation Depending on the application, select the most suitable equation In/out test Projection … Fall 2006 revised

Screen-Space Bounding Box (SSBB) Useful in GPU-assisted collision detection applications Screen-Space Bounding Box (SSBB) Compute and display the screen-space bounding box of an AABB (axis-aligned bounding box) Convert world coordinates to clip coordinates, perspective-divide to get normalized device coordinate (and then window coordinates) Fall 2006 revised

Display Viewing Frustum Useful for projective texturing (showing where the projector is) Useful for illustrating frustum culling Given [-1,1]3 clip coordinates, determine their corresponding world coordinates to render Fall 2006 revised