lecture 2 3d modeling - tongji universitysse.tongji.edu.cn/jiajinyuan/acg2012fall/lecture 02-3d...
TRANSCRIPT
3D Modeling, Advanced Computer Graphics Shuang LIANG, SSE, Fall 2012
Lecture 23D Modeling
Dr. Shuang LIANGSchool of Software Engineering
Tongji UniversityFall 2012
3D Modeling, Advanced Computer Graphics Shuang LIANG, SSE, Fall 2012
Lecturer
Dr. Shuang LIANG• Assisstant professor, SSE, Tongji
– Education» B.Sc in Computer Science, Zhejiang University, 1999-2003» PhD in Computer Science, Nanjing Univerisity, 2003-2008» Visit in Utrecht University, 2007, 2008
– Research Fellowship» The Chinese University of Hong Kong, 2009» The Hong Kong Polytechnic University, 2010-2011» The City University of Hong Kong, 2012
• Contact– Office: Room 442, JiShi Building, JiaDing Campus, TongJi (Temporary)– Email: [email protected]
3D Modeling, Advanced Computer Graphics Shuang LIANG, SSE, Fall 2012
Outline
• What is a 3D model?• Usage of 3D models• Classic models in computer graphics• 3D model representations
• Raw data• Solids• Surfaces
3D Modeling, Advanced Computer Graphics Shuang LIANG, SSE, Fall 2012
Outline
• What is a 3D model?• Usage of 3D models• Classic models in computer graphics• 3D model representations
• Raw data• Solids• Surfaces
3D Modeling, Advanced Computer Graphics Shuang LIANG, SSE, Fall 2012
What is a 3D model? 3D object using a collection of points in 3D space,
connected by various geometric entities such as triangles, lines, curved surfaces, etc. It is a collection of data (points and other information)
3D Modeling, Advanced Computer Graphics Shuang LIANG, SSE, Fall 2012
What is a 3D modeling? The process of developing a mathematical
representation of any three-dimensional surface of object via specialized software.
3D Modeling, Advanced Computer Graphics Shuang LIANG, SSE, Fall 2012
Outline
• What is a 3D model?• Usage of 3D models• Classic models in computer graphics• 3D model representations
• Raw data• Solids• Surfaces
3D Modeling, Advanced Computer Graphics Shuang LIANG, SSE, Fall 2012
Usage of a 3D model The medical industry uses
detailed models of organs
3D Modeling, Advanced Computer Graphics Shuang LIANG, SSE, Fall 2012
Usage of a 3D model The movie industry uses them as characters and
objects for animated and real-life motion pictures
3D Modeling, Advanced Computer Graphics Shuang LIANG, SSE, Fall 2012
Usage of a 3D model The science sector uses them as highly detailed
models of chemical compounds
3D Modeling, Advanced Computer Graphics Shuang LIANG, SSE, Fall 2012
Usage of a 3D model The architecture industry uses them to demonstrate
proposed buildings and landscapes through Software Architectural Models
3D Modeling, Advanced Computer Graphics Shuang LIANG, SSE, Fall 2012
Usage of a 3D model The architecture industry uses them to demonstrate
proposed buildings and landscapes through Software Architectural Models
Microspot Interiors Professional is the award-winning 3D modeling software and interior design program for Mac. Design and envision interior home designs with the power and ease of Interiors.
3D Modeling, Advanced Computer Graphics Shuang LIANG, SSE, Fall 2012
Usage of a 3D model The engineering community uses them as designs of
new devices, vehicles and structures as well as a host of other uses
3D Modeling, Advanced Computer Graphics Shuang LIANG, SSE, Fall 2012
Outline
• What is a 3D model?• Usage of 3D models• Classic models in computer graphics• 3D model representations
• Raw data• Solids• Surfaces
3D Modeling, Advanced Computer Graphics Shuang LIANG, SSE, Fall 2012
Classic models in CG The Utah Teapot
The "hello world" in CG A mathematical model of an ordinary teapot, which appears
solid, cylindrical and partially convex. Created in 1975 by Martin Newell, a member of the
pioneering graphics program at the University of Utah
3D Modeling, Advanced Computer Graphics Shuang LIANG, SSE, Fall 2012
Classic models in CG
The original, physical teapot was purchased from ZCMI (a department store in Salt Lake City, Utah) in 1974. It was donated to the Boston Computer Museum in 1984 where it was on display until 1990. It now resides in the ephemera collection at the Computer History Museum in Mountain View, California where it is catalogued as "Teapot used for Computer Graphics rendering" (http://en.wikipedia.org/wiki/Utah_teapot)
3D Modeling, Advanced Computer Graphics Shuang LIANG, SSE, Fall 2012
Classic models in CG The Stanford Bunny
The Stanford Bunny is a computer graphics test model developed by Greg Turk and Marc Levoy in 1994 at Stanford University.
The Bunny consists of data describing 69,451 triangles determined by 3D scanning a ceramic figurine of a rabbit.
3D Modeling, Advanced Computer Graphics Shuang LIANG, SSE, Fall 2012
Classic models in CG The Stanford Happy Buddha
The Stanford buddha is a computer graphics test model created with a Cyberware 3030 MS at Stanford University.
The Buddha consists of data describing 1,087,716 triangles determined by 3D scanning a real figurine.
3D Modeling, Advanced Computer Graphics Shuang LIANG, SSE, Fall 2012
Classic models in CG The Stanford Dragon
The Stanford Dragon is a computer graphics test model created with a Cyberware 3030 MS at Stanford University.
The Dragon consists of data describing 871,414 triangles determined by 3D scanning a real figurine.
3D Modeling, Advanced Computer Graphics Shuang LIANG, SSE, Fall 2012
Requirements for a 3D representation scheme Unambiguity :
When you see a representation of a solid, you will know what is being represented without any doubt.
Uniqueness : That is, there is only one way to represent a particular solid. If a representation is unique, then it is easy to determine if two solids are identical since one can just compare their representations.
Accuracy : A representation is said accurate if no approximation is required.
Validness : This means a representation should not create any invalid or impossible solids. More precisely, a representation will not represent an object that does not correspond to a solid.
Closure : Solids will be transformed and used with other operations such as union and intersection. "Closure" means that transforming a valid solid always yields a valid solid.
Compactness and Efficiency : A good representation should be compact enough for saving space and allow for efficient algorithms to determine desired physical characteristics.
3D Modeling, Advanced Computer Graphics Shuang LIANG, SSE, Fall 2012
Outline
• What is a 3D model?• Usage of 3D models• Classic models in computer graphics• 3D model representations
• Raw data• Point cloud• Range image
• Solids• Surfaces
3D Modeling, Advanced Computer Graphics Shuang LIANG, SSE, Fall 2012
Point cloud Unstructured samples Advantage: simplicity Disadvantage: no information on
adjacency / connectivity
3D Modeling, Advanced Computer Graphics Shuang LIANG, SSE, Fall 2012
Range image Image: stores a color along each of a set of
regularly-spaced rays in space Range image: stores a depth along each of a set of
regularly-spaced rays in space Obtained using devices known as range scanners
PMD, CamCube 3.0, TOF cameraVivid910, Laser scanner
3D Modeling, Advanced Computer Graphics Shuang LIANG, SSE, Fall 2012
Range image Image: stores a color along each of a set of
regularly-spaced rays in space Range image: stores a depth along each of a set of
regularly-spaced rays in space Obtained using devices known as range scanners
2.5D range image 2D ear Range image with rendering
3D Modeling, Advanced Computer Graphics Shuang LIANG, SSE, Fall 2012
Outline
• What is a 3D model?• Usage of 3D models• Classic models in computer graphics• 3D model representations
• Raw data• Solids
• Wireframe model• Constructive solid geometry• Voxels
• Surfaces
3D Modeling, Advanced Computer Graphics Shuang LIANG, SSE, Fall 2012
Wireframe model Wireframe model
The oldest way of representing solids It represents shape of a solid object by its characteristics
lines and points A wireframe model does not have face information A wireframe model consists of two tables, the vertex table
and the edge table. Each entry of the vertex table records a vertex and its coordinate values, while each entry of the edge table has two components giving the two incident vertices of that edge
3D Modeling, Advanced Computer Graphics Shuang LIANG, SSE, Fall 2012
Wireframe modelFor example, to represent a cube defined by eight vertices and 12 edges, one needs the following tables
Vertex Table
Vertex # x y z
1 1 1 1 2 1 -1 1 3 -1 -1 1 4 -1 1 1 5 1 1 -1 6 1 -1 -1 7 -1 -1 -1 8 -1 1 -1
Edge TableEdge # Start Vertex End Vertex
1 1 2 2 2 3 3 3 4 4 4 1 5 5 6 6 6 7 7 7 8 8 8 5 9 1 5 10 2 6 11 3 7 12 4 8
3D Modeling, Advanced Computer Graphics Shuang LIANG, SSE, Fall 2012
Wireframe model It is ambiguous
which one?
3D Modeling, Advanced Computer Graphics Shuang LIANG, SSE, Fall 2012
Outline
• What is a 3D model?• Usage of 3D models• Classic models in computer graphics• 3D model representations
• Raw data• Solids
• Wireframe model• Constructive solid geometry• Voxels
• Surfaces
3D Modeling, Advanced Computer Graphics Shuang LIANG, SSE, Fall 2012
Constructive solid geometry CSG
A CSG solid is constructed from a few primitives with Boolean operators
Primitives: Cuboids(立方体), cylinders(圆柱体), prisms(棱柱), pyramids(角锥体), spheres(球体), cones(圆锥), torus(圆环)
Boolean operators: union, intersection, difference
A+B A^B A-B B-A
Example:
3D Modeling, Advanced Computer Graphics Shuang LIANG, SSE, Fall 2012
Constructive solid geometryA CSG Example:
we want to design a bracket-like shape with a hole shown on the right-most figure below1. start with two blocks and one cylinder2. two blocks are scaled and one of them is rotated3. The cylinder is scaled 4. These three instantiations are then transformed to their
desired positions5. The final product is obtained by computing the union of the
two blocks and then subtracting from it the cylinder.
3D Modeling, Advanced Computer Graphics Shuang LIANG, SSE, Fall 2012
Constructive solid geometryA CSG Example:
The design procedure of the above model can be written as an expression:
(trans(Block1) + trans(Block2)) - trans(Cylinder)
This expression can be converted to an expression tree, the CSG Expression, of the design:
Is CSG representation
unique?
3D Modeling, Advanced Computer Graphics Shuang LIANG, SSE, Fall 2012
Constructive solid geometry Implementation
represent each elementary solid, e.g. cube, as a 3D field of values, negative on the inside and positive outside
The CSG operations of union, intersection, and subtractionthen become simple min/max operations on the 3D fields
After all CSG operations are complete, the volume representation is converted to surfaces for rendering
3D Modeling, Advanced Computer Graphics Shuang LIANG, SSE, Fall 2012
Constructive solid geometry ImplementationAny object is defined on a unified domain ; its interior and boundary has negative values, while its exterior has positive values
Ω
objA: the positions of its valid closure have negative values; positions of its exterior have positive values;objB: the positions of its valid closure have negative values; positions of its exterior have positive values;
Then, Union (objA, objB) = min (objA, objB)Intersection (objA, objB) = max (objA, objB)Difference (objA, objB) = max(objA, -objB)
confused?
More explanations are needed here
3D Modeling, Advanced Computer Graphics Shuang LIANG, SSE, Fall 2012
Constructive solid geometry ImplementationAn example to illustrate this in Matlab code is available on the course website!
3D Modeling, Advanced Computer Graphics Shuang LIANG, SSE, Fall 2012
Constructive solid geometry It is often used in CAD tools
3D Modeling, Advanced Computer Graphics Shuang LIANG, SSE, Fall 2012
Outline
• What is a 3D model?• Usage of 3D models• Classic models in computer graphics• 3D model representations
• Raw data• Solids
• Wireframe model• Constructive solid geometry• Voxels
• Surfaces
3D Modeling, Advanced Computer Graphics Shuang LIANG, SSE, Fall 2012
Voxels Partition space into uniform grid
Grid cells are called a voxels (like pixels) Store properties of solid object with each voxel
Occupancy Color Density Temperature
3D Modeling, Advanced Computer Graphics Shuang LIANG, SSE, Fall 2012
Voxel Acquisition Scanning devices
Computed tomography (CT) Magnetic resonance imaging (MRI)
Simulation
Siemens MRI Volume data example
3D Modeling, Advanced Computer Graphics Shuang LIANG, SSE, Fall 2012
Voxel Acquisition Widely used in medical imaging
3D Modeling, Advanced Computer Graphics Shuang LIANG, SSE, Fall 2012
Outline
• What is a 3D model?• Usage of 3D models• Classic models in computer graphics• 3D model representations
• Raw data• Solids• Surfaces
• Mesh• Subdivision• Parametric• Implicit
3D Modeling, Advanced Computer Graphics Shuang LIANG, SSE, Fall 2012
Mesh Connected set of polygons (usually triangles) Representation: Vertices, Indexed Face Set
Pros: flexible and computers can render them so quickly. So the vast majority of 3D models today are built as textured polygonal models
Cons: polygons are planar and can only approximate curved surfaces using many polygons
3D Modeling, Advanced Computer Graphics Shuang LIANG, SSE, Fall 2012
Mesh RepresentationKey elements to represent a mesh?
• Vertex (顶点)• Face (面)• Edge (边)
Main data structures• Face table (边表)• Winged edge (翼边)• ……
3D Modeling, Advanced Computer Graphics Shuang LIANG, SSE, Fall 2012
FACE TABLEf1
f2
f3
(x1,y1,z1), (x2,y2,z2), (x3,y3,z3)(x2,y2,z2), (x4,y4,z4), (x3,y3,z3)(x2,y2,z2), (x5,y5,z5), (x4,y4,z4)
Face Table (边表)
Each face is represented by vertex coordinates (坐标)• Redundant (冗余的) vertices• No adjacency (邻接) information
f1
f2 f3
(x1,y1,z1)
(x5,y5,z5)
(x3,y3,z3)
(x4,y4,z4)
(x2,y2,z2)
3D Modeling, Advanced Computer Graphics Shuang LIANG, SSE, Fall 2012
Winged Edge (翼边)Edge-centered: adjacency encoded in edges
(以边为中心)• Adjacent vertexes• Adjacent faces• Adjacent edges
Properties• All adjacencies in O(1) time• A bit extra storage• popular
eF1
F2v2
e11
v1
e22
e21
e12
3D Modeling, Advanced Computer Graphics Shuang LIANG, SSE, Fall 2012
e2
e1
e2
e1
e3
e5
e4
e2
e1
e5
e3
e6
e2
e5
e4
e3
e1
e7
e4
e7
e6
e3
e6
e4
e5
e7
e7
e6
f1
f2 f3
e1
e4
e5e3
e2
e7
e6
v1
v5
v4
v3
v2
f1
f2
f2
f3
f3
f1
f1
f2
f3
(v1,v3)(v1,v2)(v2,v3)(v3,v4)(v2,v4)(v2,v5)(v4,v5)
Example
VERTEX TABLE
v1
v2
v3
v4
v5
(x1,y1,z1)(x2,y2,z2)(x3,y3,z3)(x4,y4,z4)(x5,y5,z5)
FACE TABLE
f1
f2
f3
EDGE TABLE
e1
e2
e3
e4
e5
e6
e7
11 12 21 22
e1e3e5
e1e6e3e5e6
Winged Edge (翼边)
3D Modeling, Advanced Computer Graphics Shuang LIANG, SSE, Fall 2012
Comparison
Data structure Face Vertex Edge Adjacency Storage
Face table Yes - - - High
Winged edge - - Yes V-E-F Edge-centered
“F” stands for face, “V” stands for vertex, and “E” stands for edge.
“-” indicates the adjacency is encoded in the data structure.
3D Modeling, Advanced Computer Graphics Shuang LIANG, SSE, Fall 2012
Mesh Subdivision Coarse mesh & subdivision rule
Define smooth surface as limit of sequence of refinements
…..
3D Modeling, Advanced Computer Graphics Shuang LIANG, SSE, Fall 2012
Mesh Subdivision Coarse mesh & subdivision rule
Define smooth surface as limit of sequence of refinements
3D Modeling, Advanced Computer Graphics Shuang LIANG, SSE, Fall 2012
Mesh Simplification• Fine mesh coarse mesh
• Basic function in mesh processing
3D Modeling, Advanced Computer Graphics Shuang LIANG, SSE, Fall 2012
Mesh Simplification• How?
• Edge collapse
3D Modeling, Advanced Computer Graphics Shuang LIANG, SSE, Fall 2012
Mesh Simplification• How?
• Vertex removal
3D Modeling, Advanced Computer Graphics Shuang LIANG, SSE, Fall 2012
Mesh Simplification• More examples
3D Modeling, Advanced Computer Graphics Shuang LIANG, SSE, Fall 2012
Mesh Simplification• More examples
3D Modeling, Advanced Computer Graphics Shuang LIANG, SSE, Fall 2012
Mesh Simplification• More examples
3D Modeling, Advanced Computer Graphics Shuang LIANG, SSE, Fall 2012
Mesh Simplification• More examples
3D Modeling, Advanced Computer Graphics Shuang LIANG, SSE, Fall 2012
Mesh Simplification• More examples
3D Modeling, Advanced Computer Graphics Shuang LIANG, SSE, Fall 2012
Mesh Simplification• More examples
3D Modeling, Advanced Computer Graphics Shuang LIANG, SSE, Fall 2012
Outline
• What is a 3D model?• Usage of 3D models• Classic models in computer graphics• 3D model representations
• Raw data• Solids• Surfaces
• Mesh• Subdivision surface• Parametric surface• Implicit surface
3D Modeling, Advanced Computer Graphics Shuang LIANG, SSE, Fall 2012
Parametric surface A parametric surface is a surface in the Euclidean
space R3 which is defined by a parametric equation with two parameters
( , ) ( , ), ( , ), ( , )r u v x u v y u v z u v=
Examples:
3D Modeling, Advanced Computer Graphics Shuang LIANG, SSE, Fall 2012
Outline
• What is a 3D model?• Usage of 3D models• Classic models in computer graphics• 3D model representations
• Raw data• Solids• Surfaces
• Mesh• Subdivision surface• Parametric surface• Implicit surface
3D Modeling, Advanced Computer Graphics Shuang LIANG, SSE, Fall 2012
Implicit surface Points satisfying
( , , ) 0F x y z =
An example in 2D case (an implicit curve):
( , , ) 0( , , ) 0( , , ) 0
F x y zF x y zF x y z
< = >
In fact
(x, y, z) inside the surface(x, y, z) on the surface(x, y, z) outside the surface
3D Modeling, Advanced Computer Graphics Shuang LIANG, SSE, Fall 2012
Implicit surfaceAn example
A mechanical model built by using implicit surface tool