Uni 4 Graficacion
Uni 4 Graficacion
[Eq. 8.2]
IS is the intensity of the spotlight, fatt is the distance-dependent factor
for attenuation as in equation (8.1) and is the angle between I and
IS. The value p controls how much the spotlight is focussed.
For p = 0 the spotlight behaves in the same way as a point light
source.
Light sources
The larger p is chosen, the more the light concentrated around the
axis of the cone and the smaller is the intensity at the boundary of
the cone.
The cosine in equation (8.2) can be computed as the dot product of
the vectors l and lS if they are normalised, i.e., if both of them have
the length one.
Light sources
The
4.3 Tcnicas de sombreado
To make objects appear to have more volume, it can help to use
shading, i.e., the surface is painted with light.
Diffuse Shading
Many objects in the world have a surface appearance loosely
described as matte, indicating that the object is not at all shiny.
Examples include paper and unfinished wood.
Such objects do not have a color change with a change in viewpoint.
Such matte objects can be considered as behaving as Lambertian
objects.
Lambertian Shading Model
A Lambertian object obeys Lamberts cosine law, which states that
the color c of a surface is proportional to the cosine of the angle
between the surface normal and the direction to the light source
(Gouraud, 1971):
or in vector form,
where n and l are shown in Figure 10.1.
Lambertian Shading Model
Ssdsd
Lambertian Shading Model
Thus, the color on the surface will vary according to the cosine of the
angle between the surface normal and the light direction.
Note that the vector l is typically assumed not to depend on the
location of the object. That assumption is equivalent to assuming the
light is distant relative to object size.
Such a distant light is often called a directional light, because its
position is specified only by a direction.
Lambertian Shading Model
A surface can be made lighter or darker by changing the intensity of
the light source or the reflectance of the surface.
The diffuse reflectance cr is the fraction of light reflected by the
surface. This fraction will be different for different color components.
For example, a surface is red if it reflects a higher fraction of red
incident light than blue incident light.
Lambertian Shading Model
If we assume surface color is proportional to the light reflected from a
surface, then the diffuse reflectance cr ( an RGB color ) must also be
included:
The right-hand side of Equation (10.1) is an RGB color with all RGB
components in the range[0,1].
Lambertian Shading Model
We would like to add the effects of light intensity while keeping the
RGB components in the range [0,1].
This suggests adding an RGB intensity term cl which itself has
components in the range [0,1]:
Lambertian Shading Model
This is a very convenient form, but it can produce RGB components
for c that are outside the range[0,1], because the dot product can be
negative.
The max function can be added to Equation (10.2) to test for that
case:
Lambertian Shading Model
Another way to deal with the negative light is to use an absolute
value:
Ambient Shading
One problem with the diffuse shading of Equation (10.3) is that any
point whose normal faces away from the light will be black.
In real life, light is reflected all over, and some light is incident from
every direction.
In addition, there is often skylight giving ambient lighting.
Libro: Fundamentals Computer Graphics, pp 235, pdf, 3ed, Peter Shirley
Ambient Shading
One way to handle this is to use several light sources.
Another way is to use two-sided lighting as described by Equation
(10.4).
A more common approach is to add an ambient term (Gouraud,
1971).
Libro: Fundamentals Computer Graphics, pp 235, pdf, 3ed, Peter Shirley
Ambient Shading
This is just a constant color term added to Equation (10.3):
c = cr ( ca + cl max (0, n l ) )
Intuitively, you can think of the ambient color ca as the average color of
all surfaces in the scene.
Libro: Fundamentals Computer Graphics, pp 235, pdf, 3ed, Peter Shirley
Phong Shading
Some surfaces are essentially like matte surfaces, but they have
highlights
Examples of such surfaces include polished tile floors and
whiteboards.
Highlights move across a surface as the viewpoint moves.
Libro: Fundamentals Computer Graphics, pp 236, pdf, 3ed, Peter Shirley
Phong Shading
This means that we must add a unit vector e toward the eye into our
equations.
If you look carefully at highlights, you will see that they are really
reflections of the light.
The color of these highlights is the color of the light
Libro: Fundamentals Computer Graphics, pp 236, pdf, 3ed, Peter Shirley
Phong Shading
Nosotros buscamos agregar un brillo difuso del mismo color que la
fuente de luz en el sitio correcto.
El centro del brillo debe colocarse donde la direccin del vector
unitario e se ponga en lnea con la direccin del reflejo representado
por el vector unitario r.
Alinear los vectores r y e, equivale a que el ngulo entre r y e
representado por sea cero.
Phong Shading
Referencias
Introduction to computer graphics using Java 2D and 3D, Klawonn,
Frank, Springer, 2008, pp 216
Libro: Fundamentals Computer Graphics, pp 235, pdf, 3ed, Peter
Shirley