Learning Objectives 3D Object Representations 3D Object Representations Polyhedron Polyhedron Quadrics, SuperQuadrics Quadrics, SuperQuadrics Spline, Bezier.

April 5, 2018 | Author: Anonymous | Category: Documents
Report this link


Description

Slide 1Learning Objectives 3D Object Representations 3D Object Representations Polyhedron Polyhedron Quadrics, SuperQuadrics Quadrics, SuperQuadrics Spline, Bezier Spline, Bezier Blobby Blobby Constructive Solid Geometry Constructive Solid Geometry Slide 23D Object Representations Graphics scenes melibatkan berbagai jenis objek dan material surfaces Graphics scenes melibatkan berbagai jenis objek dan material surfaces Trees, flowers, clouds, rocks, water, bricks, wood paneling, rubber, paper, marble, steel, glass, plastic, etc. Trees, flowers, clouds, rocks, water, bricks, wood paneling, rubber, paper, marble, steel, glass, plastic, etc. Bagaimana merepresentasikan objek 3D pada openGL? Bagaimana merepresentasikan objek 3D pada openGL? Slide 33D Object Representations Untuk merepresentasikan objek 3D, ada beberapa teknik Untuk merepresentasikan objek 3D, ada beberapa teknik Menggunakan polygon dan quadric untuk membuat objek seperti polyhedrons ataupun ellipsoids Menggunakan polygon dan quadric untuk membuat objek seperti polyhedrons ataupun ellipsoids Untuk membuat permukaan berkurva seperti pada sayap pesawat, gears, bodi mesin, etc, digunakan Spline surfaces Untuk membuat permukaan berkurva seperti pada sayap pesawat, gears, bodi mesin, etc, digunakan Spline surfaces Constructive solid geometry untuk menyusun bentuk geometri dasar menjadi objek komplek Constructive solid geometry untuk menyusun bentuk geometri dasar menjadi objek komplek Untuk memodelkan pegunungan, awan, tumbuhan, atau air terjun digunakan procedural methods seperti fractals dan particle system Untuk memodelkan pegunungan, awan, tumbuhan, atau air terjun digunakan procedural methods seperti fractals dan particle system Slide 4Predefined Objects OpenGL sudah menyediakan fungsi menggambar beberapa objek dasar yang tinggal dipakai. Tak perlu membuat dari awal. OpenGL sudah menyediakan fungsi menggambar beberapa objek dasar yang tinggal dipakai. Tak perlu membuat dari awal. Objek-objek dari OpenGL ini dapat disusun untuk membuat bentuk yang kita inginkan Objek-objek dari OpenGL ini dapat disusun untuk membuat bentuk yang kita inginkan Beberapa yang sudah disediakan OpenGL antara lain: Beberapa yang sudah disediakan OpenGL antara lain: Polyhedra Polyhedra Polyhedron functions Polyhedron functions Quadric Surfaces Quadric Surfaces Superquadrics Superquadrics Slide 55 Object with Superquadrics Slide 66 A. Polyhedron A polyhedron is a connected mesh of simple planar polygons that encloses a finite amount of space. A polyhedron is a connected mesh of simple planar polygons that encloses a finite amount of space. Polyhedron adalah rangkaian jala polygon (polygon mesh) dengan kriteria sbb Polyhedron adalah rangkaian jala polygon (polygon mesh) dengan kriteria sbb Setiap edge dipakai oleh 2 faces Setiap edge dipakai oleh 2 faces Sedikitnya 3 edge bertemu pada setiap vertex. Sedikitnya 3 edge bertemu pada setiap vertex. Faces tidak saling menembus, tetapi berhenti pada suatu edge. Faces tidak saling menembus, tetapi berhenti pada suatu edge. Eulers formula : If F, E, V represent the number of faces, vertices and edges of a polyhedron, then Eulers formula : If F, E, V represent the number of faces, vertices and edges of a polyhedron, then V + F E = 2. V + F E = 2. Slide 77 3D Object Representation The data for polygonal meshes can be represented in two ways. The data for polygonal meshes can be represented in two ways. Method 1: Method 1: Vertex List Vertex List Normal List Normal List Face List (Polygon List) Face List (Polygon List) Method 2: Method 2: Vertex List Vertex List Edge List Edge List Face List (Polygon List) Face List (Polygon List) Slide 8Surface Normal n Slide 99 0 1 23 4 5 6 7 Vertices and Faces - E.g. Cube 0 1 2 3 4 5 Face Index Vertex Index 0 1 23 5 6 7 Slide 1010 Data representation using vertex, face and normal lists: xyz axis Slide 1111 Data representation using vertex, face and edge lists: Slide 1212 Normal Vectors (OpenGL) Slide 1313 Regular Polyhedra (Platonic Solids) Jika semua face pada polyhedron adalah identik dan berupa regular polygon, maka polyhedron tsb disebut platonic solid. Jika semua face pada polyhedron adalah identik dan berupa regular polygon, maka polyhedron tsb disebut platonic solid. Hanya ada 5 jenis platonic solid Hanya ada 5 jenis platonic solid Slide 14The Platonic Solids Regular tetrahedron (or triangular pyramid) has 4 faces Regular tetrahedron (or triangular pyramid) has 4 faces Regular hexahedron (or cube) with 6 faces Regular hexahedron (or cube) with 6 faces Regular octahedron with 8 faces Regular octahedron with 8 faces Regular dodecahedron with 12 faces Regular dodecahedron with 12 faces Regular icosahedron with 20 faces Regular icosahedron with 20 faces Slide 15Menggambar polyhedron Ada 2 cara Ada 2 cara Method1 : Fitting the surface with a polygon mesh. Membungkus permukaan objek polyhedron dengan susunan jala polygon. Proses ini disebut juga dengan surface tesselation Method1 : Fitting the surface with a polygon mesh. Membungkus permukaan objek polyhedron dengan susunan jala polygon. Proses ini disebut juga dengan surface tesselation Method 2 : Memakai fungsi yang disediakan library GLUT Method 2 : Memakai fungsi yang disediakan library GLUT Slide 16Method-1 Polygon Mesh In fitting polygons to a surface, we are not limited to using GL_POLYGON In fitting polygons to a surface, we are not limited to using GL_POLYGON We can also use We can also use GL_TRIANGLES GL_TRIANGLES GL_TRIANGLE_STRIP GL_TRIANGLE_STRIP GL_TRIANGLE_FAN GL_TRIANGLE_FAN GL_QUADS GL_QUADS GL_QUAD_STRIP GL_QUAD_STRIP Slide 1717 Polygon Mesh Polygon mesh ini juga bisa dipakai untuk memodelkan permukaan objek lainnya Polygon mesh ini juga bisa dipakai untuk memodelkan permukaan objek lainnya Slide 18Method 2- OpenGL Polyhedron Functions 5 functions produce wire frames which can be easily used 5 functions produce wire frames which can be easily used Ex: glutWireX(), where X is one of the names Cube, Tetrahedron, Octahedron, Dodecahedron, or Icosahedron (with the first letter capitalized). 5 functions produce polyhedra facets as shaded fill areas - the characteristics of these are determined by material and lighting properties. 5 functions produce polyhedra facets as shaded fill areas - the characteristics of these are determined by material and lighting properties. Ex: glutSolidX(), where X is as above. Slide 19GLUT Library of Polyhedron Functions Example: prog8OGLGLUTPolyhedra.cpp Example: prog8OGLGLUTPolyhedra.cpp Slide 20glutWireTetrahedron() and glutWireCube(1.0) 4 faces6 faces Slide 21glutWireOctahedron() and glutWireDodecahedron() 8 faces12 faces Slide 22And, glutWireIcosahedron() 20 faces Slide 23B.Quadrics Sphere Ellipsoid Torus General form 23 Objek yang didefinisikan sebagai persamaan quadratics Objek yang didefinisikan sebagai persamaan quadratics Slide 24Quadric surfaces Double cones Ellipsoids Hyperboloids of one sheet Hyperboloids of two sheets Slide 25Quadric surfaces Elliptic paraboloids Hyperbolic paraboloids Slide 26Superquadrics the squaring operations are replaced by arbitrary powers.squaring Superellipses Slide 27Superquadrics Superellipsoids Slide 28GLUT Quadric Functions – for Solids, Substitute Solid for Wire glutWireSphere(radius, slices, stacks); glutWireSphere(radius, slices, stacks); glutWireCone(base, height, slices, stacks); glutWireCone(base, height, slices, stacks); glutWireTorus(innerRadius, outerRadius, nsides, rings); glutWireTorus(innerRadius, outerRadius, nsides, rings); and the following is provided also! glutWireTeapot(size); Slide 29GLUT Quadric Functions QuadricSurfs.cpp Slide 30GLU Quadric-Surface Functions void gluSphere (GLUquadricObj *qobj, GLdouble radius,GLint slices, GLint stacks); void gluSphere (GLUquadricObj *qobj, GLdouble radius,GLint slices, GLint stacks); void gluCylinder (GLUquadricObj *qobj, GLdouble baseRadius,GLdouble topRadius, GLdouble height,GLint slices, GLint stacks); void gluCylinder (GLUquadricObj *qobj, GLdouble baseRadius,GLdouble topRadius, GLdouble height,GLint slices, GLint stacks); void gluDisk (GLUquadricObj *qobj, GLdouble innerRadius,GLdouble outerRadius, GLint slices, GLint rings); void gluDisk (GLUquadricObj *qobj, GLdouble innerRadius,GLdouble outerRadius, GLint slices, GLint rings); Slide 31GLU Quadric-Surface Functions void gluPartialDisk (GLUquadricObj *qobj, GLdouble innerRadius,GLdouble outerRadius, GLint slices, GLint rings,GLdouble startAngle, GLdouble sweepAngle); void gluPartialDisk (GLUquadricObj *qobj, GLdouble innerRadius,GLdouble outerRadius, GLint slices, GLint rings,GLdouble startAngle, GLdouble sweepAngle); Slide 32GLU Quadric-Surface Functions Quadric.c Slide 33WHY IS THE TEAPOT POPULAR? Pada zaman dahulu belum ada library packages untuk 3D modelling. Pemodelan objek 3D dilakukan dengan tangan, menggambar kurva dan titik2nya dicatat secara manual. Pada zaman dahulu belum ada library packages untuk 3D modelling. Pemodelan objek 3D dilakukan dengan tangan, menggambar kurva dan titik2nya dicatat secara manual. Computer graphics researcher Martin Newell, ketika hendak mencari barang untuk dibuat model matematika tak sengaja menemukan teapot Computer graphics researcher Martin Newell, ketika hendak mencari barang untuk dibuat model matematika tak sengaja menemukan teapotMartin NewellMartin Newell Teapot adalah model yang ideal untuk eksperimen 3D modelling, karena Teapot adalah model yang ideal untuk eksperimen 3D modelling, karena Mudah dikenal Mudah dikenal Topologi yang komplek Topologi yang komplek Mempunyai proyeksi bayangan pada dirinya sendiri Mempunyai proyeksi bayangan pada dirinya sendiri Melibatkan topik hidden surface Melibatkan topik hidden surface Memiliki permukaan cekung dan cembung, juga saddle points (curved up and down) Memiliki permukaan cekung dan cembung, juga saddle points (curved up and down) Doesn't take much storage space Doesn't take much storage space Slide 34The Utah Teapot The real teapot--- The real teapot--- The teapot was donated to the Boston Computer Museum but now resides in the Ephemera collection of the Computer History Museum where it's catalogued as "Teapot used for Computer Graphics rendering" catalogue number X00398.1984. The teapot was donated to the Boston Computer Museum but now resides in the Ephemera collection of the Computer History Museum where it's catalogued as "Teapot used for Computer Graphics rendering" catalogue number X00398.1984.Computer History MuseumComputer History Museum Slide 35Many Versions of Teapots From Steve Bakers History of the Teapot site: http://www.sjbaker.org/teapot/index.htmlhttp://www.sjbaker.org/teapot/index.html Slide 36%^$@ Teapot! From Steve Bakers History of the Teapot site: http://www.sjbaker.org/teapot/index.html.http://www.sjbaker.org/teapot/index.html Slide 37wireframe Slide 38Lighting & shading Slide 39Texture mapped Slide 40Multiple Teapots of Various Materials teapots.c Slide 41C. Spline Representations Splines are used to design curves and surfaces based on a set of user-defined points Splines are used to design curves and surfaces based on a set of user-defined points Control points Control points Himpunan titik koordinat yang mengontrol bentuk kurva Himpunan titik koordinat yang mengontrol bentuk kurva Interpolation Interpolation Semua control points tersambung satu sama lain pada garis kurva Semua control points tersambung satu sama lain pada garis kurva Approximate Approximate Semua atau beberapa control points terletak di luar garis kurva Semua atau beberapa control points terletak di luar garis kurva Slide 42Spline Representations Interpolated Approximate Slide 43Bezier Spline Curves Developed by French engineer Pierre Bézier for use in the design of Renault automobile bodies Developed by French engineer Pierre Bézier for use in the design of Renault automobile bodies Easy to implement Easy to implement Widely used in CAD systems, graphics, drawing and painting packages Widely used in CAD systems, graphics, drawing and painting packages Slide 44Bezier Curve Equations Diketahui sejumlah n +1 control points, Diketahui sejumlah n +1 control points, nilai k antara 0 sampai n Persamaan garis Bezier akan membentuk titik-titik garis kurva sesuai control point yang didefinisikan Persamaan garis Bezier akan membentuk titik-titik garis kurva sesuai control point yang didefinisikan Slide 45Bezier Curve Equations Degree 1 – Linear Curve Degree 1 – Linear Curve Degree 2 Degree 2 Degree 3 Degree 3 Degree n Degree n Slide 46Bezier Spline Curves A common use for Bezier curves is in font definition A common use for Bezier curves is in font definition Slide 47Bezier Spline Curves If we specify the first and the last control point as the same point, we can generate a closed Bezier curve If we specify the first and the last control point as the same point, we can generate a closed Bezier curve Slide 48Bezier Surfaces Two sets of Bezier curves can be used to design an object surface Two sets of Bezier curves can be used to design an object surface with p j,k specifying the location of (m+1) by (n+1) control points Slide 49Bezier Surfaces u and v parameters u and v parameters Slide 50Bezier Surfaces An example Bezier surface An example Bezier surface Slide 51OpenGL Approximation Spline Functions Bezier splines and B-splines can be displayed using OpenGL functions Bezier splines and B-splines can be displayed using OpenGL functions The core library contains Bezier functions, and GLU has B-spline functions The core library contains Bezier functions, and GLU has B-spline functions Bezier functions are often hardware implemented Bezier functions are often hardware implemented Slide 52OpenGL Bezier-Spline Curve Functions We specify parameters and activate the routines for Bezier-curve display with We specify parameters and activate the routines for Bezier-curve display with glMap1*(GL_MAP1_VERTEX_3, uMin, uMax, stride, nPts, *ctrlPts); glMap1*(GL_MAP1_VERTEX_3, uMin, uMax, stride, nPts, *ctrlPts); glEnable(GL_MAP1_VERTEX_3); glEnable(GL_MAP1_VERTEX_3); and deactivate with and deactivate with glDisable(GL_MAP1_VERTEX_3); glDisable(GL_MAP1_VERTEX_3); uMin and uMax are typically 0 and 1.0 uMin and uMax are typically 0 and 1.0 stride=3 for 3D stride=3 for 3D nPts is the number of control points nPts is the number of control points ctrlPts is the array of control points ctrlPts is the array of control points Slide 53OpenGL Bezier-Spline Curve Functions After setting parameters, we need to evaluate positions along the spline path and display the resulting curve. To calculate coordinate positions we use After setting parameters, we need to evaluate positions along the spline path and display the resulting curve. To calculate coordinate positions we useglEvalCoord1*(uValue); where uValue is assigned some value in the interval from uMin to uMax Slide 54Example OpenGL Code GLfloat ctrlPts [4][3] = { {-40.0, 40.0, 0.0}, {-10.0, 200.0, 0.0}, GLfloat ctrlPts [4][3] = { {-40.0, 40.0, 0.0}, {-10.0, 200.0, 0.0}, {10.0, -200.0, 0.0}, {40.0, 40.0, 0.0} }; {10.0, -200.0, 0.0}, {40.0, 40.0, 0.0} }; glMap1f (GL_MAP1_VERTEX_3, 0.0, 1.0, 3, 4, *ctrlPts); glMap1f (GL_MAP1_VERTEX_3, 0.0, 1.0, 3, 4, *ctrlPts); glEnable (GL_MAP1_VERTEX_3); glEnable (GL_MAP1_VERTEX_3); GLint k; GLint k; glColor3f (0.0, 0.0, 1.0); // Set line color to blue. glColor3f (0.0, 0.0, 1.0); // Set line color to blue. glBegin (GL_LINE_STRIP); // Generate Bezier "curve". glBegin (GL_LINE_STRIP); // Generate Bezier "curve". for (k = 0; k


Comments

Copyright © 2025 UPDOCS Inc.