Introduction to 2 D and 3 D Computer

  • Slides: 39
Download presentation
Introduction to 2 D and 3 D Computer Graphics Realistic Rendering -- Solids Modeling

Introduction to 2 D and 3 D Computer Graphics Realistic Rendering -- Solids Modeling -- CS 447/547 10 - 1

Building Realistic. . . Objects using solid modeling § Solid objects can be defined.

Building Realistic. . . Objects using solid modeling § Solid objects can be defined. . . –. . . by sweeping an object along a trajectory through space –. . . this process is called extrusion § Extrusion. . . –. . . is a natural way to represent objects made of extruding metal or plastics with cross-sections visible –. . . can be performed using translational sweeps or CS 447/547 10 - 2 rotational sweeps

Building Realistic. . . Objects using solid modeling § Translational sweeps. . . –.

Building Realistic. . . Objects using solid modeling § Translational sweeps. . . –. . . are a simple sweep defined by a 2 D area swept along a linear path normal to the plan of the area, creating a volume § Rotational sweeps. . . –. . . are defined by rotating around a 2 D area about an axis CS 447/547 10 - 3

Building Realistic. . . Objects using solid modeling 2 D area CS 447/547 10

Building Realistic. . . Objects using solid modeling 2 D area CS 447/547 10 - 4 Translation sweep Rotational sweep

Building Realistic. . . Objects using solid modeling § Quadric surfaces. . . –.

Building Realistic. . . Objects using solid modeling § Quadric surfaces. . . –. . . are defined by quadratic equations in twodimensional space –. . . for example, can be spheres and cones –. . . are also called surfaces of revolution, since a finite curve in two dimensions is swept in threedimensional space about one axis to create the surface CS 447/547 10 - 5

Building Realistic. . . Objects using solid modeling § Quadric surfaces. . . –.

Building Realistic. . . Objects using solid modeling § Quadric surfaces. . . –. . . where a circle centered on the origin forms a sphere, otherwise it forms a torus –. . . where a line with one end on the axis of rotation forms a cone, a line parallel to the axis of rotation forms a cylinder § Render. Man™ always uses the z axis as the axis of rotation, with a sweep angle. . . –. . . sweeping a quadric by less then 360 degrees leaves CS 447/547 10 -an 6 open surface

Building Realistic. . . Objects using solid modeling • Example quadric surfaces. . .

Building Realistic. . . Objects using solid modeling • Example quadric surfaces. . . Torus Sphere Cone CS 447/547 10 - 7 Disk Cylinder

Building Realistic. . . Objects using solid modeling § To make a realistic image.

Building Realistic. . . Objects using solid modeling § To make a realistic image. . . –. . . objects must be able to be combined § One of the most popular ways for combining objects. . . –. . . is with Boolean set operators –. . . using union, difference, and intersection § Boolean set operators are 3 D equivalents of simple 2 D CS 447/547 10 - 8

Building Realistic. . . Objects using solid modeling Two intersecting cubes CS 447/547 10

Building Realistic. . . Objects using solid modeling Two intersecting cubes CS 447/547 10 - 9 Union operation Intersection operation Difference operation: Bottom-Top Difference operation: Top-Bottom

Building Realistic. . . Objects using solid modeling § Using ordinary Boolean set operators,

Building Realistic. . . Objects using solid modeling § Using ordinary Boolean set operators, not all intersections form solid objects. . . –. . . they may instead form a plane, a line. . . Two intersecting cubes producing a solid CS 447/547 10 - 10 Two intersecting cubes producing a plane Two intersecting cubes producing a line

Building Realistic. . . Objects using solid modeling • Or. . . they may

Building Realistic. . . Objects using solid modeling • Or. . . they may instead form a point or be null Two intersecting cubes producing a point CS 447/547 10 - 11 Two cubes producing a null set

Building Realistic. . . Objects using solid modeling § Using regularized Boolean set operators,

Building Realistic. . . Objects using solid modeling § Using regularized Boolean set operators, only solid objects or null sets are formed. . . –. . . let's look at the same set of examples using regularized operators: Two intersecting cubes producing a solid CS 447/547 10 - 12 Two intersecting cubes producing a null set

Building Realistic. . . Objects using solid modeling Two intersecting cubes again producing a

Building Realistic. . . Objects using solid modeling Two intersecting cubes again producing a null set CS 447/547 10 - 13 Two cubes producing a null set

Building Realistic. . . Objects using solid modeling § Solid objects created with sweeps

Building Realistic. . . Objects using solid modeling § Solid objects created with sweeps can be manipulated using Boolean set operations. . . –. . . by first converting the objects into boundary representations, spatial-partitioning representations, or constructive solid geometry Two simple sweeps of 2 D objects (triangles) CS 447/547 10 - 14 How these objects would look when overlapping The result of a union operation; it can no longer be thought of as a simple sweep

Building Realistic. . . Objects using solid modeling § Boundary representations. . . –.

Building Realistic. . . Objects using solid modeling § Boundary representations. . . –. . . are called b-reps –. . . describe objects in terms of their surface boundaries: vertices, edges, and faces –. . . are generally restricted to be planar, with polygonal boundaries and convex faces –. . . are generally restricted to be 2 -manifolds: this means that support is not provided when there are more than 2 faces sharing an edge and neighboring points on each of the faces are not continuous CS 447/547 10 - 15

Building Realistic. . . Objects using solid modeling § Boundary representations. . . Face

Building Realistic. . . Objects using solid modeling § Boundary representations. . . Face Vertex Edge CS 447/547 10 - 16 This object has boundaries that are 2 -manifold: each point on a face has a neighborhood of surrounding points that is a topological disk Notice in this case, there is an edge that has neighboring points from 4 faces that does not create a topological disk

Building Realistic. . . Objects using solid modeling § Boundary representations of simple polyhedra.

Building Realistic. . . Objects using solid modeling § Boundary representations of simple polyhedra. . . – are described by Euler's formula –. . . are solids bounded by a set of polygons, but can be deformed into a sphere and has no holes –. . . follow the rules: Vertices-Edges+Faces=2 CS 447/547 10 - 17

Building Realistic. . . Objects using solid modeling § To guarantee that a solid

Building Realistic. . . Objects using solid modeling § To guarantee that a solid volume is created. . . –. . . each edge must connect to two vertices and be shared by exactly two faces, –. . . at least three edges must meet at each vertex, and –. . . faces must not interpenetrate one another 5 Faces 6 Vertice 9 Edges CS 447/547 10 - 18 8 Vertice 6 Faces 8 Vertice 12 Edges Example simply polyhedra where V-E+F=2 14 Edges

Building Realistic. . . Objects using solid modeling § Boundary representations of polyhedra with

Building Realistic. . . Objects using solid modeling § Boundary representations of polyhedra with holes. . . –. . . are described by a generalization of Euler's formul –. . . Vertices-Edges+Faces-Holes=2(Separateparts-Genus) –. . . where Holes describes the # of holes in the faces –. . . where Genus describes the # of holes that pass through the object –. . . where Separate parts describe the # of separate components in the object CS 447/547 10 - 19

Building Realistic. . . Objects using solid modeling § Boundary representations of polyhedra with

Building Realistic. . . Objects using solid modeling § Boundary representations of polyhedra with holes. . . 3 Holes (1 of them is in the bottom face) 15 Faces 1 Separate Parts 1 Genus 24 Vertice A polyhedron with a hole passing through the object 36 Edges CS 447/547 10 - 20

Building Realistic. . . Objects using solid modeling § Spatial-partitioning representations. . . –.

Building Realistic. . . Objects using solid modeling § Spatial-partitioning representations. . . –. . . describe objects as collections of adjoining nonintersecting solids § Spatial-partitioning creates collections of solids that. . . –. . . may or may not be the same type as the original object –. . . are like building blocks –. . . can vary in type, size, position, parameterization, and orientation CS 447/547 10 - 21

Building Realistic. . . Objects using solid modeling § Solid objects can be formed

Building Realistic. . . Objects using solid modeling § Solid objects can be formed with spatialpartitioning using. . . –. . . cell decomposition –. . . spatial-occupancy enumeration –. . . octrees and quadtrees, etc. CS 447/547 10 - 22

Building Realistic. . . Objects using solid modeling § Cell decomposition. . . –.

Building Realistic. . . Objects using solid modeling § Cell decomposition. . . –. . is a popular form of spatial-partitioning –. . . composes complex objects from simple primitives in a bottom-up fashion by gluing them together! (like a union but without objects intersecting) –. . . composes objects from cells, where any two cells must share a single point, edge, or face CS 447/547 10 - 23

Building Realistic. . . Objects using solid modeling § Cell decomposition. . . Three

Building Realistic. . . Objects using solid modeling § Cell decomposition. . . Three simple primitives: called cells CS 447/547 10 - 24 Keep in mind with this method, that the complex object can be created using cells in more than one way. . .

Building Realistic. . . Objects using solid modeling § Spatial-occupancy enumeration. . . –.

Building Realistic. . . Objects using solid modeling § Spatial-occupancy enumeration. . . –. . . is a special case of cell decomposition –. . . defines objects using identical cells arrayed in a fixed and regular grid (called voxels) –. . . most commonly uses a cube cell type –. . . only controls whether or not a cell is present or absent in every cell in a grid –. . . no other controls are defined –. . . creates unique and unambiguous list of CS 447/547 10 - 25 occupied cells

Building Realistic. . . Objects using solid modeling § Spatial-occupancy enumeration. . . CS

Building Realistic. . . Objects using solid modeling § Spatial-occupancy enumeration. . . CS 447/547 10 - 26

Building Realistic. . . Objects using solid modeling § Octrees. . . –. .

Building Realistic. . . Objects using solid modeling § Octrees. . . –. . . are a hierarchical way to use voxels –. . . are designed to reduce the storage requirements of the spatial-occupancy enumeration approach –. . . are derived from 2 D quadtrees. . . and expanded to 3 D CS 447/547 10 - 27

Building Realistic. . . Objects using solid modeling § Quadtrees. . . –. .

Building Realistic. . . Objects using solid modeling § Quadtrees. . . –. . . successively subdivide a 2 D plane in both dimensions –. . . where each quadrant is full, partly full, or empty depending on how much of the complex object intersects the area –. . . where partly full quadrants are recursively subdivided –. . . and subdivision continues until all cells are CS 447/547 10 - 28 full or empty

Building Realistic. . . Objects using solid modeling • Quadtrees. . . Cells (voxels)

Building Realistic. . . Objects using solid modeling • Quadtrees. . . Cells (voxels) using spatial-occupancy enumeration CS 447/547 10 - 29 Cells using quadtrees

Building Realistic. . . Objects using solid modeling 2 3 0 1 For example.

Building Realistic. . . Objects using solid modeling 2 3 0 1 For example. . . 2 3 0 1 0 3 3 Full 0 Empty 0 1 2 1 Full 0 Empty 3 1 Full CS 447/547 10 - 30 2 Empty Full

Building Realistic. . . Objects using solid modeling § Octrees. . . –. .

Building Realistic. . . Objects using solid modeling § Octrees. . . –. . . are three dimensional quadtrees –. . . its three dimensions are recursively subdivided into octants –. . . have quadrants: CS 447/547 10 - 31

Building Realistic. . . Objects using solid modeling § § Octrees. . . The

Building Realistic. . . Objects using solid modeling § § Octrees. . . The number of nodes in a quadtree or octree is proportional to the object's perimeter or surface, respectively –. . . this is because subdivision occurs only from the need to represent an object's boundary –. . . therefore, subdivision only occurs in those quadrants where a boundary passes CS 447/547 10 - 32

Building Realistic. . . Objects using solid modeling § Boolean set operators can also

Building Realistic. . . Objects using solid modeling § Boolean set operators can also apply to both quadtrees and octrees. . . –. . . by traversing the two trees in parallel CS 447/547 10 - 33 Object #1 Object #2 Union operation Intersection operation

Building Realistic. . . Objects using solid modeling § Constructive solid geometry (CSG). .

Building Realistic. . . Objects using solid modeling § Constructive solid geometry (CSG). . . –. . . describes objects in terms of regularized Boolean set operators (as part of their representation) –. . . stores objects in a tree with operators at the internal nodes and simple primitives at the leaves –. . . allows nodes to represent Boolean operators, translation, rotation, or scaling CS 447/547 10 - 34

Building Realistic. . . Objects using solid modeling § Some implementations limit the primitives

Building Realistic. . . Objects using solid modeling § Some implementations limit the primitives to be simple solids -- like cubes or spheres. . . –. . . other implementations allow objects that aren't even completely bounded volumes! These are useful for slicing an object by a plane § CSG does not provide unique representation. . . – and therefore can be confusing for systems that allow "leaf" editing (for adding, deleting, CS 447/547 10 - 35 replacing, and modifying subtrees)

Building Realistic. . . Objects using solid modeling • A CSG example: Union, Rotate

Building Realistic. . . Objects using solid modeling • A CSG example: Union, Rotate Translate CS 447/547 10 - 36

Building Realistic. . . Objects using solid modeling: summary § Accuracy. . . –.

Building Realistic. . . Objects using solid modeling: summary § Accuracy. . . –. . . is best achieved by CSG that allows for curved surfaces –. . . is only approximated using spatial-partitioning and polygonal b-rep methods § The variety of objects represented. . . –. . . is best achieved using spatial-partitioning since they can represent any solid (even if it is an approximation) CS 447/547 10 - 37

Building Realistic. . . Objects using solid modeling: summary § The variety of objects

Building Realistic. . . Objects using solid modeling: summary § The variety of objects represented. . . –. . . can also be achieved using b-reps, if they provide faces and edges in addition to polygons bounded by straight lines –. . . is limited using sweeps § Uniqueness. . . –. . . can be guaranteed only using octree and spatialoccupancy enumeration methods CS 447/547 10 - 38

Building Realistic. . . Objects using solid modeling: summary § Compactness and efficiency. .

Building Realistic. . . Objects using solid modeling: summary § Compactness and efficiency. . . –. . . are best achieved using CSG, since it is compact and able to record Boolean operations and transformations quickly CS 447/547 10 - 39