Tomas Mőller © 2000 Speeding up your game The scene graph Culling techniques Level-of-detail rendering (LODs) Collision detection Resources and pointers.

Slides:



Advertisements
Similar presentations
Christian Lauterbach COMP 770, 2/16/2009. Overview  Acceleration structures  Spatial hierarchies  Object hierarchies  Interactive Ray Tracing techniques.
Advertisements

Collisions and Intersections When objects move, test for collision. When projecting surfaces, check for intersections. (Many slides adapted from Amitabh.
Intersection Testing Chapter 13 Tomas Akenine-Möller Department of Computer Engineering Chalmers University of Technology.
Collision Detection CSCE /60 What is Collision Detection?  Given two geometric objects, determine if they overlap.  Typically, at least one of.
David Luebke5/11/2015 CS 551 / 645: Introductory Computer Graphics David Luebke
Occlusion Culling Fall 2003 Ref: GamasutraGamasutra.
Visibility in Computer Graphics Toni Sellarès Unversitat de Girona
CSE 381 – Advanced Game Programming Scene Management
Visibility Culling. Back face culling View-frustrum culling Detail culling Occlusion culling.
Visibility Culling Back face culling View-frustrum culling Detail culling Occlusion culling.
Chapter 6: Vertices to Fragments Part 2 E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley Mohan Sridharan Based on Slides.
1 Dr. Scott Schaefer Hidden Surfaces. 2/62 Hidden Surfaces.
CGDD 4003 THE MASSIVE FIELD OF COMPUTER GRAPHICS.
Introduction General Data Structures - Arrays, Linked Lists - Stacks & Queues - Hash Tables & Binary Search Trees - Graphs Spatial Data Structures -Why.
Tomas Mőller © 2000 Speed-up Techniques for Real-Time Rendering or “What makes your real-time video game fly” Tomas Möller Chalmers University of Technology,
Advanced Data Structures for Games and Graphics Lecture 4
Hidden Surface Elimination Wen-Chieh (Steve) Lin Institute of Multimedia Engineering I-Chen Lin’ CG Slides, Rich Riesenfeld’s CG Slides, Shirley, Fundamentals.
Overview Introduction Constructing a scene Rendering Frustum culling OpenGL Performer.
Bounding Volume Hierarchies and Spatial Partitioning Kenneth E. Hoff III COMP-236 lecture Spring 2000.
Vertices and Fragments III Mohan Sridharan Based on slides created by Edward Angel 1 CS4395: Computer Graphics.
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.
Spatial Data Structure: Quadtree, Octree,and BSP tree Mengxia Zhu Fall 2007.
10/11/2001CS 638, Fall 2001 Today Kd-trees BSP Trees.
10/02/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Octrees.
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.
Computer Graphics 2 Lecture x: Acceleration Techniques for Ray-Tracing Benjamin Mora 1 University of Wales Swansea Dr. Benjamin Mora.
Spatial Data Structures Jason Goffeney, 4/26/2006 from Real Time Rendering.
CS 450: COMPUTER GRAPHICS VISIBLE SURFACE DETECTION SPRING 2015 DR. MICHAEL J. REALE.
Open Scene Graph Visualization II MSIM 842, CS 795/895
10/09/2001CS 638, Fall 2001 Today Spatial Data Structures –Why care? –Octrees/Quadtrees –Kd-trees.
The Visibility Problem In many environments, most of the primitives (triangles) are not visible most of the time –Architectural walkthroughs, Urban environments.
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”
Computer Graphics 2 Lecture 8: Visibility Benjamin Mora 1 University of Wales Swansea Pr. Min Chen Dr. Benjamin Mora.
Implementing Scene Graphs, CSG Trees Glenn G. Chappell U. of Alaska Fairbanks CS 481/681 Lecture Notes Monday, January 26, 2004.
Real-Time Rendering SPEEDING UP RENDERING Lecture 04 Marina Gavrilova.
Visible-Surface Detection Jehee Lee Seoul National University.
1 Advanced Scene Management. 2 This is a game-type-oriented issue Bounding Volume Hierarchies (BVHs) Binary space partition trees (BSP Trees) “Quake”
PRESENTED BY – GAURANGI TILAK SHASHANK AGARWAL Collision Detection.
Collaborative Visual Computing Lab Department of Computer Science University of Cape Town Graphics Topics in VR By Shaun Nirenstein.
2 COEN Computer Graphics I Evening’s Goals n Discuss application bottleneck determination n Discuss various optimizations for making programs execute.
Real-time Graphics for VR Chapter 23. What is it about? In this part of the course we will look at how to render images given the constrains of VR: –we.
CIS 350 – I Game Programming Instructor: Rolf Lakaemper.
1Computer Graphics Implementation II Lecture 16 John Shearer Culture Lab – space 2
Implementation II Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico.
Implementation II.
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
Computer Graphics Zhen Jiang West Chester University.
10/07/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Spatial data structures.
CSCE 552 Spring D Models By Jijun Tang. Triangles Fundamental primitive of pipelines  Everything else constructed from them  (except lines and.
Ray Tracing II. HW1 Part A due October 10 Camera module Object module –Read from a file –Sphere and Light only Ray tracer module: –No shading. No reflection.
Visibility II CS 446: Real-Time Rendering & Game Technology
Maths & Technologies for Games Spatial Partitioning 2
Computer Graphics I, Fall 2010 Implementation II.
Honours Graphics 2008 Session 5. Today’s focus Rasterization Visibility determination Coarse / fine visibility determination.
DPL2/10/2016 CS 551/651: Final Review David Luebke
1 CSCE 441: Computer Graphics Hidden Surface Removal Jinxiang Chai.
Computer Graphics Inf4/MSc 1 Computer Graphics Lecture 5 Hidden Surface Removal and Rasterization Taku Komura.
David Luebke 3/5/2016 Advanced Computer Graphics Lecture 4: Faster Ray Tracing David Luebke
David Luebke3/12/2016 Advanced Computer Graphics Lecture 3: More Ray Tracing David Luebke
1 Advanced Scene Management. 2 This is a game-type-oriented issue Bounding Volume Hierarchies (BVHs) Binary space partition trees (BSP Trees) “Quake”
Computer Graphics: Programming, Problem Solving, and Visual Communication Steve Cunningham California State University Stanislaus and Grinnell College.
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.
Computer Graphics Implementation II
Bounding Volume Hierarchies and Spatial Partitioning
Bounding Volume Hierarchies and Spatial Partitioning
© University of Wisconsin, CS559 Fall 2004
CSCE 441: Computer Graphics Hidden Surface Removal
Presentation transcript:

Tomas Mőller © 2000 Speeding up your game The scene graph Culling techniques Level-of-detail rendering (LODs) Collision detection Resources and pointers (adapted by Marc Levoy from a lecture by Tomas Möller, using material from Real-Time Rendering)

Tomas Mőller © 2000 The scene graph DAG – directed acyclic graph – Simply an n-ary tree without loops leaves contains geometry each node holds a – bounding volume (BV) – pointers to children – possibly a transform examples of BVs: spheres, boxes the BV in a node encloses all the geometry of the nodes in its subtree internal node =

Tomas Mőller © 2000 Scene graph example circles=BVs scene graph root

Tomas Mőller © 2000 Using transforms for instancing… put transform in internal node(s) Move right, Rotate 45° Move up

Tomas Mőller © 2000 …or hierarchical animations AB C No hierarchy: one transform 21 3 Hierarchy:3 transforms LegXform KneeFootHipXform

Tomas Mőller © 2000 Types of culling backface culling hierarchical view-frustum culling portal culling detail culling occlusion culling

Tomas Mőller © 2000 Backface culling often implemented for you in the API OpenGL: glCullFace(GL_BACK); requires consistently oriented polygons screen space front back front back eye eye space

Tomas Mőller © 2000 (Hierarchical) view frustum culling root camera

Tomas Mőller © 2000 Variants octree BSP tree – axis-aligned – polygon-aligned (like Fuchs’s algorithm) if a splitting plane is outside the frustum, one of its two subtrees can be culled

Tomas Mőller © 2000 Portal culling plan view of architectural environment circles are objects to be rendered

Tomas Mőller © 2000 Simple algorithm (Luebke and Georges ‘95) create graph of environment (e.g. building) – nodes represent cells (e.g. rooms) – edges represent portals between cells (doors) for each frame: – V  cell containing viewer, P  screen bbox – * render V’s contents, culling to frustum through P – V  a neighbor of V (through a portal) – project portal onto screen, intersect bbox with P if empty intersection, then V is invisible from viewer, return if non-empty, P  intersection, recursively call *

Tomas Mőller © 2000 Example Images courtesy of David P. Luebke and Chris Georges typical speedups: 2x - 100x

Tomas Mőller © 2000 Variants stop recursion when cell is too far away stop recursion when out of time compute potentially visible set (PVS) – viewpoint-independent pre-process – which objects in V2 might be visible from V1? – only meaningful if V1 and V2 are not adjacent – easy to be conservative; hard to be optimal V1V2

Tomas Mőller © 2000 Detail culling detail culling OFF cull object if projected BV occupies less than N pixels not much visible difference here, but 1x - 4x faster especially useful when moving detail culling ON Images courtesy of ABB Robotics Products, created by Ulf Assarsson

Tomas Mőller © 2000 Estimating projected area distance in direction d is d  (c-v) projected radius p is roughly (n r) / (d  (c-v)) projected area is  p 2 (eye) v (near plane) n d (normalized view direction) r c

Tomas Mőller © 2000 Occlusion culling main idea: objects that lie completely “behind” another set of objects can be culled “portal culling” is a special case of occlusion culling

Tomas Mőller © 2000 Sample occlusion culling algorithm draw scene from front to back maintain an “occlusion horizon” (yellow)

Tomas Mőller © 2000 Sample occlusion culling algorithm to process tetrahedron (which is behind grey objects): – find axis-aligned box of projection – compare against occlusion horizon culled

Tomas Mőller © 2000 Sample occlusion culling algorithm when an object is partially visible: – add its bounding box to the occlusion horizon

Tomas Mőller © 2000 Hierarchical Z-buffer algorithm (Greene, Kass, and Miller 1993) octree in object space + multiresolution Z-buffer in screen space used in both NVIDIA and ATI chips

Tomas Mőller © 2000 Object-space octree (shown using quadtree) Images from Ned Greene

Tomas Mőller © 2000 Object-space octree (shown using quadtree)

Tomas Mőller © 2000 Object-space octree (shown using quadtree)

Tomas Mőller © 2000 Object-space octree (shown using quadtree)

Tomas Mőller © 2000 Object-space octree (shown using quadtree)

Tomas Mőller © 2000 Object-space octree (shown using quadtree)

Tomas Mőller © 2000 Object-space octree (shown using quadtree)

Tomas Mőller © 2000 Hierarchical Z-buffer reduce cost of Z-testing large polygons maintain low-res versions of Z-Buffer

Tomas Mőller © 2000 Level-of-detail rendering use different levels of detail at different distances from the viewer

Tomas Mőller © 2000 Level-of-detail rendering not much visual difference, but a lot faster use area of projection of BV to select appropriate LOD

Tomas Mőller © 2000 Collision detection cannot test every pair of triangles: O(n 2 ) use BVs because these are cheap to test better: use a hierarchical scene graph

Tomas Mőller © 2000 Testing for collision between two scene graphs start with the roots of the two scene graphs testing for collision between the bounding volumes of two internal nodes – if no overlap, then exit – if overlap, then descend into the children of the internal node with largest volume an internal node against a triangle – descend into the internal node a triangle against a triangle – test for interpenetration

Tomas Mőller © 2000 Triangle - triangle collision test compute the line of intersection between the supporting planes of the two triangles compute the intersection interval between this line and the two triangles – gives two intervals if the two intervals overlap, then the two triangles interpenetrate!

Tomas Mőller © 2000 Simpler collision detection only shoot rays to find collisions, i.e., approximate an object with a set of rays cheaper, but less accurate

Tomas Mőller © 2000 Can you compute the time of a collision? move ball, test for hit, move ball, test for hit… can get “quantum effects”! in some cases it’s possible to find closed- form expression: t = s / v v s

Tomas Mőller © 2000 Resources and pointers Real Time Rendering (the book) – Journal of Graphics Tools –