You are on page 1of 10

CS 253: Computer Graphics

Lecture 7: 3D Object Representation


Muhammad Asad Ali
Department of Computer Science
COMSATS Institute of Information Technology
Islamabad, Spring 2014
Contents
Last lecture : Graphics Processing Pipeline
Summary
Primitives for 3D representation Primitives for 3D representation
Structure of pipeline
Application
Command Stream
Vertex Processing
Transformations
Rasterization
Clipping and Culling
Fragments and Processing Fragments and Processing
Display
Graphics pipeline and GPU
Today: 3D Object Representation
Overview
How can we
Represent 3D objects in a computer Represent 3D objects in a computer
Construct such representations quickly or
automatically with a computer
Manipulate 3D objects with a computer
3D Object Representation
How can we represent this object in computer ?
Requirements for Modeling Shapes in CG
Local control of shape for modeling
Ability to model what we need Ability to model what we need
Smoothness and continuity
Ability to evaluate derivatives
Ability to do collision detection
Ease of rendering Ease of rendering
Methods for 3D Representation
Raw data
Point cloud
Surfaces
Mesh Point cloud
Range image
Mesh
Parametric
Implicit
Solids
Voxels
High-level structures
Scene graph Voxels
CSG
Scene graph
Skeleton
3D Object Representation
A surface can be analytically generated
using its function involving the coordinates.
(parametric surfaces)
z = f(x,y)
(parametric surfaces)
An object can be represented in terms of its
vertices, edges and polygons. (Polygonal
Mesh)
x y z . . .
Curves and surfaces can also be designed
using splines by specifying a set of few
control points. (Bezier curves)
Primitives for 3D Representation
Point
a location in space, 2D or 3D sometimes a location in space, 2D or 3D sometimes
Line
straight path connecting two points
beginning and end on points
Vertex
a point in 3D
Primitives for 3D Representation
Edge
line in 2D/3D connecting two vertices
Polygon/Face/Facet
arbitrary shape formed by connected vertices
fundamental unit of 3D computer graphics
Mesh
set of connected polygons forming a surface (or object)
3D Object Representation: Meshes
How can we represent this object in computer ?
Polygon Meshes
Any shape can be modeled out of polygons
Polygons with how many sides?
Can use triangles, quadrilaterals, pentagons,
n-gons
Triangles are most common Triangles are most common
When > 3 sides are used, ambiguity about what to
do when polygon is non-planar, or concave
Triangle Mesh Representation
Triangle meshes or triangle irregular networks
(TIN) are used to represent surfaces (TIN) are used to represent surfaces
A set of vertices
A set of edges
Faces (bound by edges)
Face
Edge
Vertex
Required information for representation
Position of vertices (coordinates)
Color, texture, shading data
Topology of the Mesh
Consists of interconnected triangles
Mesh should be watertight
No gaps, continuous surface
Such continuous surfaces are called manifolds
Manifold without a boundary
Manifold with a boundary
manifold Non-manifold
Manifold with a boundary
Every edge is shared by two triangles
Orientation of the Triangles
Front and back side of the triangle
Inside facing Inside facing
Outside facing
Orientation is determined based on the order
in which vertices are listed in which vertices are listed
Counter-clockwise order means front side
Triangle Mesh Representation
Indexed Mesh Representation
Number of Triangle
Number of Vertices Number of Vertices
Memory Requirements TM, IM Representation
N
v
vertices, N
t
triangles
Triangle Representation Triangle Representation
3 Vectors per triangle, gives 9N
t
units of storage
Indexed Representation
1 vector per vertex, 3 integers per triangle 1 vector per vertex, 3 integers per triangle
this gives 3N
v
+ 3N
t
units of storage
Triangle Fans and Strips Representation
Indexed representation
Fan Representation
Strips Representation
Example: Triangle Strips in a Mesh
Data structures for Mesh Connectivity
Problems with Previous Representations
Find adjacent triangles of a given triangle
Given an edge find triangles which share it
Given a vertex which faces share it
Convenient and Redundant Solution
Record all the information separtely
Triangle Neighborhood Structure Triangle Neighbor Structure: Example
Winged Edge Representation
Polygon 1
E2
Polygon 1
Edge 1
V1
V2
E4
Polygon 2
E3
E5
Winged Edge Representation
Stores connectivity information about the edges
For each edge
record the pointers to two vertices it connects
head and tail vertices
left and right face
Each vertex also has a pointer to one of its edges
Each face has a pointer to one of its edges
Efficient:
faces adjacent to one vertex
edges adjacent to one vertex
Winged Edge Representation
Winged Edge Representation: Example
Where Meshes come from?
Specify manually
Write out all polygons Write out all polygons
Write some code to generate them
Interactive editing: move vertices in space
Acquisition from real objects
Laser scanners, vision systems
Generate set of points on the surface
Need to convert to polygons
Application: Processing of Meshes
Sub-division surfaces
*.obj Files for 3D Objects (Wavefront)
####
#
# OBJ File Generated by Meshlab
#
f 2909//2909 2921//2921 2939//2939
f 2939//2939 2931//2931 2909//2909
f 2869//2869 2877//2877 2921//2921
#
####
# Object teapot_updated.obj
#
# Vertices: 3644
# Faces: 6320
#
####
vn -0.999846 0.017522 0.001391
v -3.000000 1.800000 0.000000
vn -0.977704 0.012860 -0.209593
v -2.991600 1.800000 -0.081000
f 2869//2869 2877//2877 2921//2921
f 2921//2921 2909//2909 2869//2869
f 2819//2819 2827//2827 2877//2877
f 2877//2877 2869//2869 2819//2819
f 2737//2737 2747//2747 2827//2827
f 2827//2827 2819//2819 2737//2737
f 2669//2669 2673//2673 2747//2747
f 2747//2747 2737//2737 2669//2669
f 2567//2567 2575//2575 2673//2673
f 2673//2673 2669//2669 2567//2567
f 2476//2476 2480//2480 2575//2575
v -2.991600 1.800000 -0.081000
vn -0.976826 0.022067 0.212896
v -2.991600 1.800000 0.081000
vn -0.987462 -0.157856 0.000190
v -2.989450 1.666162 0.000000
vn -0.943968 0.312967 -0.104767
v -2.985000 1.921950 0.000000
vn -0.971294 0.214106 0.103666
f 2476//2476 2480//2480 2575//2575
f 2575//2575 2567//2567 2476//2476
f 2358//2358 2362//2362 2480//2480
f 2480//2480 2476//2476 2358//2358
f 2158//2158 2162//2162 2362//2362
f 2362//2362 2358//2358 2158//2158
Faces of a triangle
Vertices and normals
Parametric and Implicit Representation
All Points at Distance r from Point (c
x
, c
y
, c
z
)
Implicit representation Implicit representation
(x-c
x
)
2
+ (y-c
y
)
2
+ (z-c
z
)
2
= r
2
Parametric representation
x= r sin( ) cos( )
y= r sin( ) sin( )

r
(c
x
, c
y
, c
z
)
y= r sin( ) sin( )
z= r cos( )

0 1
2
2
2
=

z y x
r
z
r
y
r
x
Which representation is this ?
Which object ?
Point Cloud
Unstructured samples / points
Advantage: simplicity
Disadvantage:
no information on
adjacency / connectivity
Have to use e.g. Have to use e.g.
k-nearest neighbors
Where do point clouds come from ?
Range Images
Image: stores an intensity / color along each of a set of
regularly spaced points in space regularly spaced points in space
Range image: stores a depth along each of a set of
regularly spaced points in space
Obtained using devices known as range scanners
Advantages:
Uniform parameterization
Adjacency / connectivity information
Range Image
Not a complete 3D description: does not
include part of object occluded from viewpoint
Range Image Range Image Tessellation Tessellation Range Surface Range Surface
Solids: Voxels
Uniform grid of occupancy, volume, density.
Grid cells are called voxels Grid cells are called voxels
Often acquired from CAT, MRI.
Can be generated for a given 3D model
Constructive Solid Geometry
Represent solid object as hierarchy of boolean
operations operations
Union
Intersection
Difference
Union
Difference
Intersection
Skeleton Representation
Graph representation using points, lines
Summary
Requirements for 3D modeling
Methods for 3D representation
Triangle mesh representation Triangle mesh representation
Indexed mesh representation
Triangle Fans and Strips
Data structure for mesh connectivity
Triangle neighborhood representation
Winged edge representation
OBJ file for 3D objects
Parametric and Implicit representation Parametric and Implicit representation
Point clouds
Range Images
Voxels
CSG
Skeleton representation
Readings
Fundamentals of computer graphics
Chapter 12, section 12.1 Chapter 12, section 12.1

You might also like