object representations

25
Computer Graphics Object Representations Object Representations Taher S. Taher S.

Upload: taher-saifuddin

Post on 13-Jan-2015

2.127 views

Category:

Technology


0 download

DESCRIPTION

 

TRANSCRIPT

Page 1: Object representations

Computer Graphics

Object RepresentationsObject Representations

Taher S.Taher S.

Object RepresentationsObject Representations

Taher S.Taher S.

Page 2: Object representations

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, we now learn how to polygon on the screen, we now learn how to represent them efficiently using appropriate data represent them efficiently using appropriate data structures.structures.

• 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, we now learn how to polygon on the screen, we now learn how to represent them efficiently using appropriate data represent them efficiently using appropriate data structures.structures.

Page 3: Object representations

Types of Objects

Polygon Surfaces (Order =1)Polygon Surfaces (Order =1)

Quadric Surfaces (Order <=2)Quadric Surfaces (Order <=2)

SphereSphere

EllipsoidEllipsoid

TorusTorus

Curved Lines and Surfaces (Order <=3)Curved Lines and Surfaces (Order <=3)

Spline RepresentationsSpline Representations

Polygon Surfaces (Order =1)Polygon Surfaces (Order =1)

Quadric Surfaces (Order <=2)Quadric Surfaces (Order <=2)

SphereSphere

EllipsoidEllipsoid

TorusTorus

Curved Lines and Surfaces (Order <=3)Curved Lines and Surfaces (Order <=3)

Spline RepresentationsSpline Representations

Page 4: Object representations

Object Representation Methods

Boundary Representations (B-reps)Boundary Representations (B-reps)

The B-reps describes a 3D object as a set of surfaces that The B-reps describes a 3D object as a set of surfaces that separate the object interior from the environmentseparate the object interior from the environment

Space PartitioningSpace Partitioning

The Space partitioning representation describes interior The Space partitioning representation describes interior properties by partitioning the spatial region containing an object properties by partitioning the spatial region containing an object into a set of small, non-overlapping, contiguous solids.into a set of small, non-overlapping, contiguous solids.

Boundary Representations (B-reps)Boundary Representations (B-reps)

The B-reps describes a 3D object as a set of surfaces that The B-reps describes a 3D object as a set of surfaces that separate the object interior from the environmentseparate the object interior from the environment

Space PartitioningSpace Partitioning

The Space partitioning representation describes interior The Space partitioning representation describes interior properties by partitioning the spatial region containing an object properties by partitioning the spatial region containing an object into a set of small, non-overlapping, contiguous solids.into a set of small, non-overlapping, contiguous solids.

Page 5: Object representations

Types of Data Structures

Polygon TablesPolygon Tables

Plane EquationsPlane Equations

Polygon MeshesPolygon Meshes

BSP Trees BSP Trees

OctreesOctrees

Polygon TablesPolygon Tables

Plane EquationsPlane Equations

Polygon MeshesPolygon Meshes

BSP Trees BSP Trees

OctreesOctrees

Page 6: Object representations

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

Page 7: Object representations

BSP Trees: Objects

Page 8: Object representations

BSP Trees: Objects

Page 9: Object representations

BSP Trees: Objects

Page 10: Object representations

BSP Trees: Objects

Page 11: Object representations

BSP Trees: Objects

Page 12: Object representations

Rendering BSP Trees

Page 13: Object representations

Rendering BSP Trees

Page 14: Object representations

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

Page 15: Object representations

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

Page 16: Object representations

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

Page 17: Object representations

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

Page 18: Object representations

Quadric Surfaces:

• SphereSphere

• EllipsoidEllipsoid

• TorusTorus

• ParaboloidParaboloid

• HyperboloidHyperboloid

• SphereSphere

• EllipsoidEllipsoid

• TorusTorus

• ParaboloidParaboloid

• HyperboloidHyperboloid

Page 19: Object representations

Sphere:

Cartesian form:

Parametric Form:

Page 20: Object representations

Ellipsoid:

Cartesian form:

Parametric Form:

Page 21: Object representations

Clifford Torus

Turning a punctured torus

inside-out

Torus:

Page 22: Object representations

As the distance to the axis of revolution decreases, the ring torus becomes a spindle torus and

then degenerates into a sphere.

Page 23: Object representations

Cartesian form:

Parametric Form:Red arrow :  φ Blue arrow : θ

Page 24: Object representations

Paraboloid:

Page 25: Object representations

Hyperboloid:

One -SheetTwo- Sheet