graphics notes

SoniaPahuja4 1,624 views 45 slides Jan 17, 2017
Slide 1
Slide 1 of 45
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19
Slide 20
20
Slide 21
21
Slide 22
22
Slide 23
23
Slide 24
24
Slide 25
25
Slide 26
26
Slide 27
27
Slide 28
28
Slide 29
29
Slide 30
30
Slide 31
31
Slide 32
32
Slide 33
33
Slide 34
34
Slide 35
35
Slide 36
36
Slide 37
37
Slide 38
38
Slide 39
39
Slide 40
40
Slide 41
41
Slide 42
42
Slide 43
43
Slide 44
44
Slide 45
45

About This Presentation

Spcly for b.tech students


Slide Content

1

2
Specular Reflection
•Specular reflection is the result of total, or near
total reflection of the incident light in a
concentrated region around the specular-reflection
angle.
•Shiny surfaces have a narrow specular-reflection
range.
•Dull surfaces have a wider reflection range.

3
Specular Reflection
Figure 13 shows the specular reflection
direction at a point on the
illuminated surface. In this figure,
•R represents the unit vector in
the direction of specular reflection;
•L – unit vector directed toward the
point light source;
•V – unit vector pointing to the viewer from the surface
position;
•Angle F is the viewing angle relative to the specular-
reflection direction R.
Fig. 13
Modeling specular reflection.
N
L
To Light Source
q
q
R
V
F

4
Phong Model
Phong model is an empirical model for calculating the
specular-reflection range:
•Sets the intensity of specular reflection proportional to
cos
ns
F;
•Angle F assigned values in the range 0
o
to 90
o
, so that
cosF values from 0 to 1;
•Specular-reflection parameter n
s
is determined by the
type of surface,
•Specular-reflection coefficient k
s
equal to some value
in the range 0 to 1 for each surface.

5
Phong Model
•Very shiny surface is modeled with a large value for n
s

(say, 100 or more);
•Small values are used for duller surfaces.
• For perfect reflector (perfect mirror), n
s
is infinite;
N
L
R
Shiny Surface (Large n
s
)
N
L
R
Dull Surface
(Small n
s
)
Fig. 14
Modeling specular reflection with parameter n
s
.

6
Phong Model
cos
ns
F
F
Fig. 15
Plots of cos
ns
F for several values of specular parameter n
s
.

7
Specular reflection coefficient(W(0))
It gives the model monochromatic specular intensity variations ,
over the range 0< 0< 90 . W(0) increases as angle of incidence
increases .
Phong specular –reflection model
I = W(0) I cos o
spec L
ns
Where I is the intensity of the light source and o is the
viewing angle relative to the specular reflection direction R.
L

8
Approximation variation
of the specular-reflection
coefficient as a function
of angle of incidence for
different materials.

9
Phong Model
Phong specular-reflection model:
I
spec
= k
s
I
l
cos
ns
F
Since V and R are unit
vectors in the viewing
and specular-reflection
directions, we can
calculate the value of
cos
ns
F with the dot
product V
.
R.
I
spec
= k
s
I
l
(V
.
R)
ns

Fig. 13
Modeling specular reflection.
N
L
To Light Source
q
q
R
V
F

10
Phong Model
R + L = (2N
.
L)N
R = (2N
.
L)N-L
N
L
R
N
.
L
L
Fig. 16
Calculation of vector R by considering projections onto the direction of the normal vector N.

11
Phong Model
N
L
R
VF
Fig. 17
Halfway vector H along the bisector of the angle between L and V.
H
a
a = F/2
H = (L + V)/|(L + V)|
I
spec
= k
s
I
l
(N
.
H)
ns

12
Specular Reflection - Example
Fig. 18
Phong shading polygons with specular reflection.

13
Specular reflections from a spherical surface for varying
specular parameter values and a single light source.

14
Combine Diffuse & Specular
Reflections
For a single point light source, we can model
the combined diffuse and specular reflections
from a point on an illuminated surface as
I = I
diff
+ I
spec
I = k
a
I
a
+ k
d
I
l
(N
.
L) + k
s
I
l
(N
.
H)
ns

15
Combine Diffuse & Specular
Reflections with Multiple Light
Sources
If we place more than one point source in a
scene, we obtain the light reflection at any
surface point by summing the contributions
from the individual sources:

I = k
a
I
a
+ S
n
i=1
I
li
[k
d
(N
.
L
i
) + k
s
(N
.
H
i
)
ns
]

16
WIRE-FRAME SCENE

17
ambient illumination example

18
Phong Shaded polygons with diffuse reflection

19
Phong shaded polygons with specular reflection

20
Warn Model
•The warn model provides a method for simulating studio
lighting effects by controlling light intensity in different
directions.
•Light sources are modelled as point on a reflecting surface,
using Phong model for the surface points . Then the intensity in
different directions is controlled by selecting values for the
Phong exponent.
In addition, light controls and spotlighting, can be simulated in
the warn model . Flaps are used to control the amount of light
emitted by a source in various directions . Two flaps are
provided for each of the x,y and z directions .
Spotlights are used to control the amount of light emitted
within a cone with apex at a point source position.

21
Studio lighting effect produced by
warn model

22
•As radiant energy from a point light source travels through space,
its amplitude is attenuated by the factor l/d, where d is the
distance that the light has traveled. ie. surface close to the light
source (small d) receives a higher incident intensity from the
source than a distant surface (large d).
•To produce realistic lighting effects, our illumination model
should take this intensity attenuation into account. Otherwise, we
are illuminating all surfaces with the same intensity, no matter
how far they might be from the light source. If two parallel
surfaces with the same optical parameters overlap, they would be
indistinguishable from each other. The two surfaces would be
displayed as one surface.
2
Intensity Attenuation

23
Intensity Attenuation

24
•Our simple point-source illumination model, however, does not
always produce realistic pictures, if we use the factor l/d to
attenuate intensities. The factor l/d produces too much intensity
variations when d is small, and it produces very little variation
when d is large. This is because real scenes are usually not
illuminated with point light sources , and our illumination model
is too simple to accurately describe red lighting effects.
•Graphics packages uses the inverse linear or quadratic functions of
d to attenuate intensities.
F(d)=1/a + a d + a d
2
2
o1 2
2

where ao,a1,a2 are coefficients to obtain a variety of lighting
effects for a scene.

25
•With a given set of attenuation coefficients , the magnitude of the
attenuation function can be limit to 1, as
F(d)=min(1,1/a + a d + a d )
o 1 2
2
•Using this function , basis illumination model can be written
as:-
I = k
a
I
a
+ S
n
i=1
f(d )I
li
[k
d
(N
.
L
i
) + k
s
(N
.
H
i
)
ns
]
i
Where di is the distance , light has travelled from a light
source i.

Color considerations
The basic illumination model considers only
the monochromatic lighting effects. To
incorporate these, intensity equation is to be
written as a function of the color properties of
light sources and object surfaces.

STEPS
•For an RGB description, each color in a
scene is expressed in terms of red green
blue components .
•We then specify the RGB components of
light source intensity and surface colors,
and illumination model calculates the RGB
component of the reflected light.

INCORPORATING
COLOR
IN
INTENSITY EQUATIONS

1.
•To set surface colors ,specify the reflectivity
coefficients vectors, for eg., diffuse reflection
would have k(dr),k(dg),k(db) components.
•For a blue surface,the intensity equation is :
• I = k
ab
I
ab
+ S
n
i=1
f(d )I
lbi
[k
db
(N
.
L
i
) + k
sb
(N
.
H
i
)
ns
]
•Here,k(dr)=k(dg)=0 ; k(db) has value in range 0 to
1.

2.
•Another method for setting surface color is to specify the
components of diffuse and specular color vectors for each
surface ,without changes in reflectivity coefficients.
•For an RGB color representation the components of these two
surfaces color vector can be denoted as ( S
dr,
S
dg
,S
db
) and (

S
Sr
S
Sg
S
Sb
).the blue light component of reflected light is calculated as
:
• I = k
a
S
db
I
ab
+ S
n
i=1
f(d )I
lbi
[k
d
S
db
(N
.
L
i
) + k
s
S
Sb
(N
.
H
i
)
ns
]
•This approach is more flexible,since color parameters can be
set independently from reflectivity values.

•We can simply represent any component of a color
specification with its spectral wavelength lambda
”λ”.
•Then,
•I = k
a
S

I

+ S
n
i=1
f(d )I
lλi
[k
d
S

(N
.
L
i
) + k
s
S

(N
.
H
i
)
ns
]
**spectral wavelength is the different wavelength
assigned to the various colours in the spectrum.**

TRANSPERENCY
A transparent surfaces produces both reflected and
transmitted light. The relative contribution of the
transmitted light depends on the degree of
transparency of the surface and whether any light
sources or illuminated surfaces are behind the
transparent surfaces.
Both diffuse and specular transmissions can take
place at the surfaces of transparent object.
Diffuse reflections are helpful when a blurred
image of background surface is to be obtained.

When a light is incident on a surface :
Part of it is reflected,Part of it is refracted.
Due to difference of speed of light in different mediums,the path
of light changes.
When the light leaves the media to enter the media it was
previously in, its path become parallel to what it previously was,
as shown in the figure.

Snells’ law :
Angle of refraction θ
i
,the index of refraction η
i
of incident
material , the index of refraction η
i
of refracting material
then,
Sineθ
r
=(η
i/
η
r
)sinθ
i

Index of refraction of a material is a function of the
wavelength of the incident light,so that the different
components of a light ray will be refracted at
different angles.
We can use average refractive index for the
different materials modelled In a scene.
The refractive index of air is approximately one,and
crown glass is 1.5.
Since trignometric functions arent always feasible to
find out,refraction is modelled by simply shifting
the path of incident light a small amount.

TRANSFORMATION VECTOR
Transformation vector can be used to locate
intersections of the refraction path with
objects behind the transparent surface.
To produce realistic display, this
determination is very necessary, and also
require considerable computation.
If N is the unit surface normal,
L is the unit vector in the direction of light
source,

Unit transformation vector T in the refracted
direction of refracted ray,
T={(η
i/
η
r
)cosθ
i
–cosθ
r
}N-(η
i/
η
r
)L

A new approach involves ignoring the path shift
altogether, to avoid cumbersome operations.
•This is helpful for thin surfaces.
•This is a speed-up process, but might pose
problems when thin multilayer surfaces are
involved.

•We can combine the transmitted intensity I
trans
through
a surface from a background object with the intensity
I
refl
from the transparent surface using transparency
coefficient K
t
. Parameter K
t
is assigned value
between 0 and 1 to specify how much background
light is to be transmitted.
•Total surface intensity is calculated as:
I=(1- K
t
)I
refl
+K
t
I
trans
1- K
t
is called the opacity factor

Shadows
•Shadows areas are those surfaces areas or
sections that cannot be seen from the light
source.
•Shadows can be treated as surface patterns
and stored in pattern arrays.

•Shadows patterns generated by hidden surface
methods are valid for any selected viewing
positions as long as the light source positions
are not changed.
•Surface that are visible from view position are
shaded according to lighting pattern for that
particular view, combined with texture
patterns in that view if any.
•Shadow areas can be displayed only with
ambient light intensity.

OPACITY FACTOR
•Values from 0 to 1.
•Opacity high : near 1,transmit very little
from background images.
•Opacity low : near 0,transmit a lot more
from background images.

•Transparent effects are often implemented with the z-
buffer algorithms.
*process opaque objects first to determine depths
for the visible opaque surface.
*then, depth position of transparent objects are
compared to values previously stored in depth buffer.
*then, reflective individual intensity of the
individual surface(stored in frame buffer),combined
with intensity change due to transparent surface is
calculated, and new intensity determined.
*additional storage for parameters of transparent
surface(like depths) can be used for accuracy and
speed.

45
Tags