The Rendering Pipeline CS 445/645 Introduction to Computer Graphics David Luebke, Spring 2003.
CS 445 / 645 Introduction to Computer Graphics
-
Upload
carlos-jimenez -
Category
Documents
-
view
39 -
download
5
description
Transcript of CS 445 / 645 Introduction to Computer Graphics
CS 445 / 645Introduction to Computer Graphics
Lecture 21Lecture 21
VisibilityVisibility
Lecture 21Lecture 21
VisibilityVisibility
Recap: Rendering Pipeline
• Modeling transformationsModeling transformations
• Viewing transformationsViewing transformations
• Projection transformationsProjection transformations
• ClippingClipping
• Scan conversionScan conversion
We now know everything about how to draw a We now know everything about how to draw a polygon on the screen, except polygon on the screen, except visible surface visible surface determinationdetermination
• Modeling transformationsModeling transformations
• Viewing transformationsViewing transformations
• Projection transformationsProjection transformations
• ClippingClipping
• Scan conversionScan conversion
We now know everything about how to draw a We now know everything about how to draw a polygon on the screen, except polygon on the screen, except visible surface visible surface determinationdetermination
Invisible Primitives
Why might a polygon be invisible?Why might a polygon be invisible?
• Polygon outside the Polygon outside the field of viewfield of view
• Polygon is Polygon is backfacingbackfacing
• Polygon is Polygon is occludedoccluded by object(s) nearer the viewpointby object(s) nearer the viewpoint
For efficiency reasons, we want to avoid spending work For efficiency reasons, we want to avoid spending work on polygons outside field of view or backfacingon polygons outside field of view or backfacing
For efficiency and correctness reasons, we need to know For efficiency and correctness reasons, we need to know when polygons are occludedwhen polygons are occluded
Why might a polygon be invisible?Why might a polygon be invisible?
• Polygon outside the Polygon outside the field of viewfield of view
• Polygon is Polygon is backfacingbackfacing
• Polygon is Polygon is occludedoccluded by object(s) nearer the viewpointby object(s) nearer the viewpoint
For efficiency reasons, we want to avoid spending work For efficiency reasons, we want to avoid spending work on polygons outside field of view or backfacingon polygons outside field of view or backfacing
For efficiency and correctness reasons, we need to know For efficiency and correctness reasons, we need to know when polygons are occludedwhen polygons are occluded
View Frustum Clipping
Remove polygons entirely outside frustumRemove polygons entirely outside frustum
• Note that this includes polygons “behind” eye (actually Note that this includes polygons “behind” eye (actually behind near plane)behind near plane)
Pass through polygons Pass through polygons entirely inside frustumentirely inside frustum
Modify remaining polygonsModify remaining polygonsto include only portions to include only portions intersecting view frustumintersecting view frustum
Remove polygons entirely outside frustumRemove polygons entirely outside frustum
• Note that this includes polygons “behind” eye (actually Note that this includes polygons “behind” eye (actually behind near plane)behind near plane)
Pass through polygons Pass through polygons entirely inside frustumentirely inside frustum
Modify remaining polygonsModify remaining polygonsto include only portions to include only portions intersecting view frustumintersecting view frustum
Back-Face CullingMost objects in scene are typically “solid”Most objects in scene are typically “solid”
More rigorously: More rigorously: closed, orientable manifoldsclosed, orientable manifolds• Must not cut through itselfMust not cut through itself
• Must have two distinct sidesMust have two distinct sides
– A sphere is orientable since it has A sphere is orientable since it has two sides, 'inside' and 'outside'.two sides, 'inside' and 'outside'.
– A Mobius strip or a Klein bottle is not A Mobius strip or a Klein bottle is not orientable orientable
• Cannot “walk” from one side to the otherCannot “walk” from one side to the other
– A sphere is a closed manifold A sphere is a closed manifold whereas a plane is not whereas a plane is not
Most objects in scene are typically “solid”Most objects in scene are typically “solid”
More rigorously: More rigorously: closed, orientable manifoldsclosed, orientable manifolds• Must not cut through itselfMust not cut through itself
• Must have two distinct sidesMust have two distinct sides
– A sphere is orientable since it has A sphere is orientable since it has two sides, 'inside' and 'outside'.two sides, 'inside' and 'outside'.
– A Mobius strip or a Klein bottle is not A Mobius strip or a Klein bottle is not orientable orientable
• Cannot “walk” from one side to the otherCannot “walk” from one side to the other
– A sphere is a closed manifold A sphere is a closed manifold whereas a plane is not whereas a plane is not
www.kleinbottle.comwww.kleinbottle.com
Back-Face Culling
Most objects in scene are typically “solid”Most objects in scene are typically “solid”
More rigorously: More rigorously: closed, orientable manifoldsclosed, orientable manifolds
• Local neighborhood of all points isomorphic to discLocal neighborhood of all points isomorphic to disc
• Boundary partitions space into interior & exteriorBoundary partitions space into interior & exterior
Most objects in scene are typically “solid”Most objects in scene are typically “solid”
More rigorously: More rigorously: closed, orientable manifoldsclosed, orientable manifolds
• Local neighborhood of all points isomorphic to discLocal neighborhood of all points isomorphic to disc
• Boundary partitions space into interior & exteriorBoundary partitions space into interior & exterior
Yes No
Manifold
Examples of Examples of manifoldmanifold objects: objects:
• SphereSphere
• TorusTorus
• Well-formedWell-formedCAD partCAD part
Examples of Examples of manifoldmanifold objects: objects:
• SphereSphere
• TorusTorus
• Well-formedWell-formedCAD partCAD part
Back-Face Culling
Examples of non-manifold objects:Examples of non-manifold objects:
• A single polygonA single polygon
• A terrain or height fieldA terrain or height field
• polyhedron w/ missing facepolyhedron w/ missing face
• Anything with cracks or holes in boundaryAnything with cracks or holes in boundary
• one-polygon thick lampshadeone-polygon thick lampshade
Examples of non-manifold objects:Examples of non-manifold objects:
• A single polygonA single polygon
• A terrain or height fieldA terrain or height field
• polyhedron w/ missing facepolyhedron w/ missing face
• Anything with cracks or holes in boundaryAnything with cracks or holes in boundary
• one-polygon thick lampshadeone-polygon thick lampshade
Back-Face Culling
On the surface of a closed manifold, polygons On the surface of a closed manifold, polygons whose normals point away from the camera are whose normals point away from the camera are always occluded:always occluded:
On the surface of a closed manifold, polygons On the surface of a closed manifold, polygons whose normals point away from the camera are whose normals point away from the camera are always occluded:always occluded:
Note: backface cullingalone doesn’t solve the
hidden-surface problem!
Back-Face Culling
Not rendering backfacing polygons improves Not rendering backfacing polygons improves performanceperformance
• By how much?By how much?
– Reduces by about half the number of polygons to be Reduces by about half the number of polygons to be considered for each pixelconsidered for each pixel
Every front-facing polygon must have a corresponding Every front-facing polygon must have a corresponding rear-facing onerear-facing one
Not rendering backfacing polygons improves Not rendering backfacing polygons improves performanceperformance
• By how much?By how much?
– Reduces by about half the number of polygons to be Reduces by about half the number of polygons to be considered for each pixelconsidered for each pixel
Every front-facing polygon must have a corresponding Every front-facing polygon must have a corresponding rear-facing onerear-facing one
Occlusion
For most interesting scenes, some polygons will overlap:For most interesting scenes, some polygons will overlap:
To render the correct image, we need to determine which To render the correct image, we need to determine which polygons polygons occlude occlude whichwhich
For most interesting scenes, some polygons will overlap:For most interesting scenes, some polygons will overlap:
To render the correct image, we need to determine which To render the correct image, we need to determine which polygons polygons occlude occlude whichwhich
Painter’s Algorithm
Simple approach: render the polygons from back to front, Simple approach: render the polygons from back to front, “painting over” previous polygons:“painting over” previous polygons:
• Draw blue, then green, then orangeDraw blue, then green, then orange
Will this work in the general case?Will this work in the general case?
Simple approach: render the polygons from back to front, Simple approach: render the polygons from back to front, “painting over” previous polygons:“painting over” previous polygons:
• Draw blue, then green, then orangeDraw blue, then green, then orange
Will this work in the general case?Will this work in the general case?
Painter’s Algorithm: Problems
Intersecting polygonsIntersecting polygons present a problem present a problem
Even non-intersecting polygons can form a cycle Even non-intersecting polygons can form a cycle with no valid visibility order:with no valid visibility order:
Intersecting polygonsIntersecting polygons present a problem present a problem
Even non-intersecting polygons can form a cycle Even non-intersecting polygons can form a cycle with no valid visibility order:with no valid visibility order:
Analytic Visibility Algorithms
Early visibility algorithms computed the set of visible Early visibility algorithms computed the set of visible polygon polygon fragmentsfragments directly, then rendered the directly, then rendered the fragments to a display:fragments to a display:
Early visibility algorithms computed the set of visible Early visibility algorithms computed the set of visible polygon polygon fragmentsfragments directly, then rendered the directly, then rendered the fragments to a display:fragments to a display:
Analytic Visibility Algorithms
What is the minimum worst-case cost of What is the minimum worst-case cost of computing the fragments for a scene composed computing the fragments for a scene composed of of nn polygons? polygons?
Answer: Answer: O(O(nn22))
What’s your opinionWhat’s your opinion
of O(nof O(n22)?)?
What is the minimum worst-case cost of What is the minimum worst-case cost of computing the fragments for a scene composed computing the fragments for a scene composed of of nn polygons? polygons?
Answer: Answer: O(O(nn22))
What’s your opinionWhat’s your opinion
of O(nof O(n22)?)?
Analytic Visibility Algorithms
So, for about a decade (late 60s to late 70s) there So, for about a decade (late 60s to late 70s) there was intense interest in finding efficient was intense interest in finding efficient algorithms for algorithms for hidden surface removalhidden surface removal
We’ll talk about two: We’ll talk about two:
• Binary Space-Partition (BSP) TreesBinary Space-Partition (BSP) Trees
• Warnock’s AlgorithmWarnock’s Algorithm
So, for about a decade (late 60s to late 70s) there So, for about a decade (late 60s to late 70s) there was intense interest in finding efficient was intense interest in finding efficient algorithms for algorithms for hidden surface removalhidden surface removal
We’ll talk about two: We’ll talk about two:
• Binary Space-Partition (BSP) TreesBinary Space-Partition (BSP) Trees
• Warnock’s AlgorithmWarnock’s Algorithm
Binary Space Partition Trees (1979)
BSP tree: organize all of space (hence BSP tree: organize all of space (hence partitionpartition)) into a binary treeinto a binary tree
• PreprocessPreprocess: overlay a binary tree on objects in the scene: overlay a binary tree on objects in the scene
• RuntimeRuntime: correctly traversing this tree enumerates objects : correctly traversing this tree enumerates objects from back to frontfrom back to front
• Idea: divide space recursively into half-spaces by choosing Idea: divide space recursively into half-spaces by choosing splitting planessplitting planes
– Splitting planes can be arbitrarily orientedSplitting planes can be arbitrarily oriented
BSP tree: organize all of space (hence BSP tree: organize all of space (hence partitionpartition)) into a binary treeinto a binary tree
• PreprocessPreprocess: overlay a binary tree on objects in the scene: overlay a binary tree on objects in the scene
• RuntimeRuntime: correctly traversing this tree enumerates objects : correctly traversing this tree enumerates objects from back to frontfrom back to front
• Idea: divide space recursively into half-spaces by choosing Idea: divide space recursively into half-spaces by choosing splitting planessplitting planes
– Splitting planes can be arbitrarily orientedSplitting planes can be arbitrarily oriented
BSP Trees: Objects
BSP Trees: Objects
BSP Trees: Objects
BSP Trees: Objects
BSP Trees: Objects
Rendering BSP TreesrenderBSP(BSPtree *T)renderBSP(BSPtree *T)
BSPtree *near, *far;BSPtree *near, *far;
if (if (eye on left side of T->planeeye on left side of T->plane))
near = T->left; far = T->right;near = T->left; far = T->right;
else else
near = T->right; far = T->left;near = T->right; far = T->left;
renderBSP(far);renderBSP(far);
if (if (T is a leaf nodeT is a leaf node))
renderObject(T)renderObject(T)
renderBSP(near);renderBSP(near);
renderBSP(BSPtree *T)renderBSP(BSPtree *T)
BSPtree *near, *far;BSPtree *near, *far;
if (if (eye on left side of T->planeeye on left side of T->plane))
near = T->left; far = T->right;near = T->left; far = T->right;
else else
near = T->right; far = T->left;near = T->right; far = T->left;
renderBSP(far);renderBSP(far);
if (if (T is a leaf nodeT is a leaf node))
renderObject(T)renderObject(T)
renderBSP(near);renderBSP(near);
Rendering BSP Trees
Rendering BSP Trees
Polygons: BSP Tree Construction
Split along the plane defined by any polygon from Split along the plane defined by any polygon from scenescene
Classify all polygons into positive or negative Classify all polygons into positive or negative half-space of the planehalf-space of the plane• If a polygon intersects plane, split polygon into two and If a polygon intersects plane, split polygon into two and
classify them bothclassify them both
Recurse down the negative half-spaceRecurse down the negative half-space
Recurse down the positive half-spaceRecurse down the positive half-space
Split along the plane defined by any polygon from Split along the plane defined by any polygon from scenescene
Classify all polygons into positive or negative Classify all polygons into positive or negative half-space of the planehalf-space of the plane• If a polygon intersects plane, split polygon into two and If a polygon intersects plane, split polygon into two and
classify them bothclassify them both
Recurse down the negative half-spaceRecurse down the negative half-space
Recurse down the positive half-spaceRecurse down the positive half-space
No bunnies were harmed in my exampleNo bunnies were harmed in my example
But what if a splitting plane passes through an But what if a splitting plane passes through an object?object?• Split the object; give half to each nodeSplit the object; give half to each node
No bunnies were harmed in my exampleNo bunnies were harmed in my example
But what if a splitting plane passes through an But what if a splitting plane passes through an object?object?• Split the object; give half to each nodeSplit the object; give half to each node
Discussion: BSP Tree Cons
Ouch
BSP Demo
Nice demo:Nice demo:
http://http://symbolcraft.com/graphics/bspsymbolcraft.com/graphics/bsp
Summary: BSP TreesPros:Pros:
• Simple, elegant schemeSimple, elegant scheme
• Only writes to framebuffer (no reads to see if current polygon is Only writes to framebuffer (no reads to see if current polygon is in front of previously rendered polygon, i.e., painters algorithm)in front of previously rendered polygon, i.e., painters algorithm)
– Thus very popular for video games (but getting less so)Thus very popular for video games (but getting less so)
Cons:Cons:• Computationally intense preprocess stage restricts algorithm to Computationally intense preprocess stage restricts algorithm to
static scenesstatic scenes
• Slow time to construct treeSlow time to construct tree
• Splitting increases polygon countSplitting increases polygon count
Pros:Pros:• Simple, elegant schemeSimple, elegant scheme
• Only writes to framebuffer (no reads to see if current polygon is Only writes to framebuffer (no reads to see if current polygon is in front of previously rendered polygon, i.e., painters algorithm)in front of previously rendered polygon, i.e., painters algorithm)
– Thus very popular for video games (but getting less so)Thus very popular for video games (but getting less so)
Cons:Cons:• Computationally intense preprocess stage restricts algorithm to Computationally intense preprocess stage restricts algorithm to
static scenesstatic scenes
• Slow time to construct treeSlow time to construct tree
• Splitting increases polygon countSplitting increases polygon count
Octrees
Frequently used in modern video gamesFrequently used in modern video games
• A BSP tree subdivides space into a series of half-spaces A BSP tree subdivides space into a series of half-spaces using single planesusing single planes
• An octree subdivides space into eightAn octree subdivides space into eightvoxels using three axis-aligned planesvoxels using three axis-aligned planes
– A voxel is labeled as havingA voxel is labeled as havingpolygons inside it or notpolygons inside it or not
Frequently used in modern video gamesFrequently used in modern video games
• A BSP tree subdivides space into a series of half-spaces A BSP tree subdivides space into a series of half-spaces using single planesusing single planes
• An octree subdivides space into eightAn octree subdivides space into eightvoxels using three axis-aligned planesvoxels using three axis-aligned planes
– A voxel is labeled as havingA voxel is labeled as havingpolygons inside it or notpolygons inside it or not
www.gamasutra.com/features/19970801/octree.htmwww.gamasutra.com/features/19970801/octree.htmwww.gamasutra.com/features/19970801/octree.htmwww.gamasutra.com/features/19970801/octree.htm
Octrees
• A voxel may have geometry inside it or subdivideA voxel may have geometry inside it or subdivide
– Can have as many as eight childrenCan have as many as eight children
• Thus we partition 3-D space into Thus we partition 3-D space into 3-D cells3-D cells
• Checking visibility with polygons isChecking visibility with polygons isnow faster due to only checkingnow faster due to only checkingparticular cellsparticular cells
• Quadtrees are a 2-D variantQuadtrees are a 2-D variant
• A voxel may have geometry inside it or subdivideA voxel may have geometry inside it or subdivide
– Can have as many as eight childrenCan have as many as eight children
• Thus we partition 3-D space into Thus we partition 3-D space into 3-D cells3-D cells
• Checking visibility with polygons isChecking visibility with polygons isnow faster due to only checkingnow faster due to only checkingparticular cellsparticular cells
• Quadtrees are a 2-D variantQuadtrees are a 2-D variant
Warnock’s Algorithm (1969)
Elegant scheme based on a powerful general approach Elegant scheme based on a powerful general approach common in graphics: common in graphics: if the situation is too complex, if the situation is too complex, subdividesubdivide
• Start with a Start with a root viewportroot viewport and a list of all primitives (polygons) and a list of all primitives (polygons)
• Then recursively:Then recursively:
– Clip objects to viewportClip objects to viewport
– If number of objects incident to viewport is zero or one, visibility is If number of objects incident to viewport is zero or one, visibility is trivialtrivial
– Otherwise, subdivide into smaller viewports, distribute primitives Otherwise, subdivide into smaller viewports, distribute primitives among them, and recurseamong them, and recurse
Elegant scheme based on a powerful general approach Elegant scheme based on a powerful general approach common in graphics: common in graphics: if the situation is too complex, if the situation is too complex, subdividesubdivide
• Start with a Start with a root viewportroot viewport and a list of all primitives (polygons) and a list of all primitives (polygons)
• Then recursively:Then recursively:
– Clip objects to viewportClip objects to viewport
– If number of objects incident to viewport is zero or one, visibility is If number of objects incident to viewport is zero or one, visibility is trivialtrivial
– Otherwise, subdivide into smaller viewports, distribute primitives Otherwise, subdivide into smaller viewports, distribute primitives among them, and recurseamong them, and recurse
Warnock’s Algorithm
What is the What is the terminating terminating condition?condition?
How to determine How to determine the correct visible the correct visible surface in this surface in this case?case?
What is the What is the terminating terminating condition?condition?
How to determine How to determine the correct visible the correct visible surface in this surface in this case?case?
Warnock’s Algorithm
Pros:Pros:
• Very elegant schemeVery elegant scheme
• Extends to any primitive typeExtends to any primitive type
Cons:Cons:
• Hard to embed hierarchical schemes in hardwareHard to embed hierarchical schemes in hardware
• Complex scenes usually have small polygons and high Complex scenes usually have small polygons and high depth depth complexitycomplexity
– Thus most screen regions come down to the single-pixel caseThus most screen regions come down to the single-pixel case
Pros:Pros:
• Very elegant schemeVery elegant scheme
• Extends to any primitive typeExtends to any primitive type
Cons:Cons:
• Hard to embed hierarchical schemes in hardwareHard to embed hierarchical schemes in hardware
• Complex scenes usually have small polygons and high Complex scenes usually have small polygons and high depth depth complexitycomplexity
– Thus most screen regions come down to the single-pixel caseThus most screen regions come down to the single-pixel case
The Z-Buffer Algorithm
Both BSP trees and Warnock’s algorithm were Both BSP trees and Warnock’s algorithm were proposed when memory was expensiveproposed when memory was expensive
• Example: first 512x512 framebuffer > $50,000!Example: first 512x512 framebuffer > $50,000!
Ed Catmull (mid-70s) proposed a radical new Ed Catmull (mid-70s) proposed a radical new approach called approach called z-bufferingz-buffering..
The big idea: resolve visibility The big idea: resolve visibility independently at independently at each pixeleach pixel
Both BSP trees and Warnock’s algorithm were Both BSP trees and Warnock’s algorithm were proposed when memory was expensiveproposed when memory was expensive
• Example: first 512x512 framebuffer > $50,000!Example: first 512x512 framebuffer > $50,000!
Ed Catmull (mid-70s) proposed a radical new Ed Catmull (mid-70s) proposed a radical new approach called approach called z-bufferingz-buffering..
The big idea: resolve visibility The big idea: resolve visibility independently at independently at each pixeleach pixel
The Z-Buffer Algorithm
We know how to rasterize polygons into an image We know how to rasterize polygons into an image discretized into pixels:discretized into pixels:
We know how to rasterize polygons into an image We know how to rasterize polygons into an image discretized into pixels:discretized into pixels:
The Z-Buffer Algorithm
What happens if multiple primitives occupy the What happens if multiple primitives occupy the same pixel on the screen? Which is allowed to same pixel on the screen? Which is allowed to paint the pixel?paint the pixel?
What happens if multiple primitives occupy the What happens if multiple primitives occupy the same pixel on the screen? Which is allowed to same pixel on the screen? Which is allowed to paint the pixel?paint the pixel?
The Z-Buffer Algorithm
Idea: retain depth (Z in eye coordinates) through Idea: retain depth (Z in eye coordinates) through projection transformprojection transform
• Use canonical viewing volumesUse canonical viewing volumes
• Each vertex has z coordinate (relative to eye point) intactEach vertex has z coordinate (relative to eye point) intact
Idea: retain depth (Z in eye coordinates) through Idea: retain depth (Z in eye coordinates) through projection transformprojection transform
• Use canonical viewing volumesUse canonical viewing volumes
• Each vertex has z coordinate (relative to eye point) intactEach vertex has z coordinate (relative to eye point) intact
The Z-Buffer Algorithm
Augment framebuffer with Augment framebuffer with Z-bufferZ-buffer or or depth bufferdepth buffer which stores Z value at each pixelwhich stores Z value at each pixel
• At frame beginning, initialize all pixel depths to At frame beginning, initialize all pixel depths to
• When rasterizing, interpolate depth (Z) across polygon and When rasterizing, interpolate depth (Z) across polygon and store in pixel of Z-bufferstore in pixel of Z-buffer
• Suppress writing to a pixel if its Z value is more distant than Suppress writing to a pixel if its Z value is more distant than the Z value already stored therethe Z value already stored there
Augment framebuffer with Augment framebuffer with Z-bufferZ-buffer or or depth bufferdepth buffer which stores Z value at each pixelwhich stores Z value at each pixel
• At frame beginning, initialize all pixel depths to At frame beginning, initialize all pixel depths to
• When rasterizing, interpolate depth (Z) across polygon and When rasterizing, interpolate depth (Z) across polygon and store in pixel of Z-bufferstore in pixel of Z-buffer
• Suppress writing to a pixel if its Z value is more distant than Suppress writing to a pixel if its Z value is more distant than the Z value already stored therethe Z value already stored there
Interpolating ZEdge equations: Z is just another planar parameter:Edge equations: Z is just another planar parameter:
z = (-D - Ax – By) / Cz = (-D - Ax – By) / C
If walking across scanline by (If walking across scanline by (x) x)
zznewnew = z = zoldold – (A/C)( – (A/C)(x)x)
• Look familiar?Look familiar?
• Total cost:Total cost:
– 1 more parameter to 1 more parameter to increment in inner loopincrement in inner loop
– 3x3 matrix multiply for setup3x3 matrix multiply for setup
Edge walking: just interpolate Z along edges and across spansEdge walking: just interpolate Z along edges and across spans
Edge equations: Z is just another planar parameter:Edge equations: Z is just another planar parameter:
z = (-D - Ax – By) / Cz = (-D - Ax – By) / C
If walking across scanline by (If walking across scanline by (x) x)
zznewnew = z = zoldold – (A/C)( – (A/C)(x)x)
• Look familiar?Look familiar?
• Total cost:Total cost:
– 1 more parameter to 1 more parameter to increment in inner loopincrement in inner loop
– 3x3 matrix multiply for setup3x3 matrix multiply for setup
Edge walking: just interpolate Z along edges and across spansEdge walking: just interpolate Z along edges and across spans
The Z-Buffer Algorithm
How much memory does the Z-buffer use?How much memory does the Z-buffer use?
Does the image rendered depend on the drawing Does the image rendered depend on the drawing order?order?
Does the time to render the image depend on the Does the time to render the image depend on the drawing order?drawing order?
How does Z-buffer load scale with visible How does Z-buffer load scale with visible polygons? With framebuffer resolution?polygons? With framebuffer resolution?
How much memory does the Z-buffer use?How much memory does the Z-buffer use?
Does the image rendered depend on the drawing Does the image rendered depend on the drawing order?order?
Does the time to render the image depend on the Does the time to render the image depend on the drawing order?drawing order?
How does Z-buffer load scale with visible How does Z-buffer load scale with visible polygons? With framebuffer resolution?polygons? With framebuffer resolution?
Z-Buffer Pros
Simple!!!Simple!!!
Easy to implement in hardwareEasy to implement in hardware
Polygons can be processed in arbitrary orderPolygons can be processed in arbitrary order
Easily handles polygon interpenetrationEasily handles polygon interpenetration
EnablesEnables deferred shading deferred shading
• Rasterize shading parameters (e.g., surface normal) and Rasterize shading parameters (e.g., surface normal) and only shade final visible fragmentsonly shade final visible fragments
Simple!!!Simple!!!
Easy to implement in hardwareEasy to implement in hardware
Polygons can be processed in arbitrary orderPolygons can be processed in arbitrary order
Easily handles polygon interpenetrationEasily handles polygon interpenetration
EnablesEnables deferred shading deferred shading
• Rasterize shading parameters (e.g., surface normal) and Rasterize shading parameters (e.g., surface normal) and only shade final visible fragmentsonly shade final visible fragments
Z-Buffer Cons
Lots of memory (e.g. 1280x1024x32 bits)Lots of memory (e.g. 1280x1024x32 bits)
• With 16 bits cannot discern millimeter differences in objects at 1 km distanceWith 16 bits cannot discern millimeter differences in objects at 1 km distance
Read-Modify-Write in inner loop requires fast memoryRead-Modify-Write in inner loop requires fast memory
Hard to do analytic antialiasingHard to do analytic antialiasing
• We don’t know which polygon to map pixel back toWe don’t know which polygon to map pixel back to
Shared edges are handled inconsistentlyShared edges are handled inconsistently
• Ordering dependentOrdering dependent
Hard to simulate translucent polygonsHard to simulate translucent polygons
• We throw away color of polygons behind closest oneWe throw away color of polygons behind closest one
Lots of memory (e.g. 1280x1024x32 bits)Lots of memory (e.g. 1280x1024x32 bits)
• With 16 bits cannot discern millimeter differences in objects at 1 km distanceWith 16 bits cannot discern millimeter differences in objects at 1 km distance
Read-Modify-Write in inner loop requires fast memoryRead-Modify-Write in inner loop requires fast memory
Hard to do analytic antialiasingHard to do analytic antialiasing
• We don’t know which polygon to map pixel back toWe don’t know which polygon to map pixel back to
Shared edges are handled inconsistentlyShared edges are handled inconsistently
• Ordering dependentOrdering dependent
Hard to simulate translucent polygonsHard to simulate translucent polygons
• We throw away color of polygons behind closest oneWe throw away color of polygons behind closest one