Game Engine Design Quake Engine Presneted by Holmes 2002/12/2
Component Scene graph Special Effect
Scene graph Mass scene data FPS game focuses on efficient moving vs. RPG game
Scene graph-1 PVS(potentially visible set) Subdivide scene into cells Compute visibility offline Interactive rendering Superset of the polygons visible from any viewpoint in the cell PVS computing a superset of the visible polygon, and Graphics hardware solve hidden-surface for this superset in screen- space
Scene graph-2 Subdivision the scene space along its major opaque feature Found maximal set of sightline(PVS) Cell-to-cell visibility is established is a sightline exists from any point in one cell to any point in another Culled against the view cone of observer Eye-to-cell visibility producing a reliable superset of the visible scene data
Scene graph-3 Assumption ” faces ” are axial line segments in the plane Coordinate data occur on a grid Data structure k-D tree If a k-D tree node is not a leaf, it has split the dimension s such that,a split abscissa a such that,for which the extends are
Scene graph-4 Each input face F is classified Disjoint No intersection with cell Spanning Partitions the cell interior into components that intersect only on their boundaries Covering Lies on the cell boundary and intersects the boundary ’ s relative interior Incident
Scene graph-5
Scene graph-6 Recursively subdivide the root node with procedure If the k-D cell has no incident faces(its interior is empty), do nothing If any spanning faces exist,split on the median spanning pace Otherwise,split on a sufficiently obscured minimum cleaving abscissa “ sufficiently obscured ” means that the length of the faces as this abscissa sum to more than some threshold
Scene graph-7 After subdivision terminates, the portals are enumerated and sorted with each leaf cell Constructing an adjacency graph over the subdivision leaf cell
Scene graph-8 Determining exist of sightline between cells Portal sequence If there exists a line that stabs every portal of the sequence Portal sequence from A [A/B,B/C,C/D] [A/C,C/B,B/D] [A/B,B/D] [A/C,C/D]
Scene graph-9 Generating portal sequence DFS(depth-first-search) with adjacency graph Finding sightlines Places the portal endpoints in a set L or R according to the portal ’ s oriented A sightline can stab this portal sequence if and only if there exists a line S such that
Scene graph-10 Algorithm
Scene graph-11
Scene graph-12 After recursive of Find_Visible_Cells(),we construct the stab tree Each node or vertex of the stab tree corresponds to a cell visible from the source cell
Scene graph-13 Define O the cell containing the observer C the view cone S the stab tree rooted at O V the set of cells visible from O
Scene graph-14 Disjoint cell Remove from V those cells that disjoint from C O(|V|) Connected component Employs a depth-first-search from O in S Constraint every cell traversed must intersect the interior with C Incident portals Searching only through cells reachable via portals that intersect C ’ s interior Exact eye-to-cell Portal sequence to that cell must admit a sightline that lies inside C and contains the view position
Scene graph-15
Special Effect Light Mapping
Light mapping-1 Light map this value will be pre- calculated for that normal and it will simply have to be fetched from the map The aim of light mapping is too decrease the overhead associated with lightning calculations
Light mapping-2 You can see that a sphere has a face looking in almost every direction.
Light mapping-3 This means that the faces of the sphere also have normals pointing in almost every direction as shown in the picture below. The little yellow lines are normals to corresponding polygons
Light mapping-4 The idea behind light mapping is to generate a 'light map' which will contain the precalculated light values for normal vectors found on a fairly fine grained sphere. The idea I have now is to let the light map be a three dimentional array [x][y][z] where the light values at each element are generated for normal vectors found on a sphere.
Light mapping-5 Aim: Speed up lighting calculations by pre-computing lighting and storing it in maps Allows complex illumination models to be used in generating the map (eg shadows, radiosity) Used in complex rendering algorithms to catch radiance (Radiance)
Light mapping-6
Light mapping-7