250 likes | 451 Views
Real-Time Rendering. SPEEDING UP RENDERING Lecture 04 Marina Gavrilova. Brief Outline. Culling Hierarchical z-buffering Hierarchical Occlusion Map (HOM) Impostors and Nailboards Hierarchical image caching Level of Detail (LOD) Triangle Stripping. Culling.
E N D
Real-Time Rendering SPEEDING UP RENDERING Lecture 04 Marina Gavrilova
Brief Outline • Culling • Hierarchical z-buffering • Hierarchical Occlusion Map (HOM) • Impostors and Nailboards • Hierarchical image caching • Level of Detail (LOD) • Triangle Stripping
Culling • To cut-off non-visible objects at an early stage of the rendering pipeline • Backface culling: Most frequently used culling • Dot product of surface normal and view vector • Clustered Culling: Determine using 1 test whether a group of polygon is visible or not
Hierarchical View Frustum Culling • Bounding Volume (BV): Volume that encloses a group of objects • Compute BV Hierarchy and store as Directed Acyclic Graph (DAG) or tree • Leaf holds actual geometry, parent BV contains several child BV • Most common BV: Sphere, Axis Aligned Bounding Box (AABB), Oriented Bounding Box (OBB) Hierarchy of BV is often called a Scene Graph
Rendering Scene with Hierarchical BV • Child is explored for visibility only if parent is completely or partially visible
BSP trees for static scene • Excellent for static scene • Takes a long time to compute • Efficient culling test • AABB based BSP: • Take one plane of the box • Divide objects into two sets • Subsequent division • Polygon Aligned BSP: • Choose one polygon as divider • Use the chosen polygons plane to divide into two partition • Recursively divide the rest
Rendering scene using BSP • Polygon aligned BSP trees can be traversed to find back to front order of objects • Render back to front: no z-buffer needed • Render front to back: no need to redraw pixels • Pixel span: span of pixels in a row. • No need to draw pixel spans • BSP is also known as k-d trees in computational geometry
Portal culling • Used in architectural design • Used in Computer games inside buildings with doors • Occluders are large walls • Compute Potentially visible set (PVS) from one point of view • Divide the entire scene into cells (i.e. room) • Doors and windows are called portals • Method 1: impose a BSP on cells (align the partitioning planes with the walls) • Method 2: Subdivide cells and identify portals and construct a cell-to-cell visibility data structure • Dramatic Speedup (up to 100 times) when scene is very complex with many walls
Portal Culling (cont’d) • It is a refinement process (diminishing view frustum) • Reflection can be seen as another portal (with associated PVS) • Used in Nintendo 64
Detail Culling • Object to Screen Pixel Ratio: The area of the projected BV of an object (in number of pixels) • Omit objects who’s Screen pixel ratio is too small • Replace object with simpler model when screen pixel ratio is low
Occlusion Culling • Z-buffer is not sufficient for densely packed objects (i.e. a forest) • Occlusion culling saves rendering time by preventing occluded objects from being rendered • General algorithm:
Hierarchical Z-buffering • Hierarchical Visibility Algorithm (HV) • Maintain scene model in an Octree • Maintain a z-pyramid for occlusion test • Recursively subdivide scene into octree boxes (until each leaf contains<k primitives) • In 2D Quadtree representation • Takes too much time to be generated in runtime (only suitable for static scene)
HV algorithm • To maintain z-pyramid recurse the furthest value • Upto 100 times less depth test than standard z-buffer
Other HV based techniques • Hierarchical polygon tiling Very Efficient • Without hardware implementation HV is too slow for real-time graphics • Take advantage of frame-to-frame coherence • Rendering antialiased scenes hierarchically without error bounds (Greene and Kass) • Visibility skeleton method (Durand)
The Hierarchical Occlusion Map (HOM) algorithm • Another efficient algorithm • Occlusion is tested using two mechanism: • Depth Test • Overlap Test • Identify potentially good occluders (preprocessing)
64 x 64 16 x 16 32 x 32 The HOM Algorithm • Occlusion map
The HOM algorithm • Hierarchy can be generated by hardware texture MIP maps • Test of occlusion is based on a threshold opacity
Shadow Culling • Find small number of large occluders • Make use of separating planes and supporting planes
Impostors • Impostor: image of a complex object that is texture mapped onto a rectangle • Renders faster than the object • Exploits frame-to-frame coherence • Objects rendered to a texture from a particular viewpoint • Rendered object is reused until the view point changes significantly • Great for particle systems and complex objects • Similar to billboards (dynamic/adaptive billboard)
Nailboards • Nailboard: an Imposter frame with an attached z-buffer (RGB, =z WRT impostor quad) • Avoids visibility problems of impostors Real Object Impostors (without ) Nailboard (2 bit ) Nailboard (8 bit )
Level Of Detail (LOD) • Simpler objects as the object moves further away from the camera • LOD is often equals to # of triangles • A more general measure for error metric is screen pixel ratio • Problem: When LOD changes popping effects occur
Correcting LOD popping effect • Alpha LOD: increase transparency of object as distance increases • Object fades away • More continuous • Object becomes invisible • Geomorph LOD • Use different geometry and perform smooth geometric interpolation between LOD • Smooth continuous transition of LOD • Hard to implement
LOD management • Define an error metric for the object LOD • Optimally refine object to improve accuracy • Restrict refinement operations to a constant amount per frame
Triangle Stripping • Define triangles of an objects as continuous strip • Improves rendering performance • SGI algorithm (greedy) • Stripe algorithm
End of Lecture 04 Questions?