290 likes | 298 Vues
Advanced Computer Graphics: Constructive Modelling. James Gain Department of Computer Science University of Cape Town jgain@cs.uct.ac.za. Objectives. To introduce a range of modelling techniques Curves and Surfaces Surfaces of Revolution Generalized Cylinders Spatial Deformation
E N D
Advanced Computer Graphics:Constructive Modelling James Gain Department of Computer ScienceUniversity of Cape Town jgain@cs.uct.ac.za Advanced Computer GraphicsCollaborative Visual Computing Laboratory
Objectives • To introduce a range of modelling techniques • Curves and Surfaces • Surfaces of Revolution • Generalized Cylinders • Spatial Deformation • Volumetric Techniques • Constructive Solid Geometry • To consider Constructive Solid Geometry in detail • To discuss graphics in the “real world” Advanced Computer Graphics
Modelling a Sword Advanced Computer Graphics
Modelling Techniques • Building polygon mesh models by hand is infeasible. • Need modelling techniques which are: • Versatile (great variety of achievable shapes) • Usable (easy to understand controls and specify shapes) • Suitable for particular texturing, rendering and animation purposes • Compact (low space consumption) • Efficient (interrogation algorithms execute rapidly) • How are shapes modelled in practice? Advanced Computer Graphics
Parametric Surfaces • A bi-parametric surface is a rectangular function of two variables and , which produces a point on the surface. • Shape is governed by control points, which either interpolate or approximate the surface. • Objects are created by joining the edges of surfaces. Like stitching together rubber sheets. • Very widespread technique but has problems with joins and topology. Advanced Computer Graphics
Surfaces of Revolution • Circular symmetric objects. • 3D surface created by revolving a 2D profile curve around an axis of rotation in space. • Closed profile curves generate closed surfaces. • Examples: • Circular cylinder - The profile is a line segment parallel but not coincident with the axis of rotation. The closed version requires a rectangle. • Truncated cone - The line segment profile is slanted with respect to the axis. Advanced Computer Graphics
Surfaces of Revolution • Further examples: • Torus - The profile is a circle inset in a plane aligned with the axis. • Complex circularly symmetric shapes - employ a Bézier or B-spline profile. Advanced Computer Graphics
Generalized Cylinders • Extrusion: sweep a 2D shape along a (non-circular) path. • Some objects can be generated by extrusion or revolution. e.g. a cylinder (an extruded circle or a revolved line). • Generalized cylinders extend the concept of extrusions and surfaces of revolution to the extreme. • Total control over all sweep parameters. • But can produce degeneracies, e.g. self-intersection. Advanced Computer Graphics
Generalized Cylinder Parameters • Can vary: • Cross Section – 2D shape does not have to be a circle and can change shape as it is swept. • Sweep Path – path does not have to be a straight line or revolution, can be any space curve. • Twist – the cross section can be rotated as it moves along the path • Scale – the size of the cross section can change along the path • Normal vector direction – usually the vector normal to the cross section points along the path, but even this can be varied • And any other parameters. Advanced Computer Graphics
Spatial Deformation • Principle: • Indirectly deform an object by warping the surrounding space. • Jelly metaphor: • A shape is set within a block of jelly. • Flexing the jelly results in a corres- ponding distortion of the shape. • Mechanism: • Object vertices are embedded in a parametric hyperpatch, which is a 3D generalization of curves. Advanced Computer Graphics
Volumetric Techniques • Spatial Occupancy Enumeration: Objects are constructed Lego-like from adjoining simple solids. • Often restricted to cubes. These Voxels (Volume Elements) are the 3D analog of square Pixels (Picture Elements) • Objects for Biomedical Applications: • Medical Scans (CT, MRI) produce image slices with a regular grid of sample values (for skin, bone, muscle, etc). • The isosurface at a particular isovalue is very difficult to visualize from separate 2D scans. • Can be converted to a Polygon-Mesh using the famous Marching Cubes algorithm. Advanced Computer Graphics
Implicit (Blobby) Objects • Blobby (or Soft) objects are used to create and animate smooth shapes. • Use implicit rather then parametric surfaces. • A skeleton is defined by a set of key points, which radiate energy to the surrounding space. • The object boundary is an isosurface at a particular energy level. • The position and orientation of keys can be animated. Advanced Computer Graphics
Constructive Solid Geometry • Constructive Solid Geometry (CSG) consists of regularized boolean set operations on closed 3D objects. Sphere (A) and Parallelepiped (B) Intersection Union Difference Advanced Computer Graphics
Validity • Ordinary Boolean set operations may not yield a solid. For instance, the intersection of two cubes can produce a solid, a plane, a line, a point or null. • For robustness we require set operations which take valid closed objects as input and produce a valid closed solid as output. • Regularization (* notation) ensures this B B B B A A A A Advanced Computer Graphics
Regularization • Object can be partitioned into interior and boundary points. • Boundary occurs where distance from the object and its complement is zero • Exterior = Space – Interior – Boundary. • Problems: • Boundary points need not be part of an object. Closure prevents this by forming the union of a set with its boundary. • Dangling boundaries are part of an object but not adjacent to any interior. Regularization prevents this by forming the closure of the interior. Advanced Computer Graphics
Regularization Example • KEY: • Boundary • (within object) • Boundary • (outside object) • Interior Nasty Object Closure Interior Regularization Advanced Computer Graphics
B Set Op Components A i = interior b = boundary Advanced Computer Graphics
Regularized Boolean Set Ops Advanced Computer Graphics
Constructive Solid Geometry • Constructive Solid Geometry (CSG) is an effective means of storing and interrogating complex objects • Objects stored as a tree: • Leaf nodes are usually closed primitives. Sometimes half-spaces are used, e.g. cube is the intersection of six half-spaces. Although useful these may cause validity problems. • Internal nodes are Boolean operations, affine transformations or deformations. • Ordering of edges is important because set ops are not all commutative • Evaluated using a depth first walk Advanced Computer Graphics
CSG Example Advanced Computer Graphics
CSG: Ray Intersections • Ray tracing requires the calculation of points of intersection between an object and ray. • Solution: intersect arguments and ray, track inside/outside status along ray, points are retained according to lookup table. Advanced Computer Graphics
Exercise: CSG-Ray Intersection • Question: create the CSG intersection lookup table for the set operation • Answer: Advanced Computer Graphics
CSG Summary • A compact representation • Easy to manipulate • Regularized Boolean Set Operations depend on the complexity of the arguments and can be expensive. • Intuitive but can sometimes be confusing since there are many different ways of achieving the same shape. • Sometimes supported by a particular rendering architectures. Advanced Computer Graphics
Exercise: Constructive Modelling • Specify the steps required for construction of the jug pictured below. Note: some stages can be achieved in several different ways. Advanced Computer Graphics
1. 2. 3. 4. Constructive Modelling Solution • Jug - Surface of Revolution • Handle - Extruded Ellipse • Spout - Spatial Deformation • Combination - Union of Deformed Jug and Handle Advanced Computer Graphics
Versatility • Representing Complex Shapes: • Creases: is it possible to introduce creases and corners? • Smoothness: can continuity be guaranteed where required? • Topology: are complex topologies (with a variety of holes) possible? Advanced Computer Graphics
Usability • Some desirable ease-of-use properties in modelling (c.f. HCI) • Closeness of mapping (between problem and solution) • Simplicity (“make things as simple as possible but no simpler”). • Consistency (similar operations are expressed in a similar way). • Flexibility (technique does not require experience but does rewards it) • Interactive Feedback (shape updates immediately) • Fluidity (easy to make modelling changes) • Reversibility (undo changes) • Order Independence (can design operations be done in any order) • Direct manipulation (there is no indirection in control of the shape). • Some are properties of the modelling system rather than the underlying technique. • CSG, blobby objects and generalized cylinders are relatively intuitive (hide mathematical underpinnings). Advanced Computer Graphics
Suitability for Renderingand Animation • Rendering: • Polygon scan conversion requires that all representations be converted to a polygon mesh. • Ray tracing requires ray-object intersection tests. • Animation: • Requires controls which allow the shape to vary over time. • Best Match: • Ray Tracing: CSG. • Polygon Scan Conversion: parametric surfaces and generalized cylinders. • Animation: blobby objects, spatial deformation. • Space Economy: • Most representations are compact (before conversion to Polygon Mesh) except volumetric objects. Advanced Computer Graphics
Beyond the Ivory Tower • CAD/CAM: • Parametric surfaces and Constructive Solid Geometry. • Visualization: • Volumetric techniques for Biomedical applications. • Simulation, 3D Games: • Any technique amenable to pre-processed conversion to polygon-mesh and which produces low polygon counts. • Often use decimation techniques to reduce number of polygons. • Film: • Almost all techniques (surfaces - “Geri’s Game”, “Toy Story 2”, blobby objects - “Flubber”). • But, often model objects in clay and then laser scan directly to polygon mesh (“Star Wars”, “Godzilla”). Advanced Computer Graphics