Title: shape representation 1
1shape representation 1
2How do we represent the shape of an object?
3Eeeew
- We dont really need to represent all the details
of an object - Just approximate the shape
- Enough that it looks right when displayed
4What do we mean by shape?
5The interior of the shape?
6The boundary of the shape?
7Representation of shape
- In computer graphics, we usually use boundaries
- Curves in 2D
- Surfaces in 3D
- A curve or surface is an (infinite) set of points
- This is a problem, since our computers dont have
infinite memory
8Approximating a curve
9Linear approximation
We can use a line as a (bad) approximation to a
curve
10Piecewise-linear approximation
We can use several lines to make a better
approximation
11Approximating a curve
By adding more lines, we can make it as accurate
as we like
12Approximating a curve
By adding more lines, we can make it as accurate
as we like
13Polylines
We end up with a bunch of line segments that
share endpoints
14Vertices and edges
The endpoints are called vertices and the line
segments edges
15Vertices and edges
We can change the shape by moving a vertex
16Closed curves and polygons
If the curve joins up with itself, we say its a
closed curve
17Closed curves and polygons
A closed curve made out of lines is called a
polygon
18Concave polygons
concavity
A polygon with an indentation is called a concave
polygon
19Convex polygons
A polygon with no concavities is called convex
20Representing surfaces
- To represent 3D objects, we need to represent
their surfaces
Source http//www.d-vw.com/news/advanced/active_l
ighting.htm
21Planar approximation
- We approximated 2D shapes with groups of line
segments(aka polygons) - What would the 3D equivalent be?
- The 3D analog of a line is a plane
- So we approximate surfaces with groups of planar
patches - What would those patches look like?
22Planar approximation
- What would those patches look like?
- Planes intersect in lines
- So many planes intersect in many lines
- Gee, this sounds familiar
23Polygonal approximation
- Whenever 4 or more planar patches intersect, they
form a polygon - Shapes modeled with planar patches form groups of
polygons
24Vertices, edges, and faces
- In 3D
- The corners of the polygons are still called
vertices - But the lines between them are called edges
- And the polygons themselves are called faces
- Every edge is part of two faces
- Every vertex is part of at least two lines
vertices
25Vertices, edges, and faces
- In 3D
- The corners of the polygons are still called
vertices - But the lines between them are called edges
- And the polygons themselves are called faces
- Every edge is part of two faces
- Every vertex is part of at least two lines
edges
26Vertices, edges, and faces
- In 3D
- The corners of the polygons are still called
vertices - But the lines between them are called edges
- And the polygons themselves are called faces
- Every edge is part of two faces
- Every vertex is part of at least two lines
faces
27Polygonal meshes
- When large groups of polygons form a surface, we
call it a mesh - Meshes polygons share a common set of vertices
- Polygon meshes are the (current) standard
technology for surface modeling
Source http//www.d-vw.com/news/advanced/active_l
ighting.htm
28Polygonal meshes
29Meshes have a long tradition
Perspective Study of a Chalice Paolo Uccelloin
1430-1440.
30Triangle meshes
- 3D modeling programs usually represent surfaces
as arbitrary polygons - Most graphics cards
- Provide hardware for drawing triangles
- Draw other polygons by making them out of
multiple triangles - Polygon meshes are usually converted to triangle
meshes for final rendering - So many artists model directly using the triangle
mesh so they have as much control as possible
31Resolution and polygon count
- Graphics card speed is often measured in
triangles per second - A 1M tri/sec card can render
- A 10,000 triangle scene at 100fps
- A 100,000 triangle scene at 10 fps
- So models trade off speed for accuracy
- More polys more realistic still frames
- More polys less realistic animation
- Many artists in the game industry specialize in
low poly count modeling
Source http//cache-www.intel.com/cd/00/00/01/45/
14535_continuous_detail_levels_f2.jpg
3210000 triangles
Source http//www.cs.utah.edu/wyman/classes/wave
lets/proj4/
339000 triangles
348000 triangles
357000 triangles
366000 triangles
374000 triangles
383000 triangles
39Polygon modeling techniques
- 3D Scanning
- Sorry, we cant do that
- Make a primitive shape
- Most modelers can make spheres, cones, cubes,
etc. automatically - Deform an existing shape
- Rotate, translate, scale
- Stretch (scale in one direction)
- Move the vertices around
- Add/remove vertices(Modeling tool will
split/merge polygons accordingly)
40Solids of revolution
- Solids of revolution are common in the real world
- Lathes are machines specifically design to
manufacture them
41Turning an object on a lathe
42An electronic latheMaking a wine glass in Maya
- Start by drawing the curve for the profile of the
object
Source http//www.3dvf.com/modules/publish/Articl
es-Dossiers_1429_2.html
43Making a wine glass
- Start by drawing the curve for the profile of the
object - Select the revolve operation
Source http//www.3dvf.com/modules/publish/Articl
es-Dossiers_1429_2.html
44Making a wine glass
- Start by drawing the curve for the profile of the
object - Select the revolve operation
- Voila!
Source http//www.3dvf.com/modules/publish/Articl
es-Dossiers_1429_2.html
45Extruding an existing face
- Most modelers will let you pull a face out from
the surface - It will automatically create new polygons to
rejoin the face to the surface
Source http//www.3d-station.com/pages/tutorials/
tutorial.php?id131page1
46Extruding an existing face
- Most modelers will let you pull a face out from
the surface - It will automatically create new polygons to
rejoin the face to the surface
47Extruding an existing face
48Example Making a T-Shirt
Source http//zobal.free.fr/tuts/acm/en_acm2.htm
49Face extrusion
50Face extrusion
- Pull the sides in to make the neck
- Do the same thing to make the arm
51Face deletion
- Right now, the arm is closed at the end
- Remove the face on the end to make an arm hole
52Removing one side
- Remove
- All the faces on the left side
- The bottom face
- And generally tweak the vertices until you like
them
53Forming the whole thing
- Now clone the mesh
- Flip it over
- And join it to the old mesh
54Smoothing
- Most modeling tools have a smoothing function
- Warning this increases the number of polygons
dramatically! - After smoothing, tweak to taste
55Rendering
- The previous images were wireframes
- The just show the vertices and edges
- Rendering is the process of producing a final
image from the polygon mesh
56Surface reflection
incident ray
- Surface reflectance is very complicated
- There are two main models of reflectance
- Specular (glossy) surfaces bounce it directly off
- Lambertian (matte) bounce it evenly in all
directions
reflected rays
specular reflection (highlights)
incident ray
reflected rays
Lambertian reflection (matte/diffuse)
57Specular reflection
- Mirror-like reflection
- Mirrors are near-perfect specular reflectors
- Incident and reflected rays have at (almost) the
same angle - In practice, theres some scattering
- All wavelengths are (usually) reflected equally
- So reflection has the color of the light
incident ray
reflected rays
58Lambertian reflection
- Lambertian/diffuse/matte reflection
- Perfect non-glossy paint
- Light reflected equally in all directions
- Brightness depends on illumination angle
- When light hits and an angle, its spread out
over a wider area (1/sin ? times wider) - So the intensity of the light coming out is
dimmed by sin ? - Not all wavelengths are reflected equally
- The reflection has the color of the surface (at
least if the light is white)
?
d
?
d/sin ?
beam spreads out by 1/sin ?
59Surface normals
- (For reasons that will be clearer later)
- We usually measure the angle a little differently
- We use the angle between the light and
- A line sticking straight out from the surface
- This is called the surfaces normal
- This means the dimming factor is cos ?
- Because we measured ? differently
surface normal
?
d
?
d/cos ?
beam spreads out by 1/cos ?
60Specular and diffuse reflection
61Normals in 3D
- Each point on a surface has a normal
- Vector that sticks out perpendicularly to the
surface - For polygonal models, all points in a polygon
have the same normal - Although rendering sometimes uses fake normals
to generate a better appearance
62Flat shading
- Since all points on a face have the same normal
- So they really look flat
- And the boundaries are very noticeable
Source http//www.cgl.uwaterloo.ca/mmwasile/cs68
8/project.html
63Normal interpolation
- By interpolating the normals, we get a much
smoother look without using more polys - Each pixel in a face recalculates its normal
- Using an average of the normals of each vertex
- Weighted by distance from the vertex
- Closer vertices exert more influence
64Phong shading
- Phong shading is a common lighting model based on
- Specular and diffuse components
- With normal interpolation
- Ambient component
- Added evenly to all pixels
- Acts like a fill light
65Phong shading
Source wikipedia
66Whats in a model?
- Geometry
- All the vertices of the mesh
- Connectivity information (which vertices form
which edges/faces)
- Material information
- Diffuse color
- Specular color
- Specular hardness
- Ambient color
- Different polys can have different materials
- Each polygon can only have one material
67Texture mapping
- Individually coloring each polygon would be
tedious - It would also take a lot of triangles to make a
realistic object
Source http//escience.anu.edu.au/lecture/cg/Text
ureJ3D/printNotes.en.html
68Texture mapping
- Graphics hardware has the ability to paint faces
with sections of a bitmap image - Called textures
- Vertices are tagged with texture coordinates
- Specify a pixel within the texture
- Pixels in the interior of the face are painted
with the pixels between the pixels of the
vertices - Texture is often used to make objects look more
complicated than they really are - There are no actual depressions between the
bricks in this image
Source http//escience.anu.edu.au/lecture/cg/Text
ureJ3D/printNotes.en.html
69The curse of topology
- Texture maps are flat
- Most 3D objects arent
- To map a flat texture to a curved 3D object we
have to - Stretch some parts
- Squish others
- Cut holds (sometimes)
Source http//ligwww.epfl.ch/silic/predocschool/
Project/projectreport.htm
70Mesh
Source http//www.randomstuff.org.uk/laura/Galle
ry_digital_art/silenus.html
71Texture maps
72Mapped mesh
73With and without texture
74Normal mapping
- Normal mapping is another way to make a low poly
model look like a high poly model - Provide a texture map for normals
- Lets the artist paint changing normals over a
single poly - Normals respond to lighting as if they were part
of the real geometry - Q Why wouldnt we just paint dark and bright
regions on a normal texture map?
75famous examples over the ages
76The death star trench sequence
77Super Mario 64 (Nintendo 1996)
78Super Mario Strikers (Nintendo 2005)
79Tomb Raider 1 (1996)
80Tomb Raider 7 (2006)
81High poly count modelingFinal Fantasy Advent
Children (2005)
82High poly count modelingFinal Fantasy Advent
Children (2005)