Visibility III: Occlusion Queries CS 446: Real-Time Rendering & Game Technology David Luebke University of Virginia.

Slides:



Advertisements
Similar presentations
Graphics Pipeline.
Advertisements

N-Buffers for efficient depth map query Xavier Décoret Artis GRAVIR/IMAG INRIA.
Visibility Culling David Luebke Computer Science Department University of Virginia
Real-Time Rendering TEXTURING Lecture 02 Marina Gavrilova.
Visibility in Games Harald Riegler. 2 / 18 Visibility in Games n What do we need it for? u Increase of rendering speed by removing unseen scene data from.
CAP4730: Computational Structures in Computer Graphics Visible Surface Determination.
Visibility Culling. Back face culling View-frustrum culling Detail culling Occlusion culling.
Real-Time Rendering SPEACIAL EFFECTS Lecture 03 Marina Gavrilova.
Rasterization and Ray Tracing in Real-Time Applications (Games) Andrew Graff.
Chapter 6: Vertices to Fragments Part 2 E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley Mohan Sridharan Based on Slides.
CGDD 4003 THE MASSIVE FIELD OF COMPUTER GRAPHICS.
Tomas Mőller © 2000 Speeding up your game The scene graph Culling techniques Level-of-detail rendering (LODs) Collision detection Resources and pointers.
18.1 Si31_2001 SI31 Advanced Computer Graphics AGR Lecture 18 Image-based Rendering Light Maps What We Did Not Cover Learning More...
The Graphics Pipeline CS2150 Anthony Jones. Introduction What is this lecture about? – The graphics pipeline as a whole – With examples from the video.
1 Chapter 5 Viewing. 2 Perspective Projection 3 Parallel Projection.
University of Texas at Austin CS 378 – Game Technology Don Fussell CS 378: Computer Game Technology Beyond Meshes Spring 2012.
09/18/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Bump Mapping Multi-pass algorithms.
Hidden Surface Removal
1 Occlusion Culling ©Yiorgos Chrysanthou, , Anthony Steed, 2004.
Afrigraph 2004 Massive model visualization Tutorial A: Part I Rasterization Based Approaches Andreas Dietrich Computer Graphics Group, Saarland University.
Shadows Computer Graphics. Shadows Shadows Extended light sources produce penumbras In real-time, we only use point light sources –Extended light sources.
Erdem Alpay Ala Nawaiseh. Why Shadows? Real world has shadows More control of the game’s feel  dramatic effects  spooky effects Without shadows the.
Ray Tracing and Photon Mapping on GPUs Tim PurcellStanford / NVIDIA.
CS 638, Fall 2001 Today Light Mapping (Continued) Bump Mapping with Multi-Texturing Multi-Pass Rendering.
Technology and Historical Overview. Introduction to 3d Computer Graphics  3D computer graphics is the science, study, and method of projecting a mathematical.
CSE 381 – Advanced Game Programming Basic 3D Graphics
NVIDIA PROPRIETARY AND CONFIDENTIAL Occlusion (HP and NV Extensions) Ashu Rege.
Culling Techniques “To cull” means “to select from group” In graphics context: do not process data that will not contribute to the final image The “group”
1 SIC / CoC / Georgia Tech MAGIC Lab Rossignac Textures and shadows  Generation  Mipmap  Texture coordinates,
Computer Graphics An Introduction. What’s this course all about? 06/10/2015 Lecture 1 2 We will cover… Graphics programming and algorithms Graphics data.
09/09/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Event management Lag Group assignment has happened, like it or not.
Graphics Graphics Korea University cgvr.korea.ac.kr 1 Chapter 6 Special Effects 강 신 진강 신 진
CS 450: COMPUTER GRAPHICS REVIEW: INTRODUCTION TO COMPUTER GRAPHICS – PART 2 SPRING 2015 DR. MICHAEL J. REALE.
Computer Graphics 2 Lecture 8: Visibility Benjamin Mora 1 University of Wales Swansea Pr. Min Chen Dr. Benjamin Mora.
Visibility Culling III: Image-Space Occlusion David Luebke Computer Science Department University of Virginia
Real-Time Rendering SPEEDING UP RENDERING Lecture 04 Marina Gavrilova.
CS 638, Fall 2001 Multi-Pass Rendering The pipeline takes one triangle at a time, so only local information, and pre-computed maps, are available Multi-Pass.
Visibility Culling II: Beyond Cells & Portals David Luebke Computer Science Department University of Virginia
Occlusion Query. Content Occlusion culling Collision detection (convex) Etc. Fall
Advanced Computer Graphics Advanced Shaders CO2409 Computer Graphics Week 16.
2 COEN Computer Graphics I Evening’s Goals n Discuss application bottleneck determination n Discuss various optimizations for making programs execute.
Computer Graphics 2 Lecture 7: Texture Mapping Benjamin Mora 1 University of Wales Swansea Pr. Min Chen Dr. Benjamin Mora.
1Computer Graphics Implementation II Lecture 16 John Shearer Culture Lab – space 2
Implementation II.
David Luebke11/26/2015 CS 551 / 645: Introductory Computer Graphics David Luebke
09/16/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Environment mapping Light mapping Project Goals for Stage 1.
CSCE 552 Spring D Models By Jijun Tang. Triangles Fundamental primitive of pipelines  Everything else constructed from them  (except lines and.
Advanced Computer Graphics Spring 2014 K. H. Ko School of Mechatronics Gwangju Institute of Science and Technology.
Recap: General Occlusion Culling l When cells and portals don’t work… –Trees in a forest –A crowded train station l Need general occlusion culling algorithms:
Review on Graphics Basics. Outline Polygon rendering pipeline Affine transformations Projective transformations Lighting and shading From vertices to.
Visibility II CS 446: Real-Time Rendering & Game Technology
Image-based Rendering Ref: RTRv2. 2 Introduction Sprite, billboard, overview.
Computer Graphics I, Fall 2010 Implementation II.
What are shaders? In the field of computer graphics, a shader is a computer program that runs on the graphics processing unit(GPU) and is used to do shading.
DPL2/10/2016 CS 551/651: Final Review David Luebke
Real-Time Dynamic Shadow Algorithms Evan Closson CSE 528.
Programmable Graphics Hardware CS 446: Real-Time Rendering & Game Technology David Luebke University of Virginia.
CS 445 / 645: Introductory Computer Graphics Review.
Shadows David Luebke University of Virginia. Shadows An important visual cue, traditionally hard to do in real-time rendering Outline: –Notation –Planar.
Engine Basics: Optimizing Geometry CS 446: Real-Time Rendering & Game Technology David Luebke University of Virginia.
09/23/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Reflections Shadows Part 1 Stage 1 is in.
Occlusion Culling David Luebke University of Virginia.
CS 445: Introduction to Computer Graphics David Luebke University of Virginia Visibility Calculations and Occlusion Culling.
David Luebke 1 7/5/2016 CS 551/651: Advanced Computer Graphics Review for final.
- Introduction - Graphics Pipeline
Scene Manager Creates and places movable objects like lights and cameras so as to access them efficiently, e.g. for rendering. Loads and assembles world.
CS451Real-time Rendering Pipeline
UMBC Graphics for Games
CS 551 / 645: Introductory Computer Graphics
Frame Buffer Applications
Presentation transcript:

Visibility III: Occlusion Queries CS 446: Real-Time Rendering & Game Technology David Luebke University of Virginia

Real-Time Rendering 2 David Luebke REMINDER: I’ve reorganized the next few demos Feb 23: Erin Golub Feb 28:Sean Arietta Mar 2:Jiayuan Meng If this is a problem, let me know! Today: Project Offset Demo Time: Paul Tschirhart

Real-Time Rendering 3 David Luebke Assignment 3 Olsson 002a: I feel your pain –Working on fixing these problems, and on communicating their urgency…

Real-Time Rendering 4 David Luebke Recap: General Occlusion Culling Need general occlusion culling algorithms: –Aggregate occlusion (trees in forest) –Dynamic scenes (waving trees in forest; crowd scene) Many general occlusion culling algorithms use an image-space approach –Idea: solve visibility in 2D, on the image plane

Real-Time Rendering 5 David Luebke Recap: Hierarchical Z-Buffer Replace Z-buffer with a Z-pyramid –Lowest level: full-resolution Z-buffer –Higher levels: each pixel represents the max depth of the four pixels “underneath” it Basic idea: hierarchical rasterization of the polygon, with early termination where polygon is occluded

Real-Time Rendering 6 David Luebke Recap: Hierarchical Z-Buffer Z-pyramid exploits image-space coherence : –A polygon occluded at a pixel is probably occluded at nearby pixels HZB can also exploit object-space coherence –Polygons near occluded polygon are probably occluded –Idea: Z-query (hierarchical) bounding volumes before rendering their contents HZB can also exploit temporal coherence –Polygon visible last frame probably visible this frame –Idea: start each frame by rendering what was visible last frame

Real-Time Rendering 7 David Luebke Hierarchical Z-Buffer: Discussion HZB needs hardware support to be really competitive Hardware vendors haven’t entirely bought in: –Z-pyramid (and hierarchies in general) a pain in hardware –Unpredictable Z-query times generate bubbles in rendering pipe But we’re getting there… –ATI HyperZ, similar tech now in NVIDIA Supports image-space coherence 8x8 one-level hierarchical z-buffer “Under the hood”, not exposed to programmer –At the user level, hardware now supports occlusion queries Supports object-space coherence, temporal coherence

Real-Time Rendering 8 David Luebke Modern Occlusion Culling Occlusion query posited in original HZP paper –Want an “occlusion test”: would this polygon be visible if I rendered it? – How could you use such a test? Test portal polygons before rendering adjacent cell Test object bounding boxes before rendering object –Yay! GL_HP_OCCLUSION_TEST extension –Problems: CPU/GPU synchronization == bad Might want to know “how visible” is the polygon

Real-Time Rendering 9 David Luebke Modern Occlusion Culling GL_ARB_OCCLUSION_QUERY to the rescue –Non-blocking query “Is this occlusion query done yet?” Multiple queries in flight –Returns number of fragments visible Note: can actually render object or not Allows object-space, temporal coherence Still lots of issues for efficient culling

Real-Time Rendering 10 David Luebke 111 uses for Occlusion Queries Occlusion culling (duh) Others? –Approximate culling –LOD size estimation –Lens flare effects –Transparency –Collision detection (!) –Convergence testing

Occlusion Culling Grab Bag Portal textures –Dan Aliaga and others From-region visibility –Generalizes view-independent cell-portal problem Special case: 2.5D from-region visibility –Michael Wimmer and others Linear-time view-independent portal cull box approach? –Nina Amenta and others Modeling issues for cells-and-portals –Daniel Cohen-Or and others

Advanced Texturing CS 446: Real-Time Rendering & Game Technology David Luebke University of Virginia

Real-Time Rendering 13 David Luebke Terminology A note on terminology: –The following terms are used loosely in the literature –Don’t take my definitions as canonical

Billboards A billboard is a textured polygon (usually a quad) that rotates to face the viewer –Build a rotation matrix for each billboard – Screen-aligned billboard : quad is parallel to the screen and has a constant up vector Similar to old-school 2D sprites Useful for text, HUDs, lens flare, etc Build rotation matrix with camera u, n = - v, r = u X v – World-oriented billboard Sprite’s native up vector not always appropriate World-oriented billboard: use the world up vector Still faces viewer  n = - v, r = u X v

Real-Time Rendering 15 David Luebke Billboards Viewpoint-aligned – v = vector to eye (Fig. 8.5) –Resulting quads capture perspective distortions across view-frustum –Ex: clouds (Fig 8.6) Axially-alligned –Rotates around a fixed world-space axis –Ex: trees (Fig 8.7) –Problem: from above, look like cardboard cutouts

Point Sprites A point sprite is a screen-aligned textured square (i.e., a billboard) placed by rendering a single vertex –Ideal for particle systems –When GL_POINT_SPRITE_NV is enabled: Point antialiasing state ignored – all points  quads Points are rendered with point width as usual Tex coords of points can be replaced by special “point sprite” tex coords s,t,r between 0,1 –Tex coord r is special, can set to zero (default) or use to ‘play back’ an animation stored in 3D tex (COORD_REPLACE_NV) – See – See ; search for “point sprite”

Imposters Imposter : general term for texture that replaces geometry –Billboards == imposters that rotate to face viewer –Often used in the context of LOD A dynamic imposter is an imposter created on the fly to “cache” rendered imagery –Once rendered, cost of rendering an imposter is just a single textured quad (note poor texture cache coherence though) –Can use for a few frames before updating –Can use for a few instances of the object Works best on distant objects (why?) Great example: portal textures

Real-Time Rendering 18 David Luebke Imposters & “Depth Sprites” Can render an object with a depth texture, so depth buffer affects/is affected by the rendering (Fig 8.16) –Can also do depth-affected lighting –Needs to be orthogonal or nearly orthogonal to look right –Under the right circumstances, might allow combining imposters with dynamic geometry Ex: portal texture with monster moving around the textured cell

Real-Time Rendering 19 David Luebke Imposters Continued Sometimes “imposter” used to refer to what I’ll call depth meshes –UNC MMR system –Imposters for urban environments

Real-Time Rendering 20 David Luebke Imposters Continued Can represent an object as collection of imposters –Common trick for trees, usually manually placed – Billboard clouds apply this idea to other (all) objects –The trick is to compute these automatically…

Multitexturing Modern hardware can read from multiple textures at once, even with mipmapping – Light maps –Detail texturing –Decals x= From UT2004 © Epic Games Inc

Real-Time Rendering 22 David Luebke Textures: Other Important Stuff Render to texture – framebuffer objects (FBOs) Environment maps –Sphere map, cube maps (hardware supported) Shadow maps –Basically, a depth texture from light source point of view –More later Relief textures –Demo now, details later

Real-Time Rendering 23 David Luebke Textures: Still More Stuff Normal maps – especially for bump mapping –Gloss maps, reflectance maps, etc Generally: –Think of textures as global memory for fragment programs, with built-in filtering –Just starting to be able to access textures in vertex programs too (NVIDIA hardware only, today) Deferred shading Projective texture mapping

Real-Time Rendering 24 David Luebke Next topic: Cg Many of the tricks we discuss in this class do not depend on programmable graphics hardware But, most are easier to implement this way! So, the next topic is a brief intro to Cg –My apologies to those of you who’ve seen this –My apologies to those of you who haven’t