Visibility Processing. © 2002 James K. Hahn, N. H. Baek2 Complex Scenes We have a complex scene How...

43
Visibility Processing

Transcript of Visibility Processing. © 2002 James K. Hahn, N. H. Baek2 Complex Scenes We have a complex scene How...

Visibility Processing

© 2002 James K. Hahn, N. H. Baek2

Complex ScenesWe have a complex sceneWe have a complex scene• How to efficiently process it?How to efficiently process it?

– fast visibility processingfast visibility processing

– fast collision detection : especially for animation usefast collision detection : especially for animation use

Basic problem?Basic problem?• Number of polygons are very largeNumber of polygons are very large

• Problem with Z-buffer: inherent inefficiencyProblem with Z-buffer: inherent inefficiency

• Solution? Data structuresSolution? Data structures

We have a complex sceneWe have a complex scene• How to efficiently process it?How to efficiently process it?

– fast visibility processingfast visibility processing

– fast collision detection : especially for animation usefast collision detection : especially for animation use

Basic problem?Basic problem?• Number of polygons are very largeNumber of polygons are very large

• Problem with Z-buffer: inherent inefficiencyProblem with Z-buffer: inherent inefficiency

• Solution? Data structuresSolution? Data structures

© 2002 James K. Hahn, N. H. Baek3

HierarchyNew data structure ?New data structure ?

• Apply hierarchy to entire sceneApply hierarchy to entire scene

• The concept of switchThe concept of switch

– When boundary is crossed, do not displayWhen boundary is crossed, do not display

New data structure ?New data structure ?• Apply hierarchy to entire sceneApply hierarchy to entire scene

• The concept of switchThe concept of switch

– When boundary is crossed, do not displayWhen boundary is crossed, do not display

sceneinside/outside

floor level

corridor/office

office

landscape

buildings

© 2002 James K. Hahn, N. H. Baek4

Hierarchical Data StructuresUsually used for pre-processingUsually used for pre-processing• Spatial subdivisionSpatial subdivision

– Uniform spatial subdivisionUniform spatial subdivision

– OctreeOctree

– BSP tree : binary space partitioning tree (generalized BSP tree : binary space partitioning tree (generalized Octree)Octree)

– Usually for rendering speed-upUsually for rendering speed-up

• Bounding volume tree (simplified version of scene)Bounding volume tree (simplified version of scene)

– Usually for collision detectionUsually for collision detection

Usually used for pre-processingUsually used for pre-processing• Spatial subdivisionSpatial subdivision

– Uniform spatial subdivisionUniform spatial subdivision

– OctreeOctree

– BSP tree : binary space partitioning tree (generalized BSP tree : binary space partitioning tree (generalized Octree)Octree)

– Usually for rendering speed-upUsually for rendering speed-up

• Bounding volume tree (simplified version of scene)Bounding volume tree (simplified version of scene)

– Usually for collision detectionUsually for collision detection

© 2002 James K. Hahn, N. H. Baek5

Visibility ProcessingFundamental problemFundamental problem

• Determine objects that are in the view frustumDetermine objects that are in the view frustum

Problem of visibility processingProblem of visibility processing

• Real-time processing is not possibleReal-time processing is not possible

– pre-processingpre-processing

• Do not usually treat dynamic object (that move in environment)Do not usually treat dynamic object (that move in environment)

– dynamic objects treated speciallydynamic objects treated specially

Fundamental problemFundamental problem

• Determine objects that are in the view frustumDetermine objects that are in the view frustum

Problem of visibility processingProblem of visibility processing

• Real-time processing is not possibleReal-time processing is not possible

– pre-processingpre-processing

• Do not usually treat dynamic object (that move in environment)Do not usually treat dynamic object (that move in environment)

– dynamic objects treated speciallydynamic objects treated specially

© 2002 James K. Hahn, N. H. Baek6

Uniform Space Subdivision• Divide entire space into gridDivide entire space into grid

• Used in ray-tracing methodUsed in ray-tracing method

– Only consider objects in voxelsOnly consider objects in voxels thatthatare visibleare visible

– No exhaustive search of all objectsNo exhaustive search of all objectsnecessarynecessary

• Divide entire space into gridDivide entire space into grid

• Used in ray-tracing methodUsed in ray-tracing method

– Only consider objects in voxelsOnly consider objects in voxels thatthatare visibleare visible

– No exhaustive search of all objectsNo exhaustive search of all objectsnecessarynecessary

© 2002 James K. Hahn, N. H. Baek7

Octree• 3D space : Divide space into 8 voxels3D space : Divide space into 8 voxels

• terminal type : occupied or unoccupiedterminal type : occupied or unoccupied

• stop when no need to subdividestop when no need to subdivide

– Either empty or voxel of min sizeEither empty or voxel of min size

• Can represent object itself (CT)Can represent object itself (CT)

• Node can point toNode can point torepresentation of objectrepresentation of object

• 3D space : Divide space into 8 voxels3D space : Divide space into 8 voxels

• terminal type : occupied or unoccupiedterminal type : occupied or unoccupied

• stop when no need to subdividestop when no need to subdivide

– Either empty or voxel of min sizeEither empty or voxel of min size

• Can represent object itself (CT)Can represent object itself (CT)

• Node can point toNode can point torepresentation of objectrepresentation of object

1 243

© 2002 James K. Hahn, N. H. Baek8

Octreevariation : Stop when only one object at nodevariation : Stop when only one object at node• tree becomes simplertree becomes simpler

• To draw objects, no differenceTo draw objects, no difference

– That object need to be drawn anywayThat object need to be drawn anyway

variation : Stop when only one object at nodevariation : Stop when only one object at node• tree becomes simplertree becomes simpler

• To draw objects, no differenceTo draw objects, no difference

– That object need to be drawn anywayThat object need to be drawn anyway

© 2002 James K. Hahn, N. H. Baek9

BSP tree

binary space partitioning treebinary space partitioning tree

• At every level divide space into 2 sub-spacesAt every level divide space into 2 sub-spaces

• Simple form of octreeSimple form of octree

– octree == 3 levels of a octree == 3 levels of a uniformuniform BSP tree BSP tree

binary space partitioning treebinary space partitioning tree

• At every level divide space into 2 sub-spacesAt every level divide space into 2 sub-spaces

• Simple form of octreeSimple form of octree

– octree == 3 levels of a octree == 3 levels of a uniformuniform BSP tree BSP tree

1 2

43

1 2 3 4 1 2 3 41 2

43

© 2002 James K. Hahn, N. H. Baek10

BSP tree• No need for subdivision plane to be axis-No need for subdivision plane to be axis-

parallelparallel

• More general than octreeMore general than octree

• No need for subdivision plane to be axis-No need for subdivision plane to be axis-parallelparallel

• More general than octreeMore general than octree

12

4

3

3 2 4 1

– +

++ ––

© 2002 James K. Hahn, N. H. Baek11

BSP tree• how to optimize ?how to optimize ? open questionopen question• how to optimize ?how to optimize ? open questionopen question

BSP tree depth = 8 BSP tree depth = 4

k l oi j m nd e g h

c f

a b

p k l oi j m nd e g h

c f

a b

p

© 2002 James K. Hahn, N. H. Baek12

Bounding volume• ApproximateApproximate objects using bounding volumeobjects using bounding volume

• Originated in ray-tracing Originated in ray-tracing ((see Chap 15)see Chap 15)

• bounding spherebounding sphere

• AABB : axis-aligned bounding boxAABB : axis-aligned bounding box

• OBB : oriented bounding boxOBB : oriented bounding box

• ApproximateApproximate objects using bounding volumeobjects using bounding volume

• Originated in ray-tracing Originated in ray-tracing ((see Chap 15)see Chap 15)

• bounding spherebounding sphere

• AABB : axis-aligned bounding boxAABB : axis-aligned bounding box

• OBB : oriented bounding boxOBB : oriented bounding box

object boundingsphere

AABB OBB

© 2002 James K. Hahn, N. H. Baek13

BSP tree for hidden surface• scene is staticscene is static

• view point is movingview point is moving

• example : flight simulatorexample : flight simulator

2-phase algorithm2-phase algorithm• pre-processing : create BSP treepre-processing : create BSP tree

• main processing :set view pointmain processing :set view point

• ordered polygon listordered polygon list

• scene is staticscene is static

• view point is movingview point is moving

• example : flight simulatorexample : flight simulator

2-phase algorithm2-phase algorithm• pre-processing : create BSP treepre-processing : create BSP tree

• main processing :set view pointmain processing :set view point

• ordered polygon listordered polygon list

© 2002 James K. Hahn, N. H. Baek14

Creating BSP tree

Divide entire space into 2 sub-spacesDivide entire space into 2 sub-spaces

• Apply recursivelyApply recursively

• Until each sub-space has one objectUntil each sub-space has one object

Divide entire space into 2 sub-spacesDivide entire space into 2 sub-spaces

• Apply recursivelyApply recursively

• Until each sub-space has one objectUntil each sub-space has one object

12

4

3

3 2 4 1

– +

++ ––

© 2002 James K. Hahn, N. H. Baek15

Given camera position• Given a dividing plane, objects in the half space where camera is located is in Given a dividing plane, objects in the half space where camera is located is in front offront of objects in the other half space objects in the other half space

• Recursive algorithmRecursive algorithm

– Visit half space where camera is locatedVisit half space where camera is located

– Visit the dividing planeVisit the dividing plane

– Visit the other half spaceVisit the other half space

• Result in “near-to-far visibility order”Result in “near-to-far visibility order”

• Given a dividing plane, objects in the half space where camera is located is in Given a dividing plane, objects in the half space where camera is located is in front offront of objects in the other half space objects in the other half space

• Recursive algorithmRecursive algorithm

– Visit half space where camera is locatedVisit half space where camera is located

– Visit the dividing planeVisit the dividing plane

– Visit the other half spaceVisit the other half space

• Result in “near-to-far visibility order”Result in “near-to-far visibility order”

© 2002 James K. Hahn, N. H. Baek16

• #2 #2 #3 #3 #1 #1 #4 #4

• Given order, draw using Z-buffer-like algorithmGiven order, draw using Z-buffer-like algorithm

• Actually distance not implied by order (3 is farther than 1)Actually distance not implied by order (3 is farther than 1)

• #2 #2 #3 #3 #1 #1 #4 #4

• Given order, draw using Z-buffer-like algorithmGiven order, draw using Z-buffer-like algorithm

• Actually distance not implied by order (3 is farther than 1)Actually distance not implied by order (3 is farther than 1)

12

4

3

camera 3 2 4 1

– +

++ ––

© 2002 James K. Hahn, N. H. Baek17

Applying BSP tree• Use with Z-bufferUse with Z-buffer

near-to-far visibility ordernear-to-far visibility order• Update only required regions in Z-buffer (don’t overwrite)Update only required regions in Z-buffer (don’t overwrite)

– Faster at the H/W levelFaster at the H/W level

far-to-near visibility orderfar-to-near visibility order• Opposite to near-to-far orderOpposite to near-to-far order

• Good for handling transparent objects (each polygon is Good for handling transparent objects (each polygon is composited to accumulated value)composited to accumulated value)

• Use with Z-bufferUse with Z-buffer

near-to-far visibility ordernear-to-far visibility order• Update only required regions in Z-buffer (don’t overwrite)Update only required regions in Z-buffer (don’t overwrite)

– Faster at the H/W levelFaster at the H/W level

far-to-near visibility orderfar-to-near visibility order• Opposite to near-to-far orderOpposite to near-to-far order

• Good for handling transparent objects (each polygon is Good for handling transparent objects (each polygon is composited to accumulated value)composited to accumulated value)

© 2002 James K. Hahn, N. H. Baek18

Applying BSP tree• Use one of the polygons that make up object as split planeUse one of the polygons that make up object as split plane

• May need to splitMay need to split polygonspolygons

• Experimentally, number of polygons less than 2x original Experimentally, number of polygons less than 2x original number of polygonsnumber of polygons

• Use one of the polygons that make up object as split planeUse one of the polygons that make up object as split plane

• May need to splitMay need to split polygonspolygons

• Experimentally, number of polygons less than 2x original Experimentally, number of polygons less than 2x original number of polygonsnumber of polygons

2

1

A

B

C

3a

3b

A

B

C

subtree2, 3a

subtree3b

+

+

© 2002 James K. Hahn, N. H. Baek19

Features of BSP tree• Checks only camera location not direction of viewChecks only camera location not direction of view

• Every node visited: balanced tree not necessaryEvery node visited: balanced tree not necessary

• Visibility does not depend on distanceVisibility does not depend on distance

• Checks only camera location not direction of viewChecks only camera location not direction of view

• Every node visited: balanced tree not necessaryEvery node visited: balanced tree not necessary

• Visibility does not depend on distanceVisibility does not depend on distance

© 2002 James K. Hahn, N. H. Baek20

Additional cullingBack face cullingBack face culling

• Check camera view direction Check camera view direction

• If camera on the “back side” of polygon, that polygon culledIf camera on the “back side” of polygon, that polygon culled

Clip against viewing frustumClip against viewing frustum

• Check normal of clipping plane with view direction to eliminate Check normal of clipping plane with view direction to eliminate entire subtree that is outside view frustumentire subtree that is outside view frustum

• Can use far clipping plane with fog effect to reduce “popping” Can use far clipping plane with fog effect to reduce “popping” in/outin/out

Back face cullingBack face culling

• Check camera view direction Check camera view direction

• If camera on the “back side” of polygon, that polygon culledIf camera on the “back side” of polygon, that polygon culled

Clip against viewing frustumClip against viewing frustum

• Check normal of clipping plane with view direction to eliminate Check normal of clipping plane with view direction to eliminate entire subtree that is outside view frustumentire subtree that is outside view frustum

• Can use far clipping plane with fog effect to reduce “popping” Can use far clipping plane with fog effect to reduce “popping” in/outin/out

© 2002 James K. Hahn, N. H. Baek21

BSP compilerscene information scene information create BSP tree create BSP tree• Usually off-lineUsually off-line

• Takes long timeTakes long time

Fundamental problemFundamental problem• Which polygon will be used as splitting planeWhich polygon will be used as splitting plane??

• SolutionSolution

– Use approximated costUse approximated cost

– Reduce number of immediate splitsReduce number of immediate splits ( (local optimization)local optimization)

scene information scene information create BSP tree create BSP tree• Usually off-lineUsually off-line

• Takes long timeTakes long time

Fundamental problemFundamental problem• Which polygon will be used as splitting planeWhich polygon will be used as splitting plane??

• SolutionSolution

– Use approximated costUse approximated cost

– Reduce number of immediate splitsReduce number of immediate splits ( (local optimization)local optimization)

© 2002 James K. Hahn, N. H. Baek22

Building a BSP tree from polygons• Create plane equation from a polygonCreate plane equation from a polygon

– Ax+By+Cz+D=0Ax+By+Cz+D=0

– A,B,C normal of the polygonA,B,C normal of the polygon

– D from substituting a vertex into equationD from substituting a vertex into equation

• Plug into plane equation to see which side of splitting plane a Plug into plane equation to see which side of splitting plane a point liespoint lies

– If positive, on one side, if negative on the other sideIf positive, on one side, if negative on the other side

– If zero, on planeIf zero, on plane

• Split polygon if necessarySplit polygon if necessary

• Create plane equation from a polygonCreate plane equation from a polygon

– Ax+By+Cz+D=0Ax+By+Cz+D=0

– A,B,C normal of the polygonA,B,C normal of the polygon

– D from substituting a vertex into equationD from substituting a vertex into equation

• Plug into plane equation to see which side of splitting plane a Plug into plane equation to see which side of splitting plane a point liespoint lies

– If positive, on one side, if negative on the other sideIf positive, on one side, if negative on the other side

– If zero, on planeIf zero, on plane

• Split polygon if necessarySplit polygon if necessary

© 2002 James K. Hahn, N. H. Baek23

BSP tree in practice• Application / scene dependent solutionsApplication / scene dependent solutions

• Building interior environmentBuilding interior environment

– example : Doom, inside buildingexample : Doom, inside building

– splitting plane : each sides of roomsplitting plane : each sides of room

• LandscapeLandscape

– Problem : high level of detail in spaceProblem : high level of detail in space selection of splitting plane difficult selection of splitting plane difficult

– One solution : splitting planes aligned with grid (normal One solution : splitting planes aligned with grid (normal aligned with x or z or y)aligned with x or z or y)

• Application / scene dependent solutionsApplication / scene dependent solutions

• Building interior environmentBuilding interior environment

– example : Doom, inside buildingexample : Doom, inside building

– splitting plane : each sides of roomsplitting plane : each sides of room

• LandscapeLandscape

– Problem : high level of detail in spaceProblem : high level of detail in space selection of splitting plane difficult selection of splitting plane difficult

– One solution : splitting planes aligned with grid (normal One solution : splitting planes aligned with grid (normal aligned with x or z or y)aligned with x or z or y)

© 2002 James K. Hahn, N. H. Baek24

BSP tree for building interior• Each terminal node of BSP tree correspond to each roomEach terminal node of BSP tree correspond to each room

• Rendering : simply draw appropriate room interiorsRendering : simply draw appropriate room interiors

– When in A, draw what’s inside room AWhen in A, draw what’s inside room A

• Each terminal node of BSP tree correspond to each roomEach terminal node of BSP tree correspond to each room

• Rendering : simply draw appropriate room interiorsRendering : simply draw appropriate room interiors

– When in A, draw what’s inside room AWhen in A, draw what’s inside room A

a d

A B

F C

E

D

b c

e

a

b c

ed

A F B DCE

+–

– –

+

++

© 2002 James K. Hahn, N. H. Baek25

Concept of Portal• Can see part of other rooms through windows/doorsCan see part of other rooms through windows/doors

• PVS (potentially visible set): set of nodes visible from a PVS (potentially visible set): set of nodes visible from a nodenode

• Can see part of other rooms through windows/doorsCan see part of other rooms through windows/doors

• PVS (potentially visible set): set of nodes visible from a PVS (potentially visible set): set of nodes visible from a nodenode

c

A B

F C

E

D

b

d

e

a a

b c

ed

A F B DCE

+–

– –

+

++

potentially visible

© 2002 James K. Hahn, N. H. Baek26

Portal, PVS• PortalPortal

– Areas visible from a particular BSP nodeAreas visible from a particular BSP node

• PVS : for a particular BSPPVS : for a particular BSP nodenode

– Potentially visible nodesPotentially visible nodes

– E.g. : PVS(A) = { B, C, D, E }E.g. : PVS(A) = { B, C, D, E }

• Example of use of PVSExample of use of PVS

– Create PVS : pre-calculateCreate PVS : pre-calculate

– When renderingWhen rendering: : draw A + PVS(A)draw A + PVS(A)

• PortalPortal

– Areas visible from a particular BSP nodeAreas visible from a particular BSP node

• PVS : for a particular BSPPVS : for a particular BSP nodenode

– Potentially visible nodesPotentially visible nodes

– E.g. : PVS(A) = { B, C, D, E }E.g. : PVS(A) = { B, C, D, E }

• Example of use of PVSExample of use of PVS

– Create PVS : pre-calculateCreate PVS : pre-calculate

– When renderingWhen rendering: : draw A + PVS(A)draw A + PVS(A)

A B

F C

E

D

b

d

e

a

© 2002 James K. Hahn, N. H. Baek27

Portal without BSP tree• Cull and render the room where camera is locatedCull and render the room where camera is located

• If polygon tagged as portal, recurse into next room If polygon tagged as portal, recurse into next room and cull (against reduced view frustrum) and render and cull (against reduced view frustrum) and render until no more portals encountereduntil no more portals encountered

• Mirrors portals to roomMirrors portals to roomitselfitself

• Cull and render the room where camera is locatedCull and render the room where camera is located

• If polygon tagged as portal, recurse into next room If polygon tagged as portal, recurse into next room and cull (against reduced view frustrum) and render and cull (against reduced view frustrum) and render until no more portals encountereduntil no more portals encountered

• Mirrors portals to roomMirrors portals to roomitselfitself

camera

portal #1 portal #2

© 2002 James K. Hahn, N. H. Baek28

BSP tree + Portal• BSP tree where partitioning planes parallel with BSP tree where partitioning planes parallel with

floors and walls (k-D tree)floors and walls (k-D tree)

cell-to-cell visibility (for a room A)cell-to-cell visibility (for a room A)

• find PVS from BSP treefind PVS from BSP tree

• BSP tree where partitioning planes parallel with BSP tree where partitioning planes parallel with floors and walls (k-D tree)floors and walls (k-D tree)

cell-to-cell visibility (for a room A)cell-to-cell visibility (for a room A)

• find PVS from BSP treefind PVS from BSP tree

A B

C

E

D

© 2002 James K. Hahn, N. H. Baek29

cell-to-region visibilitycell-to-region visibility

• Find areas that are actually visibleFind areas that are actually visible

• Think of cell as light sourceThink of cell as light sourcefind anti-penumbra through portalsfind anti-penumbra through portals

cell-to-object visibilitycell-to-object visibility

• Mark objects that are inside regionsMark objects that are inside regions

cell-to-region visibilitycell-to-region visibility

• Find areas that are actually visibleFind areas that are actually visible

• Think of cell as light sourceThink of cell as light sourcefind anti-penumbra through portalsfind anti-penumbra through portals

cell-to-object visibilitycell-to-object visibility

• Mark objects that are inside regionsMark objects that are inside regions

A B

C

E

D

cell-to-region visibility

A B

C

E

D

cell-to-object visibility

© 2002 James K. Hahn, N. H. Baek30

At run-timeAt run-timeeye-to-object visibilityeye-to-object visibility• Use actual cameraUse actual camera locationlocation

(viewpoint frustum) to(viewpoint frustum) tocalculate visible areacalculate visible area

• Calculate only pre-marked part:Calculate only pre-marked part:fastfast

• Gives the final PVSGives the final PVS

At run-timeAt run-timeeye-to-object visibilityeye-to-object visibility• Use actual cameraUse actual camera locationlocation

(viewpoint frustum) to(viewpoint frustum) tocalculate visible areacalculate visible area

• Calculate only pre-marked part:Calculate only pre-marked part:fastfast

• Gives the final PVSGives the final PVS

A B

C

E

D

eye-to-object visibility

A B

C

E

D

cell-to-object visibility

© 2002 James K. Hahn, N. H. Baek31

Anti-penumbraDetermining cell-to-region visibilityDetermining cell-to-region visibility

• Consider cell as light sourceConsider cell as light source

• Consider portal as occluders and walls as transparentConsider portal as occluders and walls as transparent

• Shadows that portalShadows that portal generate (penumbra)generate (penumbra) is visible regionis visible region

• Since portal is really transparent, the region is “anti-penumbra”Since portal is really transparent, the region is “anti-penumbra”

Determining cell-to-region visibilityDetermining cell-to-region visibility• Consider cell as light sourceConsider cell as light source

• Consider portal as occluders and walls as transparentConsider portal as occluders and walls as transparent

• Shadows that portalShadows that portal generate (penumbra)generate (penumbra) is visible regionis visible region

• Since portal is really transparent, the region is “anti-penumbra”Since portal is really transparent, the region is “anti-penumbra”

A B

C

E

D

anti-penumbralight source

© 2002 James K. Hahn, N. H. Baek32

VFC (View Frustum Culling)• Test VF against another bounding volumeTest VF against another bounding volume

• VF VF BV(object) = BV(object) = : reject : reject

• VF VF BV(object) = BV(object) : draw BV(object) = BV(object) : draw

• VF VF BV(object) = a volume : further testing BV(object) = a volume : further testing

• Test VF against another bounding volumeTest VF against another bounding volume

• VF VF BV(object) = BV(object) = : reject : reject

• VF VF BV(object) = BV(object) : draw BV(object) = BV(object) : draw

• VF VF BV(object) = a volume : further testing BV(object) = a volume : further testing

cameraVFC

reject

draw

further testing

© 2002 James K. Hahn, N. H. Baek33

with AABB(axis-aligned bounding box)

• Transform AABB to 3D view spaceTransform AABB to 3D view space then,then,recalculate AABB then testrecalculate AABB then test

• Transform AABB to 3D view spaceTransform AABB to 3D view space then,then,recalculate AABB then testrecalculate AABB then test

VFCAABB

3D viewspaceVFC

AABB

3D viewspaceVFC

AABBtest

© 2002 James K. Hahn, N. H. Baek34

with OBB(oriented bounding box)

• Test view frustum (VF) and each faceTest view frustum (VF) and each face• Test view frustum (VF) and each faceTest view frustum (VF) and each face

VFOBB

in / out testfor each plane of VF

© 2002 James K. Hahn, N. H. Baek35

with bounding sphere• For each plane of VFFor each plane of VF

– Distance calculation compared to radiusDistance calculation compared to radius

• For each plane of VFFor each plane of VF

– Distance calculation compared to radiusDistance calculation compared to radius

VF

radius

distance

© 2002 James K. Hahn, N. H. Baek36

Coherence in VFC• Translations: each plane move toward or away from BVTranslations: each plane move toward or away from BV

• Rotations about single axes: visibility change on one side Rotations about single axes: visibility change on one side of VFof VF

• Translations: each plane move toward or away from BVTranslations: each plane move toward or away from BV

• Rotations about single axes: visibility change on one side Rotations about single axes: visibility change on one side of VFof VF

camera motion = VF motion

BV Consider only VFC motion

© 2002 James K. Hahn, N. H. Baek37

Exact Visibility• Past : many methodsPast : many methods

– Sutherland et al., “Sutherland et al., “A characterization of ten hidden surface A characterization of ten hidden surface algorithmsalgorithms”, ”, Computer SurveyComputer Survey, 6(1):1~55, (1974)., 6(1):1~55, (1974).

• Present : Z-buffer algorithmPresent : Z-buffer algorithm

– Simple algorithm with cheap memorySimple algorithm with cheap memory

• Future : Future : return of priority sorting, etc.return of priority sorting, etc.

– scene became too complex for Z-buffer algorithm scene became too complex for Z-buffer algorithm (especially games)(especially games)

• Past : many methodsPast : many methods– Sutherland et al., “Sutherland et al., “A characterization of ten hidden surface A characterization of ten hidden surface

algorithmsalgorithms”, ”, Computer SurveyComputer Survey, 6(1):1~55, (1974)., 6(1):1~55, (1974).

• Present : Z-buffer algorithmPresent : Z-buffer algorithm

– Simple algorithm with cheap memorySimple algorithm with cheap memory

• Future : Future : return of priority sorting, etc.return of priority sorting, etc.

– scene became too complex for Z-buffer algorithm scene became too complex for Z-buffer algorithm (especially games)(especially games)

© 2002 James K. Hahn, N. H. Baek38

Pre-computation of Exact Visibility• Basic ideaBasic idea

– For every possible camera position / direction:For every possible camera position / direction:

– Pre-calculate the visibilityPre-calculate the visibility

– Extreme version of BSP + portal approachExtreme version of BSP + portal approach

• ProblemProblem

– Need O(Need O(nn99) memory / time) memory / time

• SolutionSolution

– Use near-to-far sorting etc. againUse near-to-far sorting etc. again

• Basic ideaBasic idea

– For every possible camera position / direction:For every possible camera position / direction:

– Pre-calculate the visibilityPre-calculate the visibility

– Extreme version of BSP + portal approachExtreme version of BSP + portal approach

• ProblemProblem

– Need O(Need O(nn99) memory / time) memory / time

• SolutionSolution

– Use near-to-far sorting etc. againUse near-to-far sorting etc. again

© 2002 James K. Hahn, N. H. Baek39

Sorting strategy(Bishop’s approach)• Bishop, et al., “Bishop, et al., “Designing a PC game engineDesigning a PC game engine”, ”, IEEE IEEE

CG&ACG&A, 18(1):46-53, (1998)., 18(1):46-53, (1998).

• in in NetImmerseNetImmerse game engine, game engine,

• Assume no Z-buffer (use painter’s algorithm)Assume no Z-buffer (use painter’s algorithm)

• Polygon rendering : far-to-near orderPolygon rendering : far-to-near order

– Problem : polygon sortingProblem : polygon sorting is slowis slow

– Solution : consider only those that need sortingSolution : consider only those that need sorting

• Bishop, et al., “Bishop, et al., “Designing a PC game engineDesigning a PC game engine”, ”, IEEE IEEE CG&ACG&A, 18(1):46-53, (1998)., 18(1):46-53, (1998).

• in in NetImmerseNetImmerse game engine, game engine,

• Assume no Z-buffer (use painter’s algorithm)Assume no Z-buffer (use painter’s algorithm)

• Polygon rendering : far-to-near orderPolygon rendering : far-to-near order

– Problem : polygon sortingProblem : polygon sorting is slowis slow

– Solution : consider only those that need sortingSolution : consider only those that need sorting

© 2002 James K. Hahn, N. H. Baek40

• Use scene graphUse scene graph

• For each node tag sorting or no sortingFor each node tag sorting or no sorting

• NodesNodes requiring sorting use BSP treerequiring sorting use BSP tree

• Succeed in real-time renderingSucceed in real-time rendering

• Use scene graphUse scene graph

• For each node tag sorting or no sortingFor each node tag sorting or no sorting

• NodesNodes requiring sorting use BSP treerequiring sorting use BSP tree

• Succeed in real-time renderingSucceed in real-time rendering

room #1

room #1

walls contents

sorting :NOT NEEDED(walls followed byfurniture always)

sorting :NOT NEEDED

sorting :NEEDED

Order of rendering not important(6 walls rendered any order)

BSP treefor the interior objects

© 2002 James K. Hahn, N. H. Baek41

Occlusion culling• Visibility within view frustum: overdraw problemVisibility within view frustum: overdraw problem

• Occlusion culling : remove objects behind occluderOcclusion culling : remove objects behind occluder

• Z-buffer, BSP can be sped-up using occlusion Z-buffer, BSP can be sped-up using occlusion cullingculling

• Visibility within view frustum: overdraw problemVisibility within view frustum: overdraw problem

• Occlusion culling : remove objects behind occluderOcclusion culling : remove objects behind occluder

• Z-buffer, BSP can be sped-up using occlusion Z-buffer, BSP can be sped-up using occlusion cullingculling

occluder

No need to rendercamera

© 2002 James K. Hahn, N. H. Baek42

Occlusion culling(Coorg and Teller’s approach)

• For all possible discretized viewpoint and occluder pre-For all possible discretized viewpoint and occluder pre-determine potential occludeedetermine potential occludee

• Potential occlusion dependent on area of occluder, Potential occlusion dependent on area of occluder, relative orientations, and distance to camera positionrelative orientations, and distance to camera position

• For all possible discretized viewpoint and occluder pre-For all possible discretized viewpoint and occluder pre-determine potential occludeedetermine potential occludee

• Potential occlusion dependent on area of occluder, Potential occlusion dependent on area of occluder, relative orientations, and distance to camera positionrelative orientations, and distance to camera position

occluder

occludee

occluded

partially occluded

not occluded

camera position

© 2002 James K. Hahn, N. H. Baek43

Dynamic Objects• Treat dynamic objects separately from static objectsTreat dynamic objects separately from static objects

• Static objects : rendering using BSP treeStatic objects : rendering using BSP tree

– Z-buffer not needed in far-to-near orderZ-buffer not needed in far-to-near order

– Store z-valuesStore z-values

• Dynamic objects : render separatelyDynamic objects : render separately

– Use Z-buffer algorithmUse Z-buffer algorithm

• Treat dynamic objects separately from static objectsTreat dynamic objects separately from static objects

• Static objects : rendering using BSP treeStatic objects : rendering using BSP tree

– Z-buffer not needed in far-to-near orderZ-buffer not needed in far-to-near order

– Store z-valuesStore z-values

• Dynamic objects : render separatelyDynamic objects : render separately

– Use Z-buffer algorithmUse Z-buffer algorithm