computer graphics
play

Computer Graphics Si Lu Fall 2017 - PowerPoint PPT Presentation

Computer Graphics Si Lu Fall 2017 http://web.cecs.pdx.edu/~lusi/CS447/CS447_547_Comp uter_Graphics.htm 11/15/2017 Last time o Polygon Mesh and Modeling 2 Today o Modeling Technologies o Final Exam: 2:00-3:30, Novermber 29, 2017 3 Modeling


  1. Computer Graphics Si Lu Fall 2017 http://web.cecs.pdx.edu/~lusi/CS447/CS447_547_Comp uter_Graphics.htm 11/15/2017

  2. Last time o Polygon Mesh and Modeling 2

  3. Today o Modeling Technologies o Final Exam: 2:00-3:30, Novermber 29, 2017 3

  4. Modeling Techniques o Obtaining polygonal meshes o Hierarchical modeling o Instancing and Parametric Instancing o Constructive Solid Geometry o Sweep Objects o Subdivision

  5. So you need a mesh… o Buy it (or find a free one) Free meshes typically are not very good quality n o User defined: A user builds the mesh n Tools help with specifying many vertices and faces quickly n Take any user-friendly modeling technique, and extract a mesh representation from it o Scan a real object n 3D probe-based systems n Range finders o Image based reconstruction Take a bunch of pictures, and infer the object’s shape n

  6. Scanning in Action http://www-graphics.stanford.edu/projects/mich/

  7. Meshes from Scanning o Laser scanners sample 3D positions One method uses triangulation n Another method uses time of flight n n Some take images also for use as textures n Famous example: Scanning the David o Software then takes thousands of points and builds a polygon mesh out of them o Research topics: n Reduce the number of points in the mesh Reconstruction and re-sampling! n

  8. Consumer Depth Cameras o Microsoft Kinect I n Stereo triangulation 8 Image source: https://fabrizio89.wordpress.com/kinect-1-generation/

  9. Consumer Depth Cameras o Microsoft Kinect I n Stereo triangulation o Intel creative depth camera (early version) n Time of flight 9 http://futuristicnews.com/will-intels-creative-camera-enable-computer-read-the-users-intentions/

  10. Level Of Detail o There is no point in having more than 1 polygon per pixel Or a few, if anti-aliasing n o Level of detail strategies attempt to balance the resolution of the mesh against the viewing conditions n Must have a way to reduce the complexity of meshes Must have a way to switch from one mesh to another n An ongoing research topic, made even more important as laser n scanning becomes popular n Also called mesh decimation, multi-resolution modeling and other things

  11. Level of Detail http://www.cs.unc.edu/~geom/SUCC_MAP/

  12. Problems with Polygons o They are inherently an approximation Things like silhouettes can never be perfect without very n large numbers of polygons, and corresponding expense Normal vectors are not specified everywhere n o Interaction is a problem n Dragging points around is time consuming Maintaining things like smoothness is difficult n o Low level representation n Eg: Hard to increase, or decrease, the resolution n Hard to extract information like curvature

  13. More Object Representations o Hierarchical modeling o Instancing and Parametric Instancing o Constructive Solid Geometry o Sweep Objects o Subdivision o …

  14. Hierarchical Modeling o Hierarchical model: Group of meshes related by a tree (or graph) structure n Properties of children are derived from their parents n Most useful for animating polygonal meshes o Consider a walking (humanoid, classic) robot: n How would you move the robot around? n Does the entire robot move in the same way? Does the position of one part of the robot n depend on other parts?

  15. Hierarchical Model Example Move body Draw body Important Point: •Every node has its own local coordinate system. left arm l •This makes specifying Rotate about shoulder Draw upper arm transformations much much easier. Translate (l,0,0) Rotate about origin of lower arm Draw lower arm

  16. Hierarchical Details o Generally represented as a tree, with transformations and instances at any node Can use a general graph, but resolving inheritance conflicts is a n problem o Rendered by traversing the tree, applying the transformations, and rendering the instances o Particularly useful for animation n Human is a hierarchy of body, head, upper arm, lower arm, etc… n Animate by changing the transformations at the nodes o Other things can be inherited (colors, surface properties)

  17. OpenGL Support o OpenGL defines glPushMatrix() and glPopMatrix() Takes the current matrix and pushes it onto a stack, or pops the n matrix off the top of the stack and makes it the current matrix n Note: Pushing does not change the current matrix o Rendering a hierarchy (recursive): RenderNode(tree) glPushMatrix() Apply node transformation Draw node contents RenderNode(children) glPopMatrix()

  18. Instancing o Sometimes you need many copies of the “same” object Like chairs in a room n o Define one chair, the base or the prototype o Create many instances (copies) of it, and apply a different transformation to each o Appears in scene description languages (Renderman, Inventor) as “defining” a label for an object o Advantages?

  19. OpenGL Support o OpenGL defines display lists for encapsulating commands that are executed frequently list_id = glGenLists(1); glNewList(list_id, GL_COMPILE); glBegin(GL_TRIANGLES); draw some stuff glEnd(); glEndList(); And later glCallList(list_id);

  20. More Display Lists o Almost any command can go in a display list Viewing transformation set-up n Lighting set-up n n Surface property set-up o But some things can’t Causes strange bugs – always check that a command can go in n a display list o The list can be: n GL_COMPILE : things don’t get drawn, just stored n GL_COMPILE_AND_EXECUTE : things are drawn, and also stored

  21. Display Lists Good/Bad o You should use display lists when: n You do the same thing over and over again n The commands are supported n Nothing changes about the way you do it o Advantages: n Can’t be much slower than the original way n Can be much faster o Disadvantages: Can’t use various commands that would offer other speedups n o For example, can’t use glVertexPointer()

  22. Parametric Instancing o Many things, called primitives, are conveniently described by a label and a few parameters Cylinder: Radius, length, does it have end-caps, … n n Bolts: length, diameter, thread pitch, … n Other examples? o This is a modeling format: Provide software that knows how to draw the object given the n parameters, or knows how to produce a polygonal mesh n How you manage the model depends on the rendering style n Can be an exact representation

  23. Rendering Instances o Generally, provide a routine that takes the parameters and produces a polygonal representation Conveniently brings parametric instancing into the rendering n pipeline n May include texture maps, normal vectors, colors, etc n OpenGL utility library (glu) defines routines for cubes, cylinders, disks, and other common shapes n Renderman does similar things, so does POVray, … o The procedure may be dynamic n For example, adjust the polygon resolution according to distance from the viewer

  24. Constructive Solid Geometry (CSG) o Based on a tree structure, like hierarchical modeling, but now: The internal nodes are set operations: union, intersection or n difference (sometimes complement) The edges of the tree have transformations associated with them n n The leaves contain only geometry o Allows complex shapes with only a few primitives Common primitives are cylinders, cubes, etc, or quadric surfaces n o Motivated by computer aided design and manufacture n Difference is like drilling or milling A common format in CAD products n

  25. Constructive Solid Geometry (CSG) https://en.wikipedia.org/wiki/Constructive_solid_geometry

  26. Constructive Solid Geometry (CSG) https://en.wikipedia.org/wiki/Constructive_solid_geometry

  27. Sweep Objects o Define a polygon by its edges Sweep it along a path o o The path taken by the edges form a surface - the sweep surface o Special cases n Surface of revolution: Rotate edges about an axis n Extrusion: Sweep along a straight line

  28. Rendering Sweeps o Convert to polygons Break path into short segments n Create a copy of the sweep polygon at each segment n n Join the corresponding vertices between the polygons n May need things like end-caps on surfaces of revolution and extrusions o Normals come from sweep polygon and path orientation o Sweep polygon defines one texture parameter, sweep path defines the other

  29. A Circular Tube (A torus) o What do we sweep, along what path? Vector3 points[2][8]; int start_i = 0; int end_i = 1; for ( int i = 0 ; i < 8 ; i++ ) points[start_i][i] = TorusPoint (7,i); for ( int j = 0 ; j < 8 ; j++ ) { glBegin(GL_TRIANGLE_STRIP); for ( int i = 0 ; i < 8 ; i++ ) { glVertex3fv(points[start_i][i]); points[end_i][i] = TorusPoint (j, i); glVertex3fv(points[end_i][i]); } glVertex3fv(points[start_i][0]); //close the loop glVertex3fv(points[end_i][0]); glEnd(); int temp = start_i; start_i = end_i; end_i = temp; }

  30. General Sweeps o The path maybe any curve o The polygon that is swept may be transformed as it is moved along the path n Scale, rotate with respect to path orientation, … o One common way to specify is: Give a poly-line (sequence of line segments) as the path n n Give a poly-line as the shape to sweep n Give a transformation to apply at the vertex of each path segment o Difficult to avoid self-intersection

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend