Korea Univ. Graphics Lab. 3D Game Engine Design Chapter 12. Spatial Sorting Chung Ji Hye 2001. 12. 04.

Slides:



Advertisements
Similar presentations
Computer Graphics - Rasterization -
Advertisements

Visible-Surface Detection(identification)
Collisions and Intersections When objects move, test for collision. When projecting surfaces, check for intersections. (Many slides adapted from Amitabh.

CS 352: Computer Graphics Chapter 7: The Rendering Pipeline.
03/12/02 (c) 2002 University of Wisconsin, CS559 Last Time Some Visibility (Hidden Surface Removal) algorithms –Painter’s Draw in some order Things drawn.
David Luebke5/11/2015 CS 551 / 645: Introductory Computer Graphics David Luebke
Hidden Surface Removal CSE 581. Visibility Assumption: All polygons are opaque What polygons are visible with respect to your view frustum?  Outside:
CAP4730: Computational Structures in Computer Graphics Visible Surface Determination.
CECS461 Computer Graphics II University of Missouri at Columbia Hidden Surface Removal.
CHAPTER 12 Height Maps, Hidden Surface Removal, Clipping and Level of Detail Algorithms © 2008 Cengage Learning EMEA.
Visibility in Computer Graphics Toni Sellarès Unversitat de Girona
Computer Graphics Visible Surface Determination. Goal of Visible Surface Determination To draw only the surfaces (triangles) that are visible, given a.
CSE 381 – Advanced Game Programming Scene Management
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2007 Tamara Munzner Clipping II, Hidden Surfaces.
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.
Vertices and Fragments I CS4395: Computer Graphics 1 Mohan Sridharan Based on slides created by Edward Angel.
Introduction General Data Structures - Arrays, Linked Lists - Stacks & Queues - Hash Tables & Binary Search Trees - Graphs Spatial Data Structures -Why.
A lion in the desert How do you find a lion in the desert? How about when you have a predicate that tells you if the lion is in front or behind a separating.
Hidden Surface Elimination Wen-Chieh (Steve) Lin Institute of Multimedia Engineering I-Chen Lin’ CG Slides, Rich Riesenfeld’s CG Slides, Shirley, Fundamentals.
1 CSCE 441: Computer Graphics Hidden Surface Removal (Cont.) Jinxiang Chai.
1 Clipping and Hidden Surfaces CS-184: Computer Graphics Prof. James O’Brien.
A lion in the desert How do you find a lion in the desert? How about when you have a predicate that tells you if the lion is in front or behind a separating.
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.
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.
Hidden Surface Removal
10/29/02 (c) 2002 University of Wisconsin, CS559 Today Hidden Surface Removal Exact Visibility.
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.
Graphics Graphics Korea University cgvr.korea.ac.kr Solid Modeling 고려대학교 컴퓨터 그래픽스 연구실.
Computer Graphics 2 Lecture 8: Visibility Benjamin Mora 1 University of Wales Swansea Pr. Min Chen Dr. Benjamin Mora.
The BSP-tree from Prof. Seth MIT.. Motivation for BSP Trees: The Visibility Problem We have a set of objects (either 2d or 3d) in space. We have.
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”
Using BSP for CD Ref: BSP in deBerg et al ’ s book (url)url.
Hidden Surface Removal 1.  Suppose that we have the polyhedron which has 3 totally visible surfaces, 4 totally invisible/hidden surfaces, and 1 partially.
2 COEN Computer Graphics I Evening’s Goals n Discuss application bottleneck determination n Discuss various optimizations for making programs execute.
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.
CSCE 552 Spring D Models By Jijun Tang. Triangles Fundamental primitive of pipelines  Everything else constructed from them  (except lines and.
Where We Stand At this point we know how to: –Convert points from local to window coordinates –Clip polygons and lines to the view volume –Determine which.
Computer Graphics I, Fall 2010 Implementation II.
Maths & Technologies for Games Spatial Partitioning 1 CO3303 Week 8-9.
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.
Computer Graphics Inf4/MSc 1 Computer Graphics Lecture 5 Hidden Surface Removal and Rasterization Taku Komura.
1 Computer Graphics Week11 : Hidden Surface Removal.
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 Implementation II
Solid Area Scan Conversion or Visible Surface Detection
Hidden Surface Removal
© University of Wisconsin, CS559 Fall 2004
Hidden Surfaces Dr. Scott Schaefer.
CSCE 441: Computer Graphics Hidden Surface Removal
Implementation II Ed Angel Professor Emeritus of Computer Science
Visibility (hidden surface removal)
Hidden Surface Removal
CS679 - Fall Copyright Univ. of Wisconsin
Introduction to Computer Graphics with WebGL
Implementation II Ed Angel Professor Emeritus of Computer Science
Presentation transcript:

Korea Univ. Graphics Lab. 3D Game Engine Design Chapter 12. Spatial Sorting Chung Ji Hye

Graphics Laboratory Korea University -2- Chung ji hye Overview Why do you use Sorting? Correct drawing of a scene To avoid drawing a pixel on the screen multiple times Type of sorting Quadtrees and Octrees Use of portals BSP trees

Graphics Laboratory Korea University -3- Chung ji hye Quadtrees & Octrees Construction of a scene graph can be based on planar locations : Quadtrees Spatial locations : Octrees Quadtrees & Octrees Attempt to setup visibility graph based on structure of the world and the objects Partition the world into cell

Graphics Laboratory Korea University -4- Chung ji hye Quadtrees & Octrees cameraBlock = GetBlockOf(renderer.camera); visibleList = GetVisibleCellsFrom(cameraBlock); for(each node in visibleList) renderer.Draw(node);

Graphics Laboratory Korea University -5- Chung ji hye Portals Portal systems Requires less interaction to setup visibility graph Specify additional planes that trim down the view frustum into smaller pieces Doorway is a portal Allows you to see inside the contents Objects hidden by the walls can be culling Partially hidden by the walls can be clipping Useful for indoor style game Many walls and other objects obstruct the view

Graphics Laboratory Korea University -6- Chung ji hye Portals Illustration of visibility through a portal

Graphics Laboratory Korea University -7- Chung ji hye Portals Culling mechanism Keep track of a flag of six bits Each bit indicating whether or not the object is culled Flag can be extended to have any number of bits Camera can store additional planes for culling purposes Partition into convex regions Rendering algorithm Back to front order

Graphics Laboratory Korea University -8- Chung ji hye Binary Space Partitioning Data structure used to represent the partitioning Object is on the positive side associated with the front child of the node Object is on the negative side associated with the back child of the node Sorting polygon by way of a depth first traversal of the tree

Graphics Laboratory Korea University -9- Chung ji hye BSP Tree P0P0 P0P0 P2P2 P1P1 P1P1 P2P2 c0c0 c3c3 c4c4 P3P3 C0C0 P3P3 C3C3 C4C4 c1c1 c2c2 C1C1 C2C

Graphics Laboratory Korea University -10- Chung ji hye Hidden Surface Removal Back to Front Drawing Background first and foreground last Positive side of the plane Dot products used to determine the object is in the cone of the view frustum Partition plane Intersects the view frustum

Graphics Laboratory Korea University -11- Chung ji hye Hidden Surface Removal Front to Back Drawing Draw the polygons closet to the eye point Pixel don ’ t be overwritten Only use when it is known what order the polygons are

Graphics Laboratory Korea University -12- Chung ji hye Scan Line Masks Scan Line Method Keep track of each scan line separately Interval [x 0, x 1 ) Left end point is included, right end point is not included

Graphics Laboratory Korea University -13- Chung ji hye Scan Line Masks Screen width is W pixel [0,W) Triangle is rasterized on that scan line in the interval [x 0, x 1 ) Value X 0 causes split [0,x 0 ), [ x 0,w) [0,w) [0, x 0 )[ x 0,w) x0x0 x1x1 [ x 1,w) [x0,x1)[x0,x1)

Graphics Laboratory Korea University -14- Chung ji hye Scan Line Masks New initial interval [x 2, x 3 ) Supposed that 0<= x 0 <x 2 <x 1 <x 3 <= w Comparing x 2 against x 1 Left child is interval of drawn pixel no splitting occur Comparing x 3 against leaf node [ x 1,w) Undrawn pixel Splitting occur [x 1, x 3 ) and [x 1, w)

Graphics Laboratory Korea University -15- Chung ji hye Scan Line Masks Representing BSP Tree [0,w) [0,x 0 )[x 0,w) x0x0 x1x1 [x 1,w) [x 0,x 1 ) x2x2 x3x3 [x 1,x 3 )[x 3,w)

Graphics Laboratory Korea University -16- Chung ji hye Visibility Determination Deciding what part of the world are visible from that location Knowing what is visible helps to minimize the data is sent to the renderer Can be used for occlusion culling View space method Visibility tree Screen space method World tree

Graphics Laboratory Korea University -17- Chung ji hye View Space Method Three dimension Represents the view frustum Compares objects and parts of objects to each other

Graphics Laboratory Korea University -18- Chung ji hye Screen Space Method Two Dimension Initially represents the rectangle corresponding to the drawable pixels on the screen World tree sorts the polygons from Front to back Visible subpolygon obtained in the clipping Subpolygons can be stored in a list Whatever purposes the application requires

Graphics Laboratory Korea University -19- Chung ji hye Quadtrees & Octrees