Title: Digital Imaging 20062007
1Digital Imaging2006/2007
Ioannis Ivrissimtzis 05-Mar-2007
2Summary of the lecture
- Geometric Modelling
- Constructive solid geometry
- Mesh processing
- Surface interrogation
- Lights and Shading
- The reflection model
- Shading
- Textures
3Solids
A solid is a 3D object (not a surface embedded in
3D space). In Constructive Solid Geometry
(CSG), shapes are produced using Boolean
operations to combine few basic shapes (the
primitives). Combinations of very few basic
shapes and few types of operations suffice for
most purposes.
4Boolean operations
- The basic Boolean operations are
-
- Union
- Intersection
- Difference
5Union
B
A
The union of A and B is denoted by A U B. A
point belongs to A U B if it belongs to A OR to B.
6Intersection
B
A
The intersection of A and B is denoted by A n
B. A point belongs to A n B if it belongs to A
AND to B.
7Example
A n B
A U B
8Difference
B
A
The difference of A and B is denoted by A / B. A
point belongs to A / B if it belongs to A AND
NOT to B.
9Difference
B / A
A U B
A / B
- Unlike the union and the intersection, the
difference is not a commutative - operation. That is, generally A / B is different
from B / A.
10Summary of the lecture
- Geometric Modelling
- Constructive solid geometry
- Mesh processing
- Surface interrogation
- Lights and Shading
- The reflection model
- Shading
- Textures
11Simplification
Reduce the number of vertices.
12Simplification
Having fewer vertices saves computational time.
It is useful when an object is at the background.
13Simplification
The mesh is simplified step by step. Edge
collapse the vertex b moves to the position of
vertex a, and the triangles abc and adb
disappear.
14Simplification
- A simple algorithm for mesh simplification
- Find a function computing the cost of an edge
collapse. - For example, a cost function can measure changes
in the mesh volume, or changes in the tangent
planes. - Compute the cost of all possible edge collapses
and perform the one with the lowest cost. - Compute new costs after the edge collapse and
repeat the process. - This is not computationally expensive because
the cost function changes only on the part of the
mesh altered by the edge collapse.
15Subdivision
Add vertices and faces to the mesh. The mesh is
gradually refined and becomes smoother.
16Subdivision
We create new triangles by splitting the existing
ones. How do we split the triangles? It is
NOT a good idea to insert a new vertex inside a
triangle and then split it in three. The shape
of the triangles will deteriorate.
17Subdivision
Instead we do a 1 to 4 split of the triangles.
18Subdivision
Where do we place the new vertices? If we place
the new vertices exactly on the existing edges,
the result will be flat. Instead, we
compute the new vertices in a way that produces
smooth curves.
19Subdivision
Example
20Smoothing
Many models have noise. Especially those coming
from scan data.
21Smoothing
There are algorithms for removing the noise.
Such algorithms are not perfect because some of
the initial information is destroyed by the
noise and can not be retrieved. Here,
the result is too smooth, missing some of the
details of the original.
22Smoothing
Here, the smoothing algorithm preserved several
sharp features, but several unwanted artifacts
appear.
23Summary of the lecture
- Geometric Modelling
- Constructive solid geometry
- Mesh processing
- Surface interrogation
- Lights and Shading
- The reflection model
- Shading
- Textures
24Surface Interrogation
Sometimes the quality of a surface can not be
determined by visual inspection only. Several
techniques have been developed which use
mathematical tools to analyse the surface in a
more rigorous way. One of the most fundamental
concepts used in surface interrogation is
curvature.
25Curvature
For any point of a curve, the curvature is a
number indicating how much the curves bends at
that point. If we fit a circle at a point of a
curve, the curvature at that point is the
inverse of the circles radius. Of course,
this is not the exact definition but an intuitive
geometric interpretation.
26Curvature
At this point, the surface does not bend al lot.
We can fit a large circle. The inverse of the
circles radius is small. We say that the
curvature is low.
27Curvature
At this point the surface does bend al lot. We
can only fit a small circle. The inverse of the
circles radius is large. We say that the
curvature is large.
28Curvature
The notion of curvature generalizes to
surfaces. We can visualize curvature information
with a colormap. Each colour corresponds to a
value of the curvature.
29Curvature
A curvature colourmap can reveal features of the
surface which are not visible with naked eye.
Red denotes high curvature, green average
curvature and blue low curvature.
30Summary of the lecture
- Geometric Modelling
- Constructive solid geometry
- Mesh processing
- Surface interrogation
- Lights and Shading
- The reflection model
- Shading
- Textures
31Normals
- The normal associated with a point of a smooth
curve is a unit vector - (vector of length one) perpendicular to the
tangent line.
32Normals
- Similarly, surface normals are unit vectors
perpendicular to the tangent - planes of a surface.
33Lighting model
- The reflection model determines the light
reflected at the points of the - surface.
- It computes how much light arriving from a light
source is reflected from - the point and leaves in the direction of the
viewers eye point. - This is repeated for every light source in the
scene graph to find the - total reflected light at the point.
- The shading model determines how the polygonal
faces are filled.
34Reflection model
- The computation of the reflection requires three
unit vectors - N (the surface normal) vector
perpendicular to the surface. - L (the light vector) vector from point to
light source. - E (the eye vector) vector from point to
eye (view) point.
N
L
E
35Reflection model
- Reflected light is considered to have three
components - Ambient reflection Ia - reflected ambient
light. - Diffuse reflection Id - matt reflection.
- Specular reflection Is - shiny highlight.
- Different combinations of these give a surface
the appearance of being - made from different materials.
- The Java3d lighting model also has an emissive
component Ie which - allows implementation of glow in the dark
objects, although they do not - illuminate other objects.
36Ambient light
- The ambient light models light arriving equally
from all directions. This - is an empirical way to account for lost light.
- We have
- Ia La Ka
- where La is the intensity of the ambient light
source and Ka is the - surfaces ambient reflectance.
- Notice that none of the three vectors N, L, E is
involved in the - computation of the ambient light.
37Diffuse light
- Diffuse reflection scatters light equally in all
directions, giving to the - surface a matt appearance.
- The diffuse component is computed as
- Id Lp Kd (N L)
- where Lp is the intensity of the light source and
Kd is the surfaces - diffuse reflectance.
N
Lp
L
E
38Diffuse light
- Diffuse reflection is uniform and regardless of
the eye point. However, it - depends on the position of the light source.
- Because both N,L have length 1, we have
- where a is the angle between N and L. Therefore
the light reflected in - direction E depends only on cosa.
N
Lp
L
E
a
39Diffuse light
Late afternoon sun. Large a gives a value of
cosa near 0, thus less diffuse light.
N
L
Lp
E
a
Lp
N
Midday sun. Small a gives a value of cosa near
1, thus more diffuse light.
L
a
E
40Specular light
- Specular reflection creates highlights on shiny
surfaces. - Is Lp Ks (R E)n
- where the scalar Ks is the specular reflectance.
The mirror reflection of - L is in direction R where a' a.
- Because R E cos?, the closer E is to R the
brighter the highlight will - appear.
N
Lp
R
L
E
?
a'
a
41Specular light
- A larger value of
- shininess, n, produces
- sharper highlights.
A smaller value of n produces broader
highlights.
42Putting it all together
- The intensity I of the light leaving a point in
direction of the eye is the - sum of the emissive, ambient, diffuse and
specular components. - That gives
- can be
scalar values or colour values. - If they are colour values this equation is
calculated once for each R, G - and B intensities.
43Limitations
- The main limitation of the above lighting model
is the lack of any - interaction between the visual objects.
- In particular, light reflected by a visual object
can not illuminate another - visual object.
- This gives to the scene a distinctive computer
signature with the visual - objects appearing plastic like and floating.
- To address this problem we can add to the
lighting model the - computation of shadows, or use a different
lighting model, e.g. one - based or ray tracing.
44Summary of the lecture
- Geometric Modelling
- Constructive solid geometry
- Mesh processing
- Surface interrogation
- Lights and Shading
- The reflection model
- Shading
- Textures
45Flat shading
- The flat shading computes one intensity value for
one point of the - polygon and applies this intensity value to the
whole polygon. For that - reason it is fast.
- Notice the discontinuities at the vertices and
edges of the mesh. - Flat shading is truthful to the mesh geometry,
but this is a disadvantage - when we use the mesh to approximate a smooth
surface.
46Gouraud shading
- Gouraud shading first computes the intensity at
each vertex. - Then, it interpolates between vertices to compute
the intensities of the - points at the edges of the mesh.
- Finally, it interpolates between edge points to
compute the intensities at - the interior of a polygon.
47Gouraud shading
- Gouroud shading uses vertex normals.
- The normal at a vertex can be computed as the
(weighted) average of - the normals of the adjacent faces.
48Phong shading
- The Phong shading model interpolates the vertex
normals to compute - normals for the points at the edges and the faces
of the mesh. - Then applies the lighting model to compute the
intensity of each point of - the mesh.
- Phong shading is computationally more expensive
than the Gouraud - shading which uses the reflection model only for
computing intensities - at the mesh vertices.
49Examples
Flat
Gouraud
Phong
50Examples
Phong
Flat
Gouraud
- http//nis-lab.is.s.u-tokyo.ac.jp
51Summary of the lecture
- Geometric Modelling
- Constructive solid geometry
- Mesh processing
- Surface interrogation
- Lights and Shading
- The reflection model
- Shading
- Textures
52Textures
- Textures add realism on a 3D visual object,
without increasing the - complexity of its geometry.
- The most common texturing technique maps an image
to the surface - of a 3D visual object.
53Parameterization
- When the topology of the surface is simple, we
can map the image onto - the surface continuously. This process is called
parameterization. - Assuming, for simplicity, a square image,
parameterization finds a - continuous map f from 0,1 x 0,1 to the
surface. - The square 0,1 x 0,1 is called the parameter
space.
y
1
0
1
x
54Parameterization
- The parameterization induces a polygonization of
the parameter space. - Assuming that the connectivity of the mesh is
known, the parameterization - is defined by the position of each vertex in the
parameter space, given by - its texture coordinates.
y
1
0
1
x
55Parameterization
- With the exception of few simple surfaces, an
image can not be wrapped - around a surface without distortion.
- Parameterization algorithms try to minimize
distortion.
56Free boundary
- One way to reduce distortion is to assume a
free-boundary parameter - space, that is, a parameter space which is not
necessarily a square. - http//www.cs.technion.ac.il
3D model
Parameterization
Textured model
57Texture atlases
- Depending on the topology of the surface, it may
not be possible to - map the parameter space 0,1 x 0,1 onto the
surface continuously. - Closed surfaces like the sphere, or planar
surfaces with more then one - boundary are such examples.
58Texture atlases
- Even if the surface is homeomorphic to the
parameter space, still a - continuous texture mapping may create very large
distortion. - In such cases, it might be preferable to
partition the surface into several - pieces called charts. Putting the charts together
creates an atlas. - The process of partitioning a surface into
several smaller parts is called - segmentation.
59Segmentation
- When a surface is segmented for parameterization,
some common - considerations are
- Each chart can be mapped continuously onto the
parameter space. - Each chart can be parameterized with little
distortion. - The charts that can be joined seamlessly.
60Examples
- Segmentation of large complex models.
- http//web.engr.oregonstate.edu
61Examples
- Textured models and the corresponding atlases.
- http//web.engr.oregonstate.edu
62Texture atlases
- The default texturing of Java3D primitives
involves segmentation and - parameterization of the chart.
- The cube is segmented into six faces. Each face
can be textured - without any distortion. However, there are
discontinuities along the - edges.
63Texture atlases
- The segmentation and texturing of the sphere
induces discontinuities - and distortion.
64Texture atlases
- Texturing the cone and the cylinder in Java3D.
65Normal textures
- By mapping an image to a 3D surface we can convey
the sense of - texture (material). However, the textured
surface reflects the light as a - smooth surface.
- Except of the obvious solution of increasing the
complexity of the - model, another technique to overcome this problem
is to modulate the - normals of the smooth surface creating a normal
texture.
Original normals
Modulated normals
66Normal textures
Examples of normal textures
67PovRay example
texture T_Wood20 scale 10
68PovRay example
texture T_Copper_2B
69PovRay example
texture T_Glass4 interior I_Glass
caustics 1
70PovRay example
- sphere lt0,0,0gt, 3
- texture
- pigment color Red
- normal
- bumps 1.0 // depth of bumps
- scale 0.1 // width of
bumps -
-
-
71PovRay example
- The previous bumps example
72PovRay example
- The previous example with smaller depth of bumps
0.25