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

Introduction to 2D and 3D Computer Graphics …web.cecs.pdx.edu/~karlaf/CS447_Slides/Set10.pdf · Realistic Rendering-- Solids Modeling --Introduction to 2D and 3D Computer Graphics

Embed Size (px)

Citation preview

Page 1: Introduction to 2D and 3D Computer Graphics …web.cecs.pdx.edu/~karlaf/CS447_Slides/Set10.pdf · Realistic Rendering-- Solids Modeling --Introduction to 2D and 3D Computer Graphics

CS447/547 10- 1

Realistic Rendering

-- Solids Modeling --

Introduction to 2D and 3DComputer Graphics

Page 2: Introduction to 2D and 3D Computer Graphics …web.cecs.pdx.edu/~karlaf/CS447_Slides/Set10.pdf · Realistic Rendering-- Solids Modeling --Introduction to 2D and 3D Computer Graphics

CS447/547 10- 2

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

rotational sweeps

Building Realistic...Objects using solid modeling

Page 3: Introduction to 2D and 3D Computer Graphics …web.cecs.pdx.edu/~karlaf/CS447_Slides/Set10.pdf · Realistic Rendering-- Solids Modeling --Introduction to 2D and 3D Computer Graphics

CS447/547 10- 3

Translational sweeps...

– ...are a simple sweep defined by a 2D area

swept along a linear path normal to the plan of

the area, creating a volume

Rotational sweeps...

– ...are defined by rotating around a 2D area

about an axis

Building Realistic...Objects using solid modeling

Page 4: Introduction to 2D and 3D Computer Graphics …web.cecs.pdx.edu/~karlaf/CS447_Slides/Set10.pdf · Realistic Rendering-- Solids Modeling --Introduction to 2D and 3D Computer Graphics

CS447/547 10- 4

Building Realistic...Objects using solid modeling

2D area Translation sweep Rotational sweep

Page 5: Introduction to 2D and 3D Computer Graphics …web.cecs.pdx.edu/~karlaf/CS447_Slides/Set10.pdf · Realistic Rendering-- Solids Modeling --Introduction to 2D and 3D Computer Graphics

CS447/547 10- 5

Quadric surfaces...

– ...are defined by quadratic equations in two-

dimensional space

– ...for example, can be spheres and cones

– ...are also called surfaces of revolution, since a

finite curve in two dimensions is swept in three-

dimensional space about one axis to create the

surface

Building Realistic...Objects using solid modeling

Page 6: Introduction to 2D and 3D Computer Graphics …web.cecs.pdx.edu/~karlaf/CS447_Slides/Set10.pdf · Realistic Rendering-- Solids Modeling --Introduction to 2D and 3D Computer Graphics

CS447/547 10- 6

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

RenderMan™ always uses the z axis as the axis

of rotation, with a sweep angle...

– ...sweeping a quadric by less then 360 degrees leaves

an open surface

Building Realistic...Objects using solid modeling

Page 7: Introduction to 2D and 3D Computer Graphics …web.cecs.pdx.edu/~karlaf/CS447_Slides/Set10.pdf · Realistic Rendering-- Solids Modeling --Introduction to 2D and 3D Computer Graphics

CS447/547 10- 7

• Example quadric surfaces...

Cone

Sphere

Cylinder

Torus

Disk

Building Realistic...Objects using solid modeling

Page 8: Introduction to 2D and 3D Computer Graphics …web.cecs.pdx.edu/~karlaf/CS447_Slides/Set10.pdf · Realistic Rendering-- Solids Modeling --Introduction to 2D and 3D Computer Graphics

CS447/547 10- 8

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 3D equivalents of

simple 2D

Building Realistic...Objects using solid modeling

Page 9: Introduction to 2D and 3D Computer Graphics …web.cecs.pdx.edu/~karlaf/CS447_Slides/Set10.pdf · Realistic Rendering-- Solids Modeling --Introduction to 2D and 3D Computer Graphics

CS447/547 10- 9

Building Realistic...Objects using solid modeling

Two intersectingcubes

Unionoperation

Intersectionoperation

Differenceoperation:Bottom-Top

Differenceoperation:Top-Bottom

Page 10: Introduction to 2D and 3D Computer Graphics …web.cecs.pdx.edu/~karlaf/CS447_Slides/Set10.pdf · Realistic Rendering-- Solids Modeling --Introduction to 2D and 3D Computer Graphics

CS447/547 10- 10

Using ordinary Boolean set operators, not

all intersections form solid objects...

– ...they may instead form a plane, a line...

Building Realistic...Objects using solid modeling

Two intersecting cubesproducing a plane

Two intersecting cubesproducing a solid Two intersecting cubes

producing a line

Page 11: Introduction to 2D and 3D Computer Graphics …web.cecs.pdx.edu/~karlaf/CS447_Slides/Set10.pdf · Realistic Rendering-- Solids Modeling --Introduction to 2D and 3D Computer Graphics

CS447/547 10- 11

• Or...they may instead form a point or be

null

Building Realistic...Objects using solid modeling

Two intersecting cubesproducing a point

Two cubes producing a null set

Page 12: Introduction to 2D and 3D Computer Graphics …web.cecs.pdx.edu/~karlaf/CS447_Slides/Set10.pdf · Realistic Rendering-- Solids Modeling --Introduction to 2D and 3D Computer Graphics

CS447/547 10- 12

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:

Building Realistic...Objects using solid modeling

Two intersecting cubesproducing a null set

Two intersecting cubesproducing a solid Two intersecting cubes

producing a null set

Page 13: Introduction to 2D and 3D Computer Graphics …web.cecs.pdx.edu/~karlaf/CS447_Slides/Set10.pdf · Realistic Rendering-- Solids Modeling --Introduction to 2D and 3D Computer Graphics

CS447/547 10- 13

Building Realistic...Objects using solid modeling

Two intersecting cubesagain producing a null set

Two cubes producing a null set

Page 14: Introduction to 2D and 3D Computer Graphics …web.cecs.pdx.edu/~karlaf/CS447_Slides/Set10.pdf · Realistic Rendering-- Solids Modeling --Introduction to 2D and 3D Computer Graphics

CS447/547 10- 14

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

Building Realistic...Objects using solid modeling

Two simple sweeps of2D objects (triangles) How these objects

would look whenoverlapping

The result ofa union operation;it can no longerbe thought of asa simple sweep

Page 15: Introduction to 2D and 3D Computer Graphics …web.cecs.pdx.edu/~karlaf/CS447_Slides/Set10.pdf · Realistic Rendering-- Solids Modeling --Introduction to 2D and 3D Computer Graphics

CS447/547 10- 15

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

Building Realistic...Objects using solid modeling

Page 16: Introduction to 2D and 3D Computer Graphics …web.cecs.pdx.edu/~karlaf/CS447_Slides/Set10.pdf · Realistic Rendering-- Solids Modeling --Introduction to 2D and 3D Computer Graphics

CS447/547 10- 16

Boundary representations...

Building Realistic...Objects using solid modeling

Face

Notice in this case,there is an edgethat has neighboringpoints from 4 facesthat does not createa topological disk

Edge

Vertex

This object has boundariesthat are 2-manifold: each point on a face has a neighborhood of surrounding points that is a topological disk

Page 17: Introduction to 2D and 3D Computer Graphics …web.cecs.pdx.edu/~karlaf/CS447_Slides/Set10.pdf · Realistic Rendering-- Solids Modeling --Introduction to 2D and 3D Computer Graphics

CS447/547 10- 17

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

Building Realistic...Objects using solid modeling

Page 18: Introduction to 2D and 3D Computer Graphics …web.cecs.pdx.edu/~karlaf/CS447_Slides/Set10.pdf · Realistic Rendering-- Solids Modeling --Introduction to 2D and 3D Computer Graphics

CS447/547 10- 18

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

Building Realistic...Objects using solid modeling

5 Faces

9 Edges

6 Vertice

Example simply polyhedrawhere V-E+F=2

8 Faces

14 Edges

8 Vertice6 Faces

12 Edges

8 Vertice

Page 19: Introduction to 2D and 3D Computer Graphics …web.cecs.pdx.edu/~karlaf/CS447_Slides/Set10.pdf · Realistic Rendering-- Solids Modeling --Introduction to 2D and 3D Computer Graphics

CS447/547 10- 19

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

Building Realistic...Objects using solid modeling

Page 20: Introduction to 2D and 3D Computer Graphics …web.cecs.pdx.edu/~karlaf/CS447_Slides/Set10.pdf · Realistic Rendering-- Solids Modeling --Introduction to 2D and 3D Computer Graphics

CS447/547 10- 20

Boundary representations of polyhedra

with holes...

Building Realistic...Objects using solid modeling

15 Faces

36 Edges

24 Vertice

3 Holes (1 of them is in thebottom face) 1 Separate Parts

1 Genus

A polyhedron with a holepassing through the object

Page 21: Introduction to 2D and 3D Computer Graphics …web.cecs.pdx.edu/~karlaf/CS447_Slides/Set10.pdf · Realistic Rendering-- Solids Modeling --Introduction to 2D and 3D Computer Graphics

CS447/547 10- 21

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

Building Realistic...Objects using solid modeling

Page 22: Introduction to 2D and 3D Computer Graphics …web.cecs.pdx.edu/~karlaf/CS447_Slides/Set10.pdf · Realistic Rendering-- Solids Modeling --Introduction to 2D and 3D Computer Graphics

CS447/547 10- 22

Solid objects can be formed with spatial-

partitioning using...

– ...cell decomposition

– ...spatial-occupancy enumeration

– ...octrees and quadtrees, etc.

Building Realistic...Objects using solid modeling

Page 23: Introduction to 2D and 3D Computer Graphics …web.cecs.pdx.edu/~karlaf/CS447_Slides/Set10.pdf · Realistic Rendering-- Solids Modeling --Introduction to 2D and 3D Computer Graphics

CS447/547 10- 23

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

Building Realistic...Objects using solid modeling

Page 24: Introduction to 2D and 3D Computer Graphics …web.cecs.pdx.edu/~karlaf/CS447_Slides/Set10.pdf · Realistic Rendering-- Solids Modeling --Introduction to 2D and 3D Computer Graphics

CS447/547 10- 24

Cell decomposition...

Building Realistic...Objects using solid modeling

Three simple primitives:called cells

Keep in mind with this method, thatthe complex object can be created using cells in more than one way...

Page 25: Introduction to 2D and 3D Computer Graphics …web.cecs.pdx.edu/~karlaf/CS447_Slides/Set10.pdf · Realistic Rendering-- Solids Modeling --Introduction to 2D and 3D Computer Graphics

CS447/547 10- 25

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

occupied cells

Building Realistic...Objects using solid modeling

Page 26: Introduction to 2D and 3D Computer Graphics …web.cecs.pdx.edu/~karlaf/CS447_Slides/Set10.pdf · Realistic Rendering-- Solids Modeling --Introduction to 2D and 3D Computer Graphics

CS447/547 10- 26

Spatial-occupancy enumeration...

Building Realistic...Objects using solid modeling

Page 27: Introduction to 2D and 3D Computer Graphics …web.cecs.pdx.edu/~karlaf/CS447_Slides/Set10.pdf · Realistic Rendering-- Solids Modeling --Introduction to 2D and 3D Computer Graphics

CS447/547 10- 27

Octrees...

– ...are a hierarchical way to use voxels

– ...are designed to reduce the storage

requirements of the spatial-occupancy

enumeration approach

– ...are derived from 2D quadtrees...and expanded

to 3D

Building Realistic...Objects using solid modeling

Page 28: Introduction to 2D and 3D Computer Graphics …web.cecs.pdx.edu/~karlaf/CS447_Slides/Set10.pdf · Realistic Rendering-- Solids Modeling --Introduction to 2D and 3D Computer Graphics

CS447/547 10- 28

Quadtrees...

– ...successively subdivide a 2D 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

full or empty

Building Realistic...Objects using solid modeling

Page 29: Introduction to 2D and 3D Computer Graphics …web.cecs.pdx.edu/~karlaf/CS447_Slides/Set10.pdf · Realistic Rendering-- Solids Modeling --Introduction to 2D and 3D Computer Graphics

CS447/547 10- 29

Building Realistic...Objects using solid modeling

• Quadtrees...

Cells (voxels) using spatial-occupancyenumeration

Cells using quadtrees

Page 30: Introduction to 2D and 3D Computer Graphics …web.cecs.pdx.edu/~karlaf/CS447_Slides/Set10.pdf · Realistic Rendering-- Solids Modeling --Introduction to 2D and 3D Computer Graphics

CS447/547 10- 30

Building Realistic...Objects using solid modeling

0 1

32

0

Empty

Full

Full

Empty

Full

Full

Empty

For example...

0

0

1

13

32

0

1

3

2

01 2

3

Page 31: Introduction to 2D and 3D Computer Graphics …web.cecs.pdx.edu/~karlaf/CS447_Slides/Set10.pdf · Realistic Rendering-- Solids Modeling --Introduction to 2D and 3D Computer Graphics

CS447/547 10- 31

Octrees...

– ...are three dimensional quadtrees

– ...its three dimensions are recursively subdivided

into octants

– ...have quadrants:

Building Realistic...Objects using solid modeling

Page 32: Introduction to 2D and 3D Computer Graphics …web.cecs.pdx.edu/~karlaf/CS447_Slides/Set10.pdf · Realistic Rendering-- Solids Modeling --Introduction to 2D and 3D Computer Graphics

CS447/547 10- 32

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

Building Realistic...Objects using solid modeling

Page 33: Introduction to 2D and 3D Computer Graphics …web.cecs.pdx.edu/~karlaf/CS447_Slides/Set10.pdf · Realistic Rendering-- Solids Modeling --Introduction to 2D and 3D Computer Graphics

CS447/547 10- 33

Boolean set operators can also apply to both

quadtrees and octrees...

– ...by traversing the two trees in parallel

Building Realistic...Objects using solid modeling

Object #1 Object #2 Union operation Intersectionoperation

Page 34: Introduction to 2D and 3D Computer Graphics …web.cecs.pdx.edu/~karlaf/CS447_Slides/Set10.pdf · Realistic Rendering-- Solids Modeling --Introduction to 2D and 3D Computer Graphics

CS447/547 10- 34

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

Building Realistic...Objects using solid modeling

Page 35: Introduction to 2D and 3D Computer Graphics …web.cecs.pdx.edu/~karlaf/CS447_Slides/Set10.pdf · Realistic Rendering-- Solids Modeling --Introduction to 2D and 3D Computer Graphics

CS447/547 10- 35

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,

replacing, and modifying subtrees)

Building Realistic...Objects using solid modeling

Page 36: Introduction to 2D and 3D Computer Graphics …web.cecs.pdx.edu/~karlaf/CS447_Slides/Set10.pdf · Realistic Rendering-- Solids Modeling --Introduction to 2D and 3D Computer Graphics

CS447/547 10- 36

Building Realistic...Objects using solid modeling

Union

Union, RotateTranslate

Union, RotateTranslate

• A CSG example:

Page 37: Introduction to 2D and 3D Computer Graphics …web.cecs.pdx.edu/~karlaf/CS447_Slides/Set10.pdf · Realistic Rendering-- Solids Modeling --Introduction to 2D and 3D Computer Graphics

CS447/547 10- 37

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)

Building Realistic...Objects using solid modeling: summary

Page 38: Introduction to 2D and 3D Computer Graphics …web.cecs.pdx.edu/~karlaf/CS447_Slides/Set10.pdf · Realistic Rendering-- Solids Modeling --Introduction to 2D and 3D Computer Graphics

CS447/547 10- 38

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 spatial-

occupancy enumeration methods

Building Realistic...Objects using solid modeling: summary

Page 39: Introduction to 2D and 3D Computer Graphics …web.cecs.pdx.edu/~karlaf/CS447_Slides/Set10.pdf · Realistic Rendering-- Solids Modeling --Introduction to 2D and 3D Computer Graphics

CS447/547 10- 39

Compactness and efficiency...

– ...are best achieved using CSG, since it is compact

and able to record Boolean operations and

transformations quickly

Building Realistic...Objects using solid modeling: summary