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.

Slides:



Advertisements
Similar presentations
Visible-Surface Detection(identification)
Advertisements

Christian Lauterbach COMP 770, 2/16/2009. Overview  Acceleration structures  Spatial hierarchies  Object hierarchies  Interactive Ray Tracing techniques.
Collision Detection CSCE /60 What is Collision Detection?  Given two geometric objects, determine if they overlap.  Typically, at least one of.
Computer graphics & visualization Collisions. computer graphics & visualization Simulation and Animation – SS07 Jens Krüger – Computer Graphics and Visualization.
Geometry Primer Lines and rays Planes Spheres Frustums Triangles Polygon Polyhedron.
Ray Tracing CMSC 635. Basic idea How many intersections?  Pixels  ~10 3 to ~10 7  Rays per Pixel  1 to ~10  Primitives  ~10 to ~10 7  Every ray.
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.
Korea Univ. Graphics Lab. 3D Game Engine Design Chapter 12. Spatial Sorting Chung Ji Hye
Week 14 - Monday.  What did we talk about last time?  Bounding volume/bounding volume intersections.
1 Dr. Scott Schaefer Hidden Surfaces. 2/62 Hidden Surfaces.
Collision Detection CSE 191A: Seminar on Video Game Programming Lecture 3: Collision Detection UCSD, Spring, 2003 Instructor: Steve Rotenberg.
Tomas Mőller © 2000 Speeding up your game The scene graph Culling techniques Level-of-detail rendering (LODs) Collision detection Resources and pointers.
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
Introduction General Data Structures - Arrays, Linked Lists - Stacks & Queues - Hash Tables & Binary Search Trees - Graphs Spatial Data Structures -Why.
UNC Chapel Hill M. C. Lin Overview of Last Lecture About Final Course Project –presentation, demo, write-up More geometric data structures –Binary Space.
CS6500 Adv. Computer Graphics © Chun-Fa Chang, Spring 2003 Space Partitions.
Bounding Volume Hierarchies and Spatial Partitioning Kenneth E. Hoff III COMP-236 lecture Spring 2000.
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.
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.
Managing Your Objects Paul Taylor 2009 Assignment Due Fri 5/6/2009.
CS 450: COMPUTER GRAPHICS VISIBLE SURFACE DETECTION SPRING 2015 DR. MICHAEL J. REALE.
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.
CSE 381 – Advanced Game Programming Quickhull and GJK.
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”
On a Few Ray Tracing like Algorithms and Structures. -Ravi Prakash Kammaje -Swansea University.
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”
CS-378: Game Technology Lecture #10: Spatial Data Structures Prof. Okan Arikan University of Texas, Austin Thanks to James O’Brien, Steve Chenney, Zoran.
Collision/Acceleration University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2013 Tamara Munzner.
PRESENTED BY – GAURANGI TILAK SHASHANK AGARWAL Collision Detection.
Fundamentals of Computer Graphics Sai-Keung Wong National Chiao Tung University Department of Computer Science Date: 5 March References: wikipedia,
Using BSP for CD Ref: BSP in deBerg et al ’ s book (url)url.
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.
Saarland University, Germany B-KD Trees for Hardware Accelerated Ray Tracing of Dynamic Scenes Sven Woop Gerd Marmitt Philipp Slusallek.
1 KIPA Game Engine Seminars Jonathan Blow Ajou University December 6, 2002 Day 10.
CIS 350 – I Game Programming Instructor: Rolf Lakaemper.
Fast BVH Construction on GPUs (Eurographics 2009) Park, Soonchan KAIST (Korea Advanced Institute of Science and Technology)
David Luebke11/26/2015 CS 551 / 645: Introductory Computer Graphics David Luebke
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.
Maths & Technologies for Games Spatial Partitioning 2
Advanced topics Advanced Multimedia Technology: Computer Graphics Yung-Yu Chuang 2006/01/04 with slides by Brian Curless, Zoran Popovic, Mario Costa Sousa.
Honours Graphics 2008 Session 5. Today’s focus Rasterization Visibility determination Coarse / fine visibility determination.
1 CSCE 441: Computer Graphics Hidden Surface Removal Jinxiang Chai.
1 Advanced Scene Management. 2 This is a game-type-oriented issue Bounding Volume Hierarchies (BVHs) Binary space partition trees (BSP Trees) “Quake”
Hierarchical Data Structure in Game Programming Yanci Zhang Game Programming Practice.
1 Geometry for Game. Geometry Geometry –Position / vertex normals / vertex colors / texture coordinates Topology Topology –Primitive »Lines / triangles.
CS552: Computer Graphics Lecture 28: Solid Modeling.
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.
Bounding Volume Hierarchies and Spatial Partitioning
Collision Detection Spring 2004.
Bounding Volume Hierarchies and Spatial Partitioning
Deformable Collision Detection
Modeliranje kompleksnih modelov
Real-Time Ray Tracing Stefan Popov.
Parts of these slides are based on
CSCE 441: Computer Graphics Hidden Surface Removal
Collision Detection.
Deformable Collision Detection
Modeliranje kompleksnih modelov
Presentation transcript:

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 is good for 3D data management Scene tree Scene tree Scene graph Scene graph 3D data management including : 3D data management including : Transformations for each 3D object Transformations for each 3D object Hierarchical relationship Hierarchical relationship Space coherence Space coherence Data instancing Data instancing Geometric computation Geometric computation Hit test Hit test Collision detection Collision detection Terrain following Terrain following Rendering management Rendering management Visibility Visibility Alpha Sorting Alpha Sorting Scene Management in Hierarchical Form

3 Etc Parameters Geometric Data Shape TransformationMove Parent Object Hierarchy Motion Data Animation Clone An Object in the Scene (An Example from TheFly)

4 A tree-based representation A simplified scene graph Root A Scene Tree (An Example) 1/2

5 A tree-based representation A simplified scene graph A Scene Tree (An Example) 2/2 Root

6 Bounding sphere Bounding sphere Bounding Sphere AABB OBB k-DOP Bounding Volume Bounding Cylinder Bounding cylinder Bounding cylinder Axis-aligned bounding box (AABB) Axis-aligned bounding box (AABB) Oriented bounding box (OBB) Oriented bounding box (OBB) Discrete oriented polytope (k-DOP) Discrete oriented polytope (k-DOP)

7 Collision detection Collision detection Visibility culling Visibility culling Hit test Hit test Steering behavior Steering behavior In “Game AI” section In “Game AI” section Bounding Volume - Applications

8 Bounding sphere B 1 (c 1, r 1 ), B 2 (c 2, r 2 ) If the distance between two bounding spheres is larger than the sum of radius of the spheres, than these two objects have no chance to collide. D > Sum(r 1, r 2 ) D > Sum(r 1, r 2 ) D B1B1B1B1 B2B2B2B2 c1c1c1c1 c2c2c2c2 Application Example - Bounding Sphere

9 Axis-aligned bounding box (AABB) Axis-aligned bounding box (AABB) Simplified calculation using axis-alignment feature Simplified calculation using axis-alignment feature But need run-timely to track the bounding box But need run-timely to track the bounding box AABB Application Example - AABB

10 Oriented bounding box (OBB) Oriented bounding box (OBB) Need intersection calculation using the transformed OBB geometric data Need intersection calculation using the transformed OBB geometric data 3D containment test 3D containment test Line intersection with plane Line intersection with plane For games, For games, OBB Application Example - OBB

11 This is a game-type-oriented issue. This is a game-type-oriented issue. Bounding volume hierarchies (BVHs) Bounding volume hierarchies (BVHs) Binary space partition trees (BSP Trees) Binary space partition trees (BSP Trees) “Quake” “Quake” Octree & quadtree Octree & quadtree Possible Visible Set Possible Visible Set Culling Skills Culling Skills Advanced Scene Graphs

12 Bounding spheres or AABB in hierarchy Can be used for dynamic scene objects R B Bounding Volume Hierarchies (BVHs)

13 LBVH Linear BVH Tree construction using Morton Code BVH Construction - LBVH

14 2D example Morton Code (1/2) Generate the Morton Code Convert the x and y coordinate numbers into binary Then “interleave” the bits to get the Morton number : 1 in binary : 5 in binary xyxyxy : 35 Your interleaved Morton number

15 Morton Code (2/2) By constructing a 2 k x2 k x2 k lattice within the AABB of the whole scene, we can quantize each of the 3 coordinates of the center of the bounding volume of the scene object. The 3-bit Morton Code of the object is constructed by interleaving the successive bits of these coordinates. Sorting the objects in increasing order along the Morton curve. We construct the 1 st level split by examining the most significant bit of all codes, placing those with 0 and 1 bits in the 1 st and 2 nd child, respectively, of the root. Applying the bucketing procedures recursively in each child, looking at the 2 nd most significant bit. In each recursive step, we look at the next bit in the Morton code until all bits are consumed.

16 BVH Construction – SAH Hierarchy Construction SAH Surface Area Heuristic method Calculate the cost to bin the tree node into two children SAH cost function SA(N) the surface area of the node’s bounding volume K T & K I are constants n l : object number of left child node n r : object number of right child node Can be applied to BVH and KD Tree.

17 Two variants Two variants Axis-aligned Axis-aligned KD tree KD tree Polygon-aligned Polygon-aligned The trees are created by using a plane to divide the space into two, and then sorting the geometry into two spaces. The trees are created by using a plane to divide the space into two, and then sorting the geometry into two spaces. BSP Tree

18 plane1 plane0 plane2 plane Axis-aligned BSP Tree

19 A B C D E F G A B C D E FG Polygon-aligned BSP Tree

20 Quickly to identify where you are Quickly to identify where you are BSP = Sorting BSP = Sorting Need a pre-processor to generate the PVS Need a pre-processor to generate the PVS Visibility culling + occlusion culling Visibility culling + occlusion culling PVS : Possible Visible Set PVS : Possible Visible Set Optimized for in-door game environment Optimized for in-door game environment [Fuch80] [Fuch80] Fuchs, H., Fuchs, H., On Visible Surface Generation by a Priori Tree Structures, On Visible Surface Generation by a Priori Tree Structures, Computer Graphics, 14, , (Proc. SIGGRAPH’80) Computer Graphics, 14, , (Proc. SIGGRAPH’80) Why BSP Tree ?

21 Very similar to axis-aligned BSP tree. Very similar to axis-aligned BSP tree. Except that a box is split simultaneously along all three axes. Except that a box is split simultaneously along all three axes. The split point should be the center of the box. The split point should be the center of the box. This creates eight new boxes. This creates eight new boxes. Quadtree is the 2D version of octree. Quadtree is the 2D version of octree. Octree & Quadtree

22 Quadtree - Example

23 Data structure coherence Data structure coherence Apply visibility culling from parents Apply visibility culling from parents Split or not split ? Split or not split ? Outdoor game scene ? Outdoor game scene ? Octree – Some Discussion

24 Culling means “remove from a flock” Culling means “remove from a flock” Visibility culling Visibility culling Remove the object not in view frustum Remove the object not in view frustum A “must” feature within the game engine A “must” feature within the game engine Backface culling Backface culling Remove the polygons facing away from camera Remove the polygons facing away from camera Hardware standard Hardware standard Occlusion culling Occlusion culling Remove the objects hidden by the others Remove the objects hidden by the others A complicated issue for games A complicated issue for games Culling (1/2)

25 eye View frustum Visibilityculling Backfaceculling Occlusionculling Culling (2/2)

26 A Pre-processor A Pre-processor Space partition the scene data from artist Space partition the scene data from artist Generate the BSP data structure Generate the BSP data structure Generate the PVS Generate the PVS BSP walk through BSP walk through Identify the room where you are Identify the room where you are Show/hide the rooms according to the PVS Show/hide the rooms according to the PVS Perform terrain following & collision detection Perform terrain following & collision detection Or all interaction between the player’s character and the scene Or all interaction between the player’s character and the scene BSP Implementation

27 Input Input A scene from artist A scene from artist Cutting planes (optional) Cutting planes (optional) Can be procedurally generated by algorithm Can be procedurally generated by algorithm Cutting policy Cutting policy Split or not split Split or not split Ray casting resolution for PVS Ray casting resolution for PVS Output Output A BSP file A BSP file BSP Tree BSP Tree PVS PVS Geometry Data Geometry Data BSP Preprocessor (1/2)

28 Process Process Generate the BSP tree according to the cutting policy Generate the BSP tree according to the cutting policy Split or sort the geometry into BSP room (leaves) Split or sort the geometry into BSP room (leaves) For each “room”, ray cast all rooms to generate the possible visible room set For each “room”, ray cast all rooms to generate the possible visible room set 2D layers or 3D 2D layers or 3D Time consuming Time consuming BSP Preprocessor (2/2)

29 Effectiveness of PVS Effectiveness of PVS Data set size Data set size The range The range Hard for dynamic scene objects Hard for dynamic scene objects Apply BSP to static scene objects Apply BSP to static scene objects Apply visibility culling and collision detection to dynamic scene objects Apply visibility culling and collision detection to dynamic scene objects Room size Room size BSP Challenges