1 / 73

Computer Graphics

Explore the process of creating 3D objects through different modeling techniques and representations, including polygonal modeling, CSG, spatial subdivision, implicit representation, and parametric patches.

annyang
Download Presentation

Computer Graphics

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Computer Graphics Modeling

  2. Modeling • Modeling is simply the process of creating 3D objects • Many different processes to create models • Many different representations of model data • Once the models are obtained, one can transform them to the correct locations in space, place a virtual camera in space, and render a 2D image of the scene

  3. Model Representations • Polygonal • CSG (constructive solid geometry) • Spatial subdivision techniques • Implicit representation • Parametric patches

  4. Polygonal • Complex objects arebroken down intomany simple polygons • Polygons form the “skin” of the object • Objects are hollow • Polygons have a front face and a back face

  5. Triangles • Triangles are the #1 choice of polygons • They are always planar • Graphics hardware is often optimized for triangles • Nvidia TNT2  8M triangles per second • Nvidia Geforce2  31M triangles per second • Nvidia Geforce4  136M vertices per second • Note: Don’t read too much into these numbers. They are similar to processor speed numbers in that they don’t tell the whole story of how fast the computer actually is.

  6. Triangulation • How are triangles obtained? • Triangulating a set of surface points • Several different triangulation approaches • Delaunay triangulations attempt to equalize triangle angles (reduces long skinny triangles)

  7. How Many Triangles? • More triangles are needed in surface areas that require more geometric detail • Higher curvature  more triangles necessary

  8. Level Of Detail (LOD) • It can be very costly to always display an entire object at the greatest level of detail • Less detail is necessary the farther away you are from on object • Also depends on the viewing angle and screen size • Solution: create several models of the object at different levels of detail • Display the correct one for the viewing distance

  9. LOD 50 Vertices 500 Vertices 2000 Vertices

  10. LOD

  11. LOD • How to create the same model in multiple levels of detail? • Ex: start with most detailed, resample with less vertices, and then re-triangulate • When to switch models when rendering? • Based on distance and screen size • Ex: 640x480 screen  307,200 pixels Object takes up half of screen  150K pixels  Any more than 300K triangles (half are facing away from the camera) is overkill at this distance and screen size • Visual artifacts can occur at switching point

  12. Creating the Surface Points • Triangulation works on a set of points • One needs to create this surface point set • Many different approaches: • Manual placement • Mathematical (geometrical) generation • Scanning real objects

  13. Mathematical Generation • Solids of Revolution • Rotation of a cross-section around an axis • Spheres • Cones • Cylinders • Bundt cakes?

  14. Mathematical Generation • Extrusion • Extrude a cross-section along a profile curve • Scale may vary along the profile • Many metal and plastic parts • Cones • Cylinders • Bottles

  15. Scanning Real Objects • Laser scanning • Tomographic methods • Medical scanning (Xray, CT, MRI) • Radar Recovered 3D model Hand-held laser scanner Slice of brain from CT scan Recovered 3D model of lungs

  16. Scanning Real Objects • Computer vision Actual photograph of Hoover Tower Recovered 3D model Model rendered from novel view and texture mapped

  17. Triangle Representations • Graphics cards do most of the triangle work • Need an efficient way to send triangles to the card • Some typical primitive triangle representations: • Lists • Fans • Strips 1.6 vertices per triangle 1.5 vertices per triangle 3.0 vertices per triangle

  18. Triangle Representations • Adding a level of indirection with indexed triangle representations • Store the vertices (in a vertex buffer) independently of the rendering order (which is stored in a index buffer) • Enables one to reuse a vertex multiple times without sending 3 coordinates each time • Conventional wisdom is that indexed triangle strips are the most efficient triangle representation

  19. Surface Normal • Each triangle has a single surface normal • Easy way to defines the orientation of the surface • Again, the normal is just a vector (no position) C N A B

  20. Computing the Surface Normal • Let V1 be the vector from point A to point B • Let V2 be the vector from point A to point C • N = V1x V2 • N is often normalized • Note that order of vertices becomes important • Triangle ABC has an outward facing normal • Triangle ACB has an inward facing normal C N A B

  21. Modeling Approaches • Polygonal • CSG (constructive solid geometry) • Spatial subdivision techniques • Implicit representation • Parametric patches

  22. Constructive Solid Geometry • Unlike polygonal approaches, CSG models are “solids” • Polygonal models are “skins” • Solid approaches are often better suited for medical applications because • Cutting slices through objects • Representing internal functional data • Temperature • Blood flow

  23. CSG Trees • CSG models are stored in trees • Leaves are primitive shapes • Spheres, Cubes, Cones, etc. • Nodes are Boolean operations • Union, Difference, Intersection

  24. CSG Operations • Primitives: • Union: • Intersection: • Difference:

  25. CSG Rendering • CSG models can be rendered by: • Computing surface points and triangulating • Rendering can then be performed by standard hardware • Use of special CSG rendering routines • Not hardware optimized

  26. Modeling Approaches • Polygonal • CSG (constructive solid geometry) • Spatial subdivision techniques • Implicit representation • Parametric patches

  27. Spatial subdivision techniques • The idea is to divide up space into pieces that are the object are pieces that are not the object • A “solid” approach to modeling • Usually pieces are cubes • Amount of detail that can be represented is controlled by how small the cubes are

  28. 2D Images • B/W images • Image is evenly divided up into pixels • Pixels size controls the level of detail • Pixels are on/off to represent presence/absence of object • Representation designed for ease of blitting onto screen, not for efficient data representation

  29. 2D Quad Trees • Quad trees adaptively subdivide the image • Subdivision can continue until the required level of detail is reached • Significantly more efficient than using a 2D block of uniform small squares

  30. 3D Space Subdivision • Voxels are the 3D extension of pixels • Again, the brute-force approach is to fill 3D space with uniform small voxels and mark the space as occupied or empty

  31. Octrees • Octrees are the 3D extension of quad trees and use adaptive subdivision

  32. Modeling Approaches • Polygonal • CSG (constructive solid geometry) • Spatial subdivision techniques • Implicit representation • Parametric patches

  33. Implicit Representation • An implicit definition of a sphere: x2 + y2 + z2 = r2 • Defines a type of “isosurface” • A set of 3D points that satisfy the equation • However, they are difficult to work with • Quickly tell me all the points that satisfy the above equation given a particular value of r

  34. Metaballs • Metaballs (a.k.a. blobby objects) are an implicit modeling technique

  35. Metaballs in Action • Implicit representations find most of the use in shape changing animations

  36. Modeling Approaches • Polygonal • CSG (constructive solid geometry) • Spatial subdivision techniques • Implicit representation • Parametric patches

  37. Parametric Patches • Parametric patches are used to model smooth curved surfaces and to allow dynamic control over the shape of the surface • Parametric patches are uses heavily in CAD application and animation • Currently real-time applications are dominated by triangle meshes • Patches hold many advantages over triangle meshes and if hardware support for them becomes widespread there could be a major shift to them

  38. Parametric Patches • One of the first uses of parametric patches is the “Utah Teapot” • The actual teapot is on the left

  39. Parametric Patches • We will start be examining curves • Bézier curves • B-Spline curves • Then we will expand to surface patches • Bézier patches • B-Spline patches

  40. Bézier Curves • Pierre Bézier, a French designer, first used them in the 1970’s in the design of Renault car bodies • Since, they have been heavily used by Adobe in their fonts as well as in graphic applications • A Bézier curve is a parametric curve • The function C(u) defines the curve points (x, y, z) as the parameter u varies through [0..1]

  41. Bézier Curves • The space curve C(u) is defined by: C(u) = i0..N Pi Bi (u) where the Pi are the control points and the Bi(u) are the blending functions

  42. Bézier Curves • The control points are simply 3D points • The blending functions are defined as: Bi(u) = N ui (1 – u)N-i i • Most of the time, the cubic version is used (n=3) • This implies 4 control points are needed and 4 blending functions: B0(u) = (1 – u)3 B1(u) = 3u (1 – u)2 B2(u) = 3u2 (1 – u) B3(u) = u3

  43. Bézier Curves • The blending functions make much more sense graphically • Note that t in the graph below is our u

  44. Bézier Curves • Due to the setup of the blending functions: • The curve goes through the end points • control points P0 and P3 • The curve doesn’t go through the interior control points • The interior control influence the curve • The curve is pulled in the direction of the control point • Moving a control point changes the shape of the entire curve (called global control)

  45. Bézier Curves • A Bézier Curve can only “curve” as much as its degree allows • Degree 1 (linear) is a line • Degree 2 (quadratic) can curve once • Degree 3 (cubic) can curve twice • Recall that the number of control points is always 1 larger than the degree

  46. Bézier Curves • So what if you want a really “curvy” curve? • You could increase the degree of the curve • The downfall of this approach is that each control point has global control over the curve shape • That is, changing a single control point will modify the shape of the entire curve (not great for modeling) • High degree curves are “unstable” • It is computationally expensive • You could join multiple cubic curves together • Each control point only has influence over its piece of the curve (local control w.r.t. the entire joined curve) • Hardware can be optimized for cubic curves • But, we must maintain continuity across the joins!

  47. Bézier Curves • So how are we going to maintain continuity? • Notice that the line between the first 2 control points specify the tangent of the curve at u=0 • And the line between the last 2 control points specify the tangent of the curve at u=1

  48. Bézier Curves • So if we line up P2P3 with Q0Q1, then we have the same tangent at end u=1 point of curve P and u=0 point of curve Q

  49. Bézier Curves • Continuity put into more formal terms: • C0 continuity means the curve points vary smoothly • That is, the curve is a set of connected points • For our joined example, it means the two joined segments share the same endpoints • P3 is the same point as Q0 • C1 continuity means the curve’s first derivatives vary smoothly (plus C0 continuity) • For our joined example, it means the tangents at the end endpoints must be the same (P2, P3, Q0, Q1 must form a line) • And P0, P1 must form a line with the curve before it and Q2, Q3 must form a line with the curve after it  all 4 control points are constrained to some extent

  50. Bézier Curves • C2 continuity means the curve’s second derivatives vary smoothly (plus C1 continuity) • Second derivative corresponds to curvature • For our joined example, it implies constrains on P1, P2, P3, Q0, Q1, and Q2 • Plus P0, P1, and P2 are constrained from the curve before it and Q1, Q2, and Q3 are constrained from the curve after it • Thus, although it can be achieved, there are so many constrains on the positions of the control points that joined cubic Bézier curves are almost never C2 continuous

More Related