Download presentation
Presentation is loading. Please wait.
Published byRolf Hawkins Modified over 9 years ago
1
1 Advanced Scene Management System
2
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
3 Etc Parameters Geometric Data Shape TransformationMove Parent Object Hierarchy Motion Data Animation Clone An Object in the Scene (An Example from TheFly)
4
4 A tree-based representation A simplified scene graph Root A Scene Tree (An Example) 1/2
5
5 A tree-based representation A simplified scene graph A Scene Tree (An Example) 2/2 Root
6
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
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
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
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
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
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
12 Bounding spheres or AABB in hierarchy Can be used for dynamic scene objects R B Bounding Volume Hierarchies (BVHs)
13
13 LBVH Linear BVH Tree construction using Morton Code BVH Construction - LBVH
14
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 -0-0-1 : 1 in binary 1-0-1- : 5 in binary xyxyxy 100011 : 35 Your interleaved Morton number
15
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
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
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
18 plane1 plane0 plane2 plane3 0 1 2 3 Axis-aligned BSP Tree
19
19 A B C D E F G A B C D E FG Polygon-aligned BSP Tree
20
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, 124-33, (Proc. SIGGRAPH’80) Computer Graphics, 14, 124-33, (Proc. SIGGRAPH’80) Why BSP Tree ?
21
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
22 Quadtree - Example
23
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
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
25 eye View frustum Visibilityculling Backfaceculling Occlusionculling Culling (2/2)
26
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
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
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
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
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.