Real-Time Rendering SPEEDING UP RENDERING Lecture 04 Marina Gavrilova.

25
Real-Time Rendering SPEEDING UP RENDERING Lecture 04 Marina Gavrilova

Transcript of Real-Time Rendering SPEEDING UP RENDERING Lecture 04 Marina Gavrilova.

Page 1: Real-Time Rendering SPEEDING UP RENDERING Lecture 04 Marina Gavrilova.

Real-Time Rendering

SPEEDING UP RENDERING

Lecture 04Marina Gavrilova

Page 2: 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

Page 3: Real-Time Rendering SPEEDING UP RENDERING Lecture 04 Marina Gavrilova.

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

Page 4: Real-Time Rendering SPEEDING UP RENDERING Lecture 04 Marina Gavrilova.

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

Page 5: Real-Time Rendering SPEEDING UP RENDERING Lecture 04 Marina Gavrilova.

Rendering Scene with Hierarchical BV Child is explored for visibility only if

parent is completely or partially visible

Page 6: Real-Time Rendering SPEEDING UP RENDERING Lecture 04 Marina Gavrilova.

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

Page 7: Real-Time Rendering SPEEDING UP RENDERING Lecture 04 Marina Gavrilova.

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

Page 8: Real-Time Rendering SPEEDING UP RENDERING Lecture 04 Marina Gavrilova.

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

Page 9: Real-Time Rendering SPEEDING UP RENDERING Lecture 04 Marina Gavrilova.

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

Page 10: Real-Time Rendering SPEEDING UP RENDERING Lecture 04 Marina Gavrilova.

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

Page 11: Real-Time Rendering SPEEDING UP RENDERING Lecture 04 Marina Gavrilova.

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:

Page 12: Real-Time Rendering SPEEDING UP RENDERING Lecture 04 Marina Gavrilova.

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)

Page 13: Real-Time Rendering SPEEDING UP RENDERING Lecture 04 Marina Gavrilova.

HV algorithm To maintain z-pyramid

recurse the furthest value Upto 100 times less depth

test than standard z-buffer

Page 14: Real-Time Rendering SPEEDING UP RENDERING Lecture 04 Marina Gavrilova.

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)

Page 15: Real-Time Rendering SPEEDING UP RENDERING Lecture 04 Marina Gavrilova.

The Hierarchical Occlusion Map (HOM) algorithm Another efficient

algorithm Occlusion is tested using

two mechanism: Depth Test Overlap Test

Identify potentially good occluders (preprocessing)

Page 16: Real-Time Rendering SPEEDING UP RENDERING Lecture 04 Marina Gavrilova.

The HOM Algorithm Occlusion map

64 x 64 32 x 32 16 x 16

Page 17: Real-Time Rendering SPEEDING UP RENDERING Lecture 04 Marina Gavrilova.

The HOM algorithm Hierarchy can be

generated by hardware texture MIP maps

Test of occlusion is based on a threshold opacity

Page 18: Real-Time Rendering SPEEDING UP RENDERING Lecture 04 Marina Gavrilova.

Shadow Culling Find small number of large

occluders Make use of separating planes and

supporting planes

Page 19: Real-Time Rendering SPEEDING UP RENDERING Lecture 04 Marina Gavrilova.

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)

Page 20: Real-Time Rendering SPEEDING UP RENDERING Lecture 04 Marina Gavrilova.

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 )

Page 21: Real-Time Rendering SPEEDING UP RENDERING Lecture 04 Marina Gavrilova.

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

Page 22: Real-Time Rendering SPEEDING UP RENDERING Lecture 04 Marina Gavrilova.

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

Page 23: Real-Time Rendering SPEEDING UP RENDERING Lecture 04 Marina Gavrilova.

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

Page 24: Real-Time Rendering SPEEDING UP RENDERING Lecture 04 Marina Gavrilova.

Triangle Stripping Define triangles of

an objects as continuous strip

Improves rendering performance

SGI algorithm (greedy)

Stripe algorithm

Page 25: Real-Time Rendering SPEEDING UP RENDERING Lecture 04 Marina Gavrilova.

End of Lecture 04

Questions?