software structures for virtual environments

54
Software Structures for Software Structures for Virtual Environments Virtual Environments Capps, Darken, Zyda Capps, Darken, Zyda Naval Postgraduate School Naval Postgraduate School

Upload: ozzy

Post on 17-Jan-2016

39 views

Category:

Documents


3 download

DESCRIPTION

Software Structures for Virtual Environments. Capps, Darken, Zyda Naval Postgraduate School. What does VR software look like?. One Thread, Multiple Threads Important Subsystems Real-Time Rendering - Polygon Culling & Level of Detail Processing Real-Time Collision Detection and Response - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Software Structures for Virtual Environments

Software Structures for Virtual Software Structures for Virtual EnvironmentsEnvironments

Capps, Darken, ZydaCapps, Darken, Zyda

Naval Postgraduate SchoolNaval Postgraduate School

Capps, Darken, ZydaCapps, Darken, Zyda

Naval Postgraduate SchoolNaval Postgraduate School

Page 2: Software Structures for Virtual Environments

What does VR software look like?

One Thread, Multiple ThreadsOne Thread, Multiple Threads

Important SubsystemsImportant Subsystems

• Real-Time Rendering - Polygon Culling & Level of Real-Time Rendering - Polygon Culling & Level of Detail ProcessingDetail Processing

• Real-Time Collision Detection and ResponseReal-Time Collision Detection and Response

• Computational Resource ManagementComputational Resource Management

• Interaction ManagementInteraction Management

One Thread, Multiple ThreadsOne Thread, Multiple Threads

Important SubsystemsImportant Subsystems

• Real-Time Rendering - Polygon Culling & Level of Real-Time Rendering - Polygon Culling & Level of Detail ProcessingDetail Processing

• Real-Time Collision Detection and ResponseReal-Time Collision Detection and Response

• Computational Resource ManagementComputational Resource Management

• Interaction ManagementInteraction Management

Page 3: Software Structures for Virtual Environments

Conceptual Model

ACTION (RESPONSE)

• INTERACTION TECHNIQUES

• NATURAL LANGUAGE

• VISUAL DISPLAYS

• SPATIAL SOUND

• TACTILE FEEDBACK

• HAPTIC FEEDBACK

DEVICES (OUTPUT)

THE "WHAT" OF THE WORLD

• SIMULATION

• SCIENTIFIC VISUALIZATION

• AUTONOMOUS AGENTS

VISUALIZATION (STIMULI) SYSTEM ARCHITECTURE

• RENDERING

• COMMUNICATION

• NETWORKING

THE "HOW" OF THE WORLD

DEVICES (INPUT)

• SPEECH

• TRACKING

PERCEPTION COGNITION MOTOR

(INFORMATION PROCESSING MODEL)

Page 4: Software Structures for Virtual Environments

SystemComponents

Page 5: Software Structures for Virtual Environments

INPUT DEVICE C

INPUT DEVICE B

Simulation System

• POSITION

• ORIENT

• COMMANDS

• SELECTION

INPUT DEVICE A

CONTROL FEEDBACK

Sensory Synthesis

OUTPUT DEVICE C

OUTPUT DEVICE B

• VISUAL

• AUDITORY

• OLFACTORY

• TACTILE

• HAPTIC

OUTPUT DEVICE ASimple I/O Loop

Page 6: Software Structures for Virtual Environments

MODELING SYSTEM

• OBJECT GEOMETRY

• OBJECT HIERARCHY

• PHYSICAL PROPERTIES

• MATERIAL PROPERTIES

• ENVIRONMENTAL

CONTROL SYSTEM

• PROCESS USER INTERACTION

• COORDINATE COMMUNICATION

BETWEEN MULTIPLE NODES

SENSORY SYNTHESIS

• POSITION /

ORIENTATION

• COMMANDS/

SELECTION

CONTROL FEEDBACK

CHARACTERISTICS

• REAL TIME

- PHYSICAL BASED MODEL

- AI BASED MODEL

• SCRIPTED

• FREE PLAY INTERACTION

SIMULATION SYSTEM

TRAINING EXERCISES

ACTUAL FIELD / LAB DATA

INPUT DEVICE A

INPUT DEVICE B

INPUT DEVICE C

OUTPUT DEVICE A

OUTPUT DEVICE C

OUTPUT DEVICE B

More Detail ...

Page 7: Software Structures for Virtual Environments

Single Thread Networked VE

InitsRead

Input DevsCompute

State Changes

ReadNetwork

ComputeState Changes

Comp.Modeling

Post toNet

GeneratePicture

Page 8: Software Structures for Virtual Environments
Page 9: Software Structures for Virtual Environments

Real-Time Rendering - Polygon Culling & LODs

The “Generate New Picture” box on the The “Generate New Picture” box on the previous slide is somewhat misleading.previous slide is somewhat misleading.• It is not that simple unless we have unlimited graphics power. It is not that simple unless we have unlimited graphics power.

We usually don’t.We usually don’t.

• Most of the time we are trying to solve the Polygon Culling Most of the time we are trying to solve the Polygon Culling Problem. Problem.

– Use available CPU cycles to cull most of our 3D model Use available CPU cycles to cull most of our 3D model before we send it through the graphics pipeline ...before we send it through the graphics pipeline ...

The “Generate New Picture” box on the The “Generate New Picture” box on the previous slide is somewhat misleading.previous slide is somewhat misleading.• It is not that simple unless we have unlimited graphics power. It is not that simple unless we have unlimited graphics power.

We usually don’t.We usually don’t.

• Most of the time we are trying to solve the Polygon Culling Most of the time we are trying to solve the Polygon Culling Problem. Problem.

– Use available CPU cycles to cull most of our 3D model Use available CPU cycles to cull most of our 3D model before we send it through the graphics pipeline ...before we send it through the graphics pipeline ...

Page 10: Software Structures for Virtual Environments

Hierarchical Data Structures for Polygon Culling• The classic reference for this is the 1976 paper by The classic reference for this is the 1976 paper by

James Clark “Hierarchical Geometric Models for James Clark “Hierarchical Geometric Models for Visible Surface Algorithms”.Visible Surface Algorithms”.

• The idea in the Clark paper is to build a hierarchical The idea in the Clark paper is to build a hierarchical data structure for the displayable world ...data structure for the displayable world ...

• The classic reference for this is the 1976 paper by The classic reference for this is the 1976 paper by James Clark “Hierarchical Geometric Models for James Clark “Hierarchical Geometric Models for Visible Surface Algorithms”.Visible Surface Algorithms”.

• The idea in the Clark paper is to build a hierarchical The idea in the Clark paper is to build a hierarchical data structure for the displayable world ...data structure for the displayable world ...

Page 11: Software Structures for Virtual Environments

Hierarchical Data Structure for the Displayable World

World (complete building model):View volume definitionView point, reference pointBounding Volume (BV)

Floor 1:BV

Floor 2:BV

Floor n:BV

Rm1,1 Rm1,2 Rm 1,3 Rm2,1 Rm2,2 Rm2,3Rmn,1 Rmn,2 Rmn,3

. . .

Minimal set of polygons

Medium set of polygons

Complete set of polygons

BV BV BV BV BV BVBV BV BV

Page 12: Software Structures for Virtual Environments

Part 1 of the Clark Paper• We build a data structure that allows us to rapidly We build a data structure that allows us to rapidly

throw away most of the data for the world.throw away most of the data for the world.

• We test the hierarchical bounding volumes to see if We test the hierarchical bounding volumes to see if they are contained or partially contained in the they are contained or partially contained in the current orientation of the view volume.current orientation of the view volume.

• If they are and are leaves in the tree, we draw them If they are and are leaves in the tree, we draw them or continue our traversal.or continue our traversal.

• We build a data structure that allows us to rapidly We build a data structure that allows us to rapidly throw away most of the data for the world.throw away most of the data for the world.

• We test the hierarchical bounding volumes to see if We test the hierarchical bounding volumes to see if they are contained or partially contained in the they are contained or partially contained in the current orientation of the view volume.current orientation of the view volume.

• If they are and are leaves in the tree, we draw them If they are and are leaves in the tree, we draw them or continue our traversal.or continue our traversal.

Page 13: Software Structures for Virtual Environments

Part 2 of the Clark Paper• We only send the minimal required description of our We only send the minimal required description of our

object through the graphics pipeline.object through the graphics pipeline.

• We use the distance from the viewer to the We use the distance from the viewer to the BV/object to determine which resolution of our BV/object to determine which resolution of our objects to display, basically the pixel coverage of the objects to display, basically the pixel coverage of the final drawn object.final drawn object.

• This presupposes multiple resolution versions of This presupposes multiple resolution versions of each room.each room.

• We only send the minimal required description of our We only send the minimal required description of our object through the graphics pipeline.object through the graphics pipeline.

• We use the distance from the viewer to the We use the distance from the viewer to the BV/object to determine which resolution of our BV/object to determine which resolution of our objects to display, basically the pixel coverage of the objects to display, basically the pixel coverage of the final drawn object.final drawn object.

• This presupposes multiple resolution versions of This presupposes multiple resolution versions of each room.each room.

Page 14: Software Structures for Virtual Environments

View Volume• We can decide rather quickly whether our BV is in We can decide rather quickly whether our BV is in

the High, Medium or Low resolution sections.the High, Medium or Low resolution sections.

– Transform the BVs with the far clipping plane moved Transform the BVs with the far clipping plane moved closer.closer.

– Clip into memory and make the decision (or perform this Clip into memory and make the decision (or perform this test in the CPU, if there are spare cycles).test in the CPU, if there are spare cycles).

– We will end up with a list of BVs that should be displayed We will end up with a list of BVs that should be displayed and a resolution at which they should be displayed.and a resolution at which they should be displayed.

• We can decide rather quickly whether our BV is in We can decide rather quickly whether our BV is in the High, Medium or Low resolution sections.the High, Medium or Low resolution sections.

– Transform the BVs with the far clipping plane moved Transform the BVs with the far clipping plane moved closer.closer.

– Clip into memory and make the decision (or perform this Clip into memory and make the decision (or perform this test in the CPU, if there are spare cycles).test in the CPU, if there are spare cycles).

– We will end up with a list of BVs that should be displayed We will end up with a list of BVs that should be displayed and a resolution at which they should be displayed.and a resolution at which they should be displayed.

Page 15: Software Structures for Virtual Environments

View Volume

This the view volume This the view volume cut into three cut into three regions or “levels of regions or “levels of detail” (LOD).detail” (LOD).

This the view volume This the view volume cut into three cut into three regions or “levels of regions or “levels of detail” (LOD).detail” (LOD). Viewer

Near

Far

HighRes.

MediumResolution

LowResolution

Page 16: Software Structures for Virtual Environments

How do we compute different LODs for our models?

This depends on the origins of our This depends on the origins of our models...models...

• By hand - we do this by hand in our modeling tool, By hand - we do this by hand in our modeling tool, throwing away small polygons for the Low resolution throwing away small polygons for the Low resolution versions of our models.versions of our models.

– Some modeling tools will do this semi-Some modeling tools will do this semi-automatically. They give you a cut at it and you automatically. They give you a cut at it and you can add polygons back in.can add polygons back in.

This depends on the origins of our This depends on the origins of our models...models...

• By hand - we do this by hand in our modeling tool, By hand - we do this by hand in our modeling tool, throwing away small polygons for the Low resolution throwing away small polygons for the Low resolution versions of our models.versions of our models.

– Some modeling tools will do this semi-Some modeling tools will do this semi-automatically. They give you a cut at it and you automatically. They give you a cut at it and you can add polygons back in.can add polygons back in.

Page 17: Software Structures for Virtual Environments

How do we compute different LODs for our models?• Triangular decimation - a triangular mesh is fitted to Triangular decimation - a triangular mesh is fitted to

your model and an appropriate algorithm is used to your model and an appropriate algorithm is used to reduce the total number of triangles in the model.reduce the total number of triangles in the model.

– There is some very nice work on this by Greg There is some very nice work on this by Greg Turk and Hughe Hoppe and others...Turk and Hughe Hoppe and others...

• Triangular decimation - a triangular mesh is fitted to Triangular decimation - a triangular mesh is fitted to your model and an appropriate algorithm is used to your model and an appropriate algorithm is used to reduce the total number of triangles in the model.reduce the total number of triangles in the model.

– There is some very nice work on this by Greg There is some very nice work on this by Greg Turk and Hughe Hoppe and others...Turk and Hughe Hoppe and others...

Page 18: Software Structures for Virtual Environments

So let’s talk about that!

Curve and surface simplification are Curve and surface simplification are needed for a number of disciplines:needed for a number of disciplines:

• animation, compressionanimation, compression

• computer vision: smoothing range imagescomputer vision: smoothing range images

• simulators: VR systems, etcsimulators: VR systems, etc

Curve and surface simplification are Curve and surface simplification are needed for a number of disciplines:needed for a number of disciplines:

• animation, compressionanimation, compression

• computer vision: smoothing range imagescomputer vision: smoothing range images

• simulators: VR systems, etcsimulators: VR systems, etc

Page 19: Software Structures for Virtual Environments

Stating the problems:

given curve with N vertices:given curve with N vertices:

• find accurate curve with M<N verticesfind accurate curve with M<N vertices

• find compact curve with error < Efind compact curve with error < E

given surface with N vertices:given surface with N vertices:

• find accurate surface with M<N verticesfind accurate surface with M<N vertices

• find compact surface with error < Efind compact surface with error < E

given curve with N vertices:given curve with N vertices:

• find accurate curve with M<N verticesfind accurate curve with M<N vertices

• find compact curve with error < Efind compact curve with error < E

given surface with N vertices:given surface with N vertices:

• find accurate surface with M<N verticesfind accurate surface with M<N vertices

• find compact surface with error < Efind compact surface with error < E

Page 20: Software Structures for Virtual Environments

And how to solve it?

speed vs. quality tradeoffspeed vs. quality tradeoff

refinement vs. decimationrefinement vs. decimation

number of passesnumber of passes

and more...and more...

speed vs. quality tradeoffspeed vs. quality tradeoff

refinement vs. decimationrefinement vs. decimation

number of passesnumber of passes

and more...and more...

Page 21: Software Structures for Virtual Environments

Pyramid / Quadtree

Only useful for height fieldsOnly useful for height fields

Build giant pyramid of pointsBuild giant pyramid of points

When drawing: When drawing:

• at each node, decide if have enough resolutionat each node, decide if have enough resolution

• if not, descend treeif not, descend tree

Very popular for flight sims / gamesVery popular for flight sims / games

Only useful for height fieldsOnly useful for height fields

Build giant pyramid of pointsBuild giant pyramid of points

When drawing: When drawing:

• at each node, decide if have enough resolutionat each node, decide if have enough resolution

• if not, descend treeif not, descend tree

Very popular for flight sims / gamesVery popular for flight sims / games

Page 22: Software Structures for Virtual Environments

Greedy Insertion

Only useful for height fieldsOnly useful for height fields

Start with two big trianglesStart with two big triangles

Until finished:Until finished:

• find point of highest errorfind point of highest error

• insert it into triangulationinsert it into triangulation

Only useful for height fieldsOnly useful for height fields

Start with two big trianglesStart with two big triangles

Until finished:Until finished:

• find point of highest errorfind point of highest error

• insert it into triangulationinsert it into triangulation

Page 23: Software Structures for Virtual Environments

Edge collapse

until finished:until finished:

• find edge whose collapse would bring least errorfind edge whose collapse would bring least error

• collapse edge into vertexcollapse edge into vertex

• position new vertex carefullyposition new vertex carefully

• save sequence of collapses to “undo”save sequence of collapses to “undo”

gives good outputsgives good outputs

until finished:until finished:

• find edge whose collapse would bring least errorfind edge whose collapse would bring least error

• collapse edge into vertexcollapse edge into vertex

• position new vertex carefullyposition new vertex carefully

• save sequence of collapses to “undo”save sequence of collapses to “undo”

gives good outputsgives good outputs

Page 24: Software Structures for Virtual Environments

Airey, Rohlf & Brooks Paper• Precomputation of a Precomputation of a

hierarchical data hierarchical data structure for a structure for a building.building.

• Precomputation of a Precomputation of a hierarchical data hierarchical data structure for a structure for a building.building.

Model is constructedby the architect.

Display Compiler

Display System

ModelGeometry

Happy withDesign

Real-TimeDisplay DataStructures

User inputs forchangingviewpoint.

DesignChanges

Page 25: Software Structures for Virtual Environments

Airey, Rohlf & Brooks Paper - Study of Architectural DBs• The model is changed much less often than the The model is changed much less often than the

viewpoint.viewpoint.

– Means pre-processing the database (display compiler) is Means pre-processing the database (display compiler) is possible.possible.

– We could possibly make changes to the big data structure We could possibly make changes to the big data structure as we added new building components.as we added new building components.

– Perhaps the real-time data structure is updated in parallel. Perhaps the real-time data structure is updated in parallel. During the “think time” of the engineer at the workstation.During the “think time” of the engineer at the workstation.

• The model is changed much less often than the The model is changed much less often than the viewpoint.viewpoint.

– Means pre-processing the database (display compiler) is Means pre-processing the database (display compiler) is possible.possible.

– We could possibly make changes to the big data structure We could possibly make changes to the big data structure as we added new building components.as we added new building components.

– Perhaps the real-time data structure is updated in parallel. Perhaps the real-time data structure is updated in parallel. During the “think time” of the engineer at the workstation.During the “think time” of the engineer at the workstation.

Page 26: Software Structures for Virtual Environments

Airey, Rohlf & Brooks Paper - Study of Architectural DBs• Many buildings have high average depth complexity.Many buildings have high average depth complexity.

– Any image computed from an interior viewpoint Any image computed from an interior viewpoint will have many surfaces covering each pixel.will have many surfaces covering each pixel.

– Much of the model contributes NOTHING to any Much of the model contributes NOTHING to any given image.given image.

• Many buildings have high average depth complexity.Many buildings have high average depth complexity.

– Any image computed from an interior viewpoint Any image computed from an interior viewpoint will have many surfaces covering each pixel.will have many surfaces covering each pixel.

– Much of the model contributes NOTHING to any Much of the model contributes NOTHING to any given image.given image.

Page 27: Software Structures for Virtual Environments

Airey, Rohlf & Brooks Paper - Study of Architectural DBs• Most polygons are axial.Most polygons are axial.

– They are parallel to 2 of the coordinate axes.They are parallel to 2 of the coordinate axes.

– Most polygons are rectangles.Most polygons are rectangles.

• Most polygons are axial.Most polygons are axial.

– They are parallel to 2 of the coordinate axes.They are parallel to 2 of the coordinate axes.

– Most polygons are rectangles.Most polygons are rectangles.

Page 28: Software Structures for Virtual Environments

Airey, Rohlf & Brooks Paper - Study of Architectural DBs• The set of polygons that appears in each view The set of polygons that appears in each view

changes slowly as the viewpoint moves.changes slowly as the viewpoint moves.

– Except when crossing certain thresholds.Except when crossing certain thresholds.

∆ Doors, windows --> portals.Doors, windows --> portals.

• The set of polygons that appears in each view The set of polygons that appears in each view changes slowly as the viewpoint moves.changes slowly as the viewpoint moves.

– Except when crossing certain thresholds.Except when crossing certain thresholds.

∆ Doors, windows --> portals.Doors, windows --> portals.

Page 29: Software Structures for Virtual Environments

Airey, Rohlf & Brooks Paper - Study of Architectural DBs• We can possibly have the notion of a “working set” We can possibly have the notion of a “working set”

of bounding volumes.of bounding volumes.

– Based on a viewpoint.Based on a viewpoint.

– Also see this in the Clark paper.Also see this in the Clark paper.

– We could just incrementally add/subtract We could just incrementally add/subtract branches of our tree based on view point branches of our tree based on view point changes.changes.

• We can possibly have the notion of a “working set” We can possibly have the notion of a “working set” of bounding volumes.of bounding volumes.

– Based on a viewpoint.Based on a viewpoint.

– Also see this in the Clark paper.Also see this in the Clark paper.

– We could just incrementally add/subtract We could just incrementally add/subtract branches of our tree based on view point branches of our tree based on view point changes.changes.

Page 30: Software Structures for Virtual Environments

Airey, Rohlf & Brooks Paper - Study of Architectural DBs• This means that when we organize our data, our This means that when we organize our data, our

data inside one bounding volume should be co-data inside one bounding volume should be co-located in CPU memory.located in CPU memory.

– To make best use of the virtual memory system.To make best use of the virtual memory system.

• This means that when we organize our data, our This means that when we organize our data, our data inside one bounding volume should be co-data inside one bounding volume should be co-located in CPU memory.located in CPU memory.

– To make best use of the virtual memory system.To make best use of the virtual memory system.

Page 31: Software Structures for Virtual Environments

Portals and Viewpoints ...• We have the We have the

notion of notion of viewpoints at viewpoints at portals being portals being indicators that we indicators that we need to swap in need to swap in major new blocks major new blocks of data.of data.

• We have the We have the notion of notion of viewpoints at viewpoints at portals being portals being indicators that we indicators that we need to swap in need to swap in major new blocks major new blocks of data.of data.

Room 1

Room 2 Room 3

x = 1

y = 1

y = 2

v1

v2

v3Blue wall Red wallA

B

Page 32: Software Structures for Virtual Environments

Airey, Rohlf & Brooks Paper - Study of Architectural DBs• Large planar surfaces are often structured into Large planar surfaces are often structured into

multiple, co-planar levels for modeling purposes, multiple, co-planar levels for modeling purposes, shading purposes and realism purposes.shading purposes and realism purposes.

– Large walls that cross several rooms might be stored as Large walls that cross several rooms might be stored as multiple polygons of different color.multiple polygons of different color.

– Perhaps BV-wise, we could use the larger wall better than Perhaps BV-wise, we could use the larger wall better than the smaller components.the smaller components.

– Notion of somehow taking advantage of such dividing Notion of somehow taking advantage of such dividing planes in building our tree structure.planes in building our tree structure.

• Large planar surfaces are often structured into Large planar surfaces are often structured into multiple, co-planar levels for modeling purposes, multiple, co-planar levels for modeling purposes, shading purposes and realism purposes.shading purposes and realism purposes.

– Large walls that cross several rooms might be stored as Large walls that cross several rooms might be stored as multiple polygons of different color.multiple polygons of different color.

– Perhaps BV-wise, we could use the larger wall better than Perhaps BV-wise, we could use the larger wall better than the smaller components.the smaller components.

– Notion of somehow taking advantage of such dividing Notion of somehow taking advantage of such dividing planes in building our tree structure.planes in building our tree structure.

Page 33: Software Structures for Virtual Environments

Airey, Rohlf & Brooks Paper - Study of Architectural DBs• For viewpoints inside the building, the role of surface For viewpoints inside the building, the role of surface

interreflections in shading calculations is very interreflections in shading calculations is very important for spatial comprehension.important for spatial comprehension.

– In the Airey system, there is an adaptive radiosity display In the Airey system, there is an adaptive radiosity display algorithm.algorithm.

– When the viewpoint is not changing, the better radiosity When the viewpoint is not changing, the better radiosity view is displayed.view is displayed.

∆ An adaptive system. Put up more detail when the An adaptive system. Put up more detail when the system is not moving.system is not moving.

• For viewpoints inside the building, the role of surface For viewpoints inside the building, the role of surface interreflections in shading calculations is very interreflections in shading calculations is very important for spatial comprehension.important for spatial comprehension.

– In the Airey system, there is an adaptive radiosity display In the Airey system, there is an adaptive radiosity display algorithm.algorithm.

– When the viewpoint is not changing, the better radiosity When the viewpoint is not changing, the better radiosity view is displayed.view is displayed.

∆ An adaptive system. Put up more detail when the An adaptive system. Put up more detail when the system is not moving.system is not moving.

Page 34: Software Structures for Virtual Environments

Model Space Subdivision• UNC builds its data structures for display with a UNC builds its data structures for display with a

Display compiler.Display compiler.

– Automatically subdivide their database into cells Automatically subdivide their database into cells based on the union of “potentially visible sets” based on the union of “potentially visible sets” (PVS) for any viewpoint in a cell.(PVS) for any viewpoint in a cell.

– Viewpoint position tells which cells to displayViewpoint position tells which cells to display

– That cell contains potentially visible information.That cell contains potentially visible information.

• UNC builds its data structures for display with a UNC builds its data structures for display with a Display compiler.Display compiler.

– Automatically subdivide their database into cells Automatically subdivide their database into cells based on the union of “potentially visible sets” based on the union of “potentially visible sets” (PVS) for any viewpoint in a cell.(PVS) for any viewpoint in a cell.

– Viewpoint position tells which cells to displayViewpoint position tells which cells to display

– That cell contains potentially visible information.That cell contains potentially visible information.

Page 35: Software Structures for Virtual Environments

Model Space Subdivision• A cell is a room plus any potentially visible polygons, A cell is a room plus any potentially visible polygons,

polygons visible through portals.polygons visible through portals.

• Computing PVSs is a hard problem.Computing PVSs is a hard problem.

• For any viewpoint, we must display the polygons for For any viewpoint, we must display the polygons for the room plus any possibly visible ones through any the room plus any possibly visible ones through any doors/portals.doors/portals.

• A cell is a room plus any potentially visible polygons, A cell is a room plus any potentially visible polygons, polygons visible through portals.polygons visible through portals.

• Computing PVSs is a hard problem.Computing PVSs is a hard problem.

• For any viewpoint, we must display the polygons for For any viewpoint, we must display the polygons for the room plus any possibly visible ones through any the room plus any possibly visible ones through any doors/portals.doors/portals.

Page 36: Software Structures for Virtual Environments

Binary Space Partitioning• Airey used a BSP-tree as the data structure for his Airey used a BSP-tree as the data structure for his

building models.building models.

• His paper describes how to automatically choose His paper describes how to automatically choose dividing planes.dividing planes.

• Use the biggest polygon, the ones with the most Use the biggest polygon, the ones with the most occlusion potential.occlusion potential.

• Airey used a BSP-tree as the data structure for his Airey used a BSP-tree as the data structure for his building models.building models.

• His paper describes how to automatically choose His paper describes how to automatically choose dividing planes.dividing planes.

• Use the biggest polygon, the ones with the most Use the biggest polygon, the ones with the most occlusion potential.occlusion potential.

Page 37: Software Structures for Virtual Environments

Binary Space Partitioning

y = 1

x = 1 Room 1

Room 2 Room 3

ViewpointUse the equation of a planein 3-space to determine whichtree branch to follow.

PVS Description:Polygons of the room +polygons visible through portals.

A

B

Room 1

Room 2 Room 3

x = 1

y = 1

y = 2

v1

v2

v3Blue wall Red wallA

B

Page 38: Software Structures for Virtual Environments

Partition Priority for Polygons• One of the key problems in model space subdivision One of the key problems in model space subdivision

is determining which are the best planes for splitting is determining which are the best planes for splitting the geometric database.the geometric database.

• Airey came up with the idea of a “partition priority” for Airey came up with the idea of a “partition priority” for any polygon.any polygon.

• One of the key problems in model space subdivision One of the key problems in model space subdivision is determining which are the best planes for splitting is determining which are the best planes for splitting the geometric database.the geometric database.

• Airey came up with the idea of a “partition priority” for Airey came up with the idea of a “partition priority” for any polygon.any polygon.

partition priorityfor any polygon(used to determinebest plane for splittingthe database.)

= 0.5 * occlusion + 0.3 * balance + 0.2 * split

The biggest knownpolygons with bestocclusion potentialare weighted themost.

BSP-treebalance, i.e.1/2 polygonsare on eachside of thedividing polygon.

Sometimes mustcut polygons bythe dividing plane(want to minimzethat.)

Page 39: Software Structures for Virtual Environments

Summary of Model Subdivision Results

Page 40: Software Structures for Virtual Environments

Optimal Number of Polygons Per Cell?• The number of polygons per cell is determined by:The number of polygons per cell is determined by:

– the graphics hardware’s fill capability the graphics hardware’s fill capability

– by the CPU capability to compute which cells to by the CPU capability to compute which cells to displaydisplay

• The number of polygons per cell is determined by:The number of polygons per cell is determined by:

– the graphics hardware’s fill capability the graphics hardware’s fill capability

– by the CPU capability to compute which cells to by the CPU capability to compute which cells to displaydisplay

Page 41: Software Structures for Virtual Environments

Papers Useful for Walkthrough• (1) 1976 CACM Clark, James H. “Hierarchical (1) 1976 CACM Clark, James H. “Hierarchical

Geometric Models for Visible Surface Algorithms”Geometric Models for Visible Surface Algorithms”

• (2) Fuchs “Near-Real-Time Shaded Display of Rigid (2) Fuchs “Near-Real-Time Shaded Display of Rigid Objects” - BSP-tree fundamentals. SIGGRAPH ?Objects” - BSP-tree fundamentals. SIGGRAPH ?

• (3) Brooks - 1986 Workshop on Interactive 3D (3) Brooks - 1986 Workshop on Interactive 3D Graphics - Early thoughts on walkthroughs. Graphics - Early thoughts on walkthroughs. “Walkthrough - A Dynamic Graphics System for “Walkthrough - A Dynamic Graphics System for Simulating Virtual Buildings”Simulating Virtual Buildings”

• (1) 1976 CACM Clark, James H. “Hierarchical (1) 1976 CACM Clark, James H. “Hierarchical Geometric Models for Visible Surface Algorithms”Geometric Models for Visible Surface Algorithms”

• (2) Fuchs “Near-Real-Time Shaded Display of Rigid (2) Fuchs “Near-Real-Time Shaded Display of Rigid Objects” - BSP-tree fundamentals. SIGGRAPH ?Objects” - BSP-tree fundamentals. SIGGRAPH ?

• (3) Brooks - 1986 Workshop on Interactive 3D (3) Brooks - 1986 Workshop on Interactive 3D Graphics - Early thoughts on walkthroughs. Graphics - Early thoughts on walkthroughs. “Walkthrough - A Dynamic Graphics System for “Walkthrough - A Dynamic Graphics System for Simulating Virtual Buildings”Simulating Virtual Buildings”

Page 42: Software Structures for Virtual Environments

Papers Useful for Walkthrough• (4) Notes on the origin of BSP trees.(4) Notes on the origin of BSP trees.

• (5) Airey, Rohlf & Brooks 1990 Symposium on (5) Airey, Rohlf & Brooks 1990 Symposium on Interactive 3D Graphics paper. “Towards Image Interactive 3D Graphics paper. “Towards Image Realism with Interactive Update Rates in Complex Realism with Interactive Update Rates in Complex Virtual Building Environments”Virtual Building Environments”

• (6) Papers by Funkhouser(6) Papers by Funkhouser

• (7) Paper by Teller & Sequin (SIGGRAPH 93)(7) Paper by Teller & Sequin (SIGGRAPH 93)

• (4) Notes on the origin of BSP trees.(4) Notes on the origin of BSP trees.

• (5) Airey, Rohlf & Brooks 1990 Symposium on (5) Airey, Rohlf & Brooks 1990 Symposium on Interactive 3D Graphics paper. “Towards Image Interactive 3D Graphics paper. “Towards Image Realism with Interactive Update Rates in Complex Realism with Interactive Update Rates in Complex Virtual Building Environments”Virtual Building Environments”

• (6) Papers by Funkhouser(6) Papers by Funkhouser

• (7) Paper by Teller & Sequin (SIGGRAPH 93)(7) Paper by Teller & Sequin (SIGGRAPH 93)

Page 43: Software Structures for Virtual Environments

Real-Time Collision Detection & Response

A Short Survey on Collision DetectionA Short Survey on Collision Detection

It’s explored in the literature of:It’s explored in the literature of:

• computer graphicscomputer graphics

• roboticsrobotics

• computational geometrycomputational geometry

• computer animationcomputer animation

• physically-based modelingphysically-based modeling

A Short Survey on Collision DetectionA Short Survey on Collision Detection

It’s explored in the literature of:It’s explored in the literature of:

• computer graphicscomputer graphics

• roboticsrobotics

• computational geometrycomputational geometry

• computer animationcomputer animation

• physically-based modelingphysically-based modeling

Page 44: Software Structures for Virtual Environments

Real-Time Collision Detection & Response

Numerous approaches:Numerous approaches:

• geometric reasoning[DK90]geometric reasoning[DK90]

• bounding volume hierarchy [Hub96]bounding volume hierarchy [Hub96]

• spatial representation [GASF94, NAT90]spatial representation [GASF94, NAT90]

• numerical methods[Cam97, GJK88]numerical methods[Cam97, GJK88]

• analytical methods[LM95, Sea93]analytical methods[LM95, Sea93]

Numerous approaches:Numerous approaches:

• geometric reasoning[DK90]geometric reasoning[DK90]

• bounding volume hierarchy [Hub96]bounding volume hierarchy [Hub96]

• spatial representation [GASF94, NAT90]spatial representation [GASF94, NAT90]

• numerical methods[Cam97, GJK88]numerical methods[Cam97, GJK88]

• analytical methods[LM95, Sea93]analytical methods[LM95, Sea93]

Page 45: Software Structures for Virtual Environments

Real-Time Collision Detection & Response

However, many of these algorithms do not However, many of these algorithms do not satisfy the demanding requirements of satisfy the demanding requirements of general-purpose collision detection for general-purpose collision detection for networked virtual environments.networked virtual environments.

However, many of these algorithms do not However, many of these algorithms do not satisfy the demanding requirements of satisfy the demanding requirements of general-purpose collision detection for general-purpose collision detection for networked virtual environments.networked virtual environments.

Page 46: Software Structures for Virtual Environments

Real-Time Collision Detection & Response

UNC has developed a mix of algorithms and UNC has developed a mix of algorithms and systems for large interactive environments:systems for large interactive environments:

• I-COLLIDE [CLMP95]I-COLLIDE [CLMP95]

• RAPID [GLM96]RAPID [GLM96]

• V-COLLIDE [HLC + 97]. V-COLLIDE [HLC + 97].

UNC has developed a mix of algorithms and UNC has developed a mix of algorithms and systems for large interactive environments:systems for large interactive environments:

• I-COLLIDE [CLMP95]I-COLLIDE [CLMP95]

• RAPID [GLM96]RAPID [GLM96]

• V-COLLIDE [HLC + 97]. V-COLLIDE [HLC + 97].

Page 47: Software Structures for Virtual Environments

How it WorksBrute force collision detection:Brute force collision detection:

• O(nO(n22) for convex polyhedron: compare each face on object A ) for convex polyhedron: compare each face on object A with each face on object B; then test if any point in A is inside with each face on object B; then test if any point in A is inside of B or vice-versa. of B or vice-versa.

• We do this process every frame!We do this process every frame!

A little better: spatial subdivisionA little better: spatial subdivision

• only compare two objects if they are in same region of spaceonly compare two objects if they are in same region of space

• this isn’t useful for a congested model!this isn’t useful for a congested model!

Brute force collision detection:Brute force collision detection:

• O(nO(n22) for convex polyhedron: compare each face on object A ) for convex polyhedron: compare each face on object A with each face on object B; then test if any point in A is inside with each face on object B; then test if any point in A is inside of B or vice-versa. of B or vice-versa.

• We do this process every frame!We do this process every frame!

A little better: spatial subdivisionA little better: spatial subdivision

• only compare two objects if they are in same region of spaceonly compare two objects if they are in same region of space

• this isn’t useful for a congested model!this isn’t useful for a congested model!

Page 48: Software Structures for Virtual Environments

Too slow?

Use axis-aligned bounding volumes:Use axis-aligned bounding volumes:

• Sort in axial directions, and find pairs which overlap in all 3 Sort in axial directions, and find pairs which overlap in all 3 dimensionsdimensions

To save time, use spatial coherence: use a To save time, use spatial coherence: use a bounding volume big enough to hold the object bounding volume big enough to hold the object at any orientationat any orientation

• That way a spinning object does not require new calculationThat way a spinning object does not require new calculation

Use axis-aligned bounding volumes:Use axis-aligned bounding volumes:

• Sort in axial directions, and find pairs which overlap in all 3 Sort in axial directions, and find pairs which overlap in all 3 dimensionsdimensions

To save time, use spatial coherence: use a To save time, use spatial coherence: use a bounding volume big enough to hold the object bounding volume big enough to hold the object at any orientationat any orientation

• That way a spinning object does not require new calculationThat way a spinning object does not require new calculation

Page 49: Software Structures for Virtual Environments

Problem childrenWhat about non-convex objects?What about non-convex objects?

• Start with convex objects: divide or convex hullStart with convex objects: divide or convex hull

• If convex versions collide, then must compare non-convex If convex versions collide, then must compare non-convex versions...versions...

• … … then we’re back to brute forcethen we’re back to brute force

What about non-convex objects?What about non-convex objects?

• Start with convex objects: divide or convex hullStart with convex objects: divide or convex hull

• If convex versions collide, then must compare non-convex If convex versions collide, then must compare non-convex versions...versions...

• … … then we’re back to brute forcethen we’re back to brute force

Page 50: Software Structures for Virtual Environments

Real-Time Collision Detection & Response

Public domain code is available for ftp at Public domain code is available for ftp at http://www.cs.unc.edu/~geom http://www.cs.unc.edu/~geom

Netherlands research team has similar Netherlands research team has similar system: SOLIDsystem: SOLID

http://www.win.tue.nl/cs/tt/gino/solid/.http://www.win.tue.nl/cs/tt/gino/solid/.

Public domain code is available for ftp at Public domain code is available for ftp at http://www.cs.unc.edu/~geom http://www.cs.unc.edu/~geom

Netherlands research team has similar Netherlands research team has similar system: SOLIDsystem: SOLID

http://www.win.tue.nl/cs/tt/gino/solid/.http://www.win.tue.nl/cs/tt/gino/solid/.

Page 51: Software Structures for Virtual Environments

Real-Time Collision Detection & Response

ReferencesReferences

[Cam97] S. Cameron. Enhancing gjk: Computing minimum [Cam97] S. Cameron. Enhancing gjk: Computing minimum and penetration distance between convex polyhedra. and penetration distance between convex polyhedra. Proceedings of International Conference on Robotics and Proceedings of International Conference on Robotics and Automation, 1997.Automation, 1997.

[CLMP95] J. Cohen, M. Lin, D. Manocha, and M. Ponamgi. I-[CLMP95] J. Cohen, M. Lin, D. Manocha, and M. Ponamgi. I-collide: An interactive and exact collision detection system collide: An interactive and exact collision detection system for large-scale environments. In Proc. of ACM Interactive 3D for large-scale environments. In Proc. of ACM Interactive 3D Graphics Conference, pages 189{196, 1995.Graphics Conference, pages 189{196, 1995.

ReferencesReferences

[Cam97] S. Cameron. Enhancing gjk: Computing minimum [Cam97] S. Cameron. Enhancing gjk: Computing minimum and penetration distance between convex polyhedra. and penetration distance between convex polyhedra. Proceedings of International Conference on Robotics and Proceedings of International Conference on Robotics and Automation, 1997.Automation, 1997.

[CLMP95] J. Cohen, M. Lin, D. Manocha, and M. Ponamgi. I-[CLMP95] J. Cohen, M. Lin, D. Manocha, and M. Ponamgi. I-collide: An interactive and exact collision detection system collide: An interactive and exact collision detection system for large-scale environments. In Proc. of ACM Interactive 3D for large-scale environments. In Proc. of ACM Interactive 3D Graphics Conference, pages 189{196, 1995.Graphics Conference, pages 189{196, 1995.

Page 52: Software Structures for Virtual Environments

Real-Time Collision Detection & Response

[DK90] D. P. Dobkin and D. G. Kirkpatrick. Determining [DK90] D. P. Dobkin and D. G. Kirkpatrick. Determining the separation of pre-processed polyhedra { A uni ed the separation of pre-processed polyhedra { A uni ed approach. In Proc. 17th Intl. Colloq. Automata Lang. approach. In Proc. 17th Intl. Colloq. Automata Lang. Program., volume 443 of Lecture Notes Comput. Sci., Program., volume 443 of Lecture Notes Comput. Sci., pages 400-413. Springer-Verlag, 1990.pages 400-413. Springer-Verlag, 1990.

[GASF94] A. Garcia-Alonso, N. Serrano, and J. Flaquer. [GASF94] A. Garcia-Alonso, N. Serrano, and J. Flaquer. Solving the collision detection problem. IEEE Comput. Solving the collision detection problem. IEEE Comput. Graph. Appl., 14:36{43, May 1994.Graph. Appl., 14:36{43, May 1994.

[DK90] D. P. Dobkin and D. G. Kirkpatrick. Determining [DK90] D. P. Dobkin and D. G. Kirkpatrick. Determining the separation of pre-processed polyhedra { A uni ed the separation of pre-processed polyhedra { A uni ed approach. In Proc. 17th Intl. Colloq. Automata Lang. approach. In Proc. 17th Intl. Colloq. Automata Lang. Program., volume 443 of Lecture Notes Comput. Sci., Program., volume 443 of Lecture Notes Comput. Sci., pages 400-413. Springer-Verlag, 1990.pages 400-413. Springer-Verlag, 1990.

[GASF94] A. Garcia-Alonso, N. Serrano, and J. Flaquer. [GASF94] A. Garcia-Alonso, N. Serrano, and J. Flaquer. Solving the collision detection problem. IEEE Comput. Solving the collision detection problem. IEEE Comput. Graph. Appl., 14:36{43, May 1994.Graph. Appl., 14:36{43, May 1994.

Page 53: Software Structures for Virtual Environments

Real-Time Collision Detection & Response

[GJK88] E. G. Gilbert, D. W. Johnson, and S. S. Keerthi. [GJK88] E. G. Gilbert, D. W. Johnson, and S. S. Keerthi. A fast procedure for computing the distance between A fast procedure for computing the distance between objects in three-dimensional space. IEEE J. Robotics objects in three-dimensional space. IEEE J. Robotics and Automation, vol RA-4:193{203, 1988.and Automation, vol RA-4:193{203, 1988.

[GLM96] S. Gottschalk, M. Lin, and D. Manocha. Obb-[GLM96] S. Gottschalk, M. Lin, and D. Manocha. Obb-tree: A hierarchical structure for rapid interference tree: A hierarchical structure for rapid interference detection. In Proc. of ACM Siggraph'96, pages 171{180, detection. In Proc. of ACM Siggraph'96, pages 171{180, 1996.1996.

[GJK88] E. G. Gilbert, D. W. Johnson, and S. S. Keerthi. [GJK88] E. G. Gilbert, D. W. Johnson, and S. S. Keerthi. A fast procedure for computing the distance between A fast procedure for computing the distance between objects in three-dimensional space. IEEE J. Robotics objects in three-dimensional space. IEEE J. Robotics and Automation, vol RA-4:193{203, 1988.and Automation, vol RA-4:193{203, 1988.

[GLM96] S. Gottschalk, M. Lin, and D. Manocha. Obb-[GLM96] S. Gottschalk, M. Lin, and D. Manocha. Obb-tree: A hierarchical structure for rapid interference tree: A hierarchical structure for rapid interference detection. In Proc. of ACM Siggraph'96, pages 171{180, detection. In Proc. of ACM Siggraph'96, pages 171{180, 1996.1996.

Page 54: Software Structures for Virtual Environments

Real-Time Collision Detection & Response

[HLC+97] T. Hudson, M. Lin, J. Cohen, S. Gottschalk, [HLC+97] T. Hudson, M. Lin, J. Cohen, S. Gottschalk, and D. Manocha. V-collide: Accelerated collision and D. Manocha. V-collide: Accelerated collision detection for vrml. In Proc. of VRML Conference, pages detection for vrml. In Proc. of VRML Conference, pages 119{125, 1997.119{125, 1997.

[Hub96] P. M. Hubbard. Approximating polyhedra with [Hub96] P. M. Hubbard. Approximating polyhedra with spheres for time-critical collision detection. ACM Trans. spheres for time-critical collision detection. ACM Trans. Graph., 15(3):179{210, July 1996.Graph., 15(3):179{210, July 1996.

[HLC+97] T. Hudson, M. Lin, J. Cohen, S. Gottschalk, [HLC+97] T. Hudson, M. Lin, J. Cohen, S. Gottschalk, and D. Manocha. V-collide: Accelerated collision and D. Manocha. V-collide: Accelerated collision detection for vrml. In Proc. of VRML Conference, pages detection for vrml. In Proc. of VRML Conference, pages 119{125, 1997.119{125, 1997.

[Hub96] P. M. Hubbard. Approximating polyhedra with [Hub96] P. M. Hubbard. Approximating polyhedra with spheres for time-critical collision detection. ACM Trans. spheres for time-critical collision detection. ACM Trans. Graph., 15(3):179{210, July 1996.Graph., 15(3):179{210, July 1996.