0% found this document useful (0 votes)
39 views42 pages

Uni 4 Graficacion

This document discusses illumination and shading in 3D graphics. It covers several key concepts: - Projections are used to display 3D scenes on 2D surfaces, but simple projections lack details like shading. - Shading refers to rendering surfaces with lighting effects to provide a 3D appearance and details about surface normals. - Light sources like ambient light, directional light, point lights, and spotlights contribute to illumination and are modeled mathematically. Factors like intensity, attenuation, and cone shape are considered. - The Lambertian and Phong shading models describe how surface color is calculated based on lighting and surface normal orientation to create diffuse and specular lighting effects.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
39 views42 pages

Uni 4 Graficacion

This document discusses illumination and shading in 3D graphics. It covers several key concepts: - Projections are used to display 3D scenes on 2D surfaces, but simple projections lack details like shading. - Shading refers to rendering surfaces with lighting effects to provide a 3D appearance and details about surface normals. - Light sources like ambient light, directional light, point lights, and spotlights contribute to illumination and are modeled mathematically. Factors like intensity, attenuation, and cone shape are considered. - The Lambertian and Phong shading models describe how surface color is calculated based on lighting and surface normal orientation to create diffuse and specular lighting effects.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 42

Graficacin

Unidad IV. Iluminacin y Sombreado


Iluminacin y Sombreado
Projections, required for displaying a three-dimensional scene on a
two-dimensional plane or screen.

A projection is a special type of mapping from the three-dimensional
space to a plane.

In this sense, a projection describes only where a point or an object
has to be drawn on the projection plane.


Iluminacin y Sombreado
The information where an object should be drawn on the projection
plane, i.e., which pixels are covered by the object, is not at all
sufficient for a realistic representation of a three-dimensional scene.

Figure 8.1 shows the projections of a grey sphere and a grey cube,
both in two variants.

The first variant simply assigns the colour of the sphere and the cube
directly to the pixels that are occupied by the corresponding object.
Iluminacin y Sombreado
This leads to geometric shapes with a homogeneous colour losing
almost the complete information about the three-dimensional
structure. The projection of the sphere is a grey circle, the cube
becomes a grey hexagon.
Iluminacin y Sombreado
Taking illumination and light reflections into account leads to different
light effects on the surfaces of the three-dimensional objects and to a
nonhomogeneous shading of their projections.

In this way, even the flat images appear vivid and provide a three-
dimensional impression as can be seen in figure 8.1

Shading refers to rendering an objects surface with illumination and
light reflection effects.
4.1 Relleno de polgonos

4.2 Modelos bsicos de iluminacin

Light sources
In addition to information about the objects and the viewer, the
description of a three-dimensional scene must also include
information about illumination of the scene.

A single light source or a number of light sources can contribute to
the illumination of a scene.

The colour and intensity of a light source are defined by suitable RGB-
values.
Light sources
The simplest form of light is ambient light.

Ambient light does not come from a specific light source and has no
direction.

It represents the light that is more or less everywhere in the scene,
originating from multiple reflections of light at various surfaces.
Light sources
In a room with a lamp on a table, it will not be completely dark under
the table although the lamp cannot shed its light directly under the
table.

The light is reflected by the surface of the table, the walls, the ceiling
and the floor.

Ambient light is a simplification of the computations for illumination.
Light sources
The correct way to take ambient light into account would be to trace
the multiple reflections of the light completely. This would increase
the computational effort enormously, so that this approach is not
(yet) well suited for real-time computer graphics.

For ambient light it is sufficient to specify its colour.

A directional light source has in addition to a colour also a direction.
Light sources
The light rays from a directional light source are parallel.

Directional light is used to model light coming from a source in almost
infinite distance, for instance sunlight.

A lamp is modelled as a point light source. A point light source has a
position and the light rays spread in all directions from this position.
Light sources
The intensity of the light decreases with increasing distance. This
effect is called attenuation.

The following argument shows that the intensity of the light
decreases quadratically with the distance to the light source.

If a point light source is in the centre of a sphere with radius r, then
the full energy of the light will be distributed equally on the inner part
of the surface of the sphere.
Light sources
If the sphere is replaced by a bigger sphere with radius R, then the full
energy of the light will not change. But it is now distributed to a larger
surface.

The ratio of the surfaces of the two spheres is

Light sources
For a ratio of r/R = 1/2 each point on the inner part of the surface of
the larger sphere receives therefore only one quarter of the energy of
a point on the inner part of the surface of the smaller sphere.

The theoretical model for attenuation would then be to multiply the
intensity of the light from a point light source by the factor
1/
2
when it hits the surface of an object at distanced to the light
source.
Light sources
The decrease of the intensity caused by attenuation is modelled by a
general quadratic polynomial in the denominator in the form


where the constants c1, c2, c3 can be chosen individually for each
point light source, d is the distance of an object to the light source.

This formula guarantees that the intensity can never exceed the value
1.
Light sources
The quadratic decrease of the light intensity comes from the
distribution of the energy of the light onto a larger surface for an
increasing distance.

In addition, part of the light is absorbed by dust particles in the air
causing atmospheric opacity.

This leads obviously to a linear decrease of the intensity with
increasing distance.
Light sources
Another common light source are spotlights (proyectores). In contrast
to a point light source, a spotlight has a direction in which it spreads
its light in the form of a cone.

A spotlight is characterised by the colour of its light, its location, the
direction in which it shines and an angular limit that describes the
extension of the cone of light.
Light sources
Attenuation is computed for a spotlight on the basis of equation (8.1)
in the same way as for point light sources.

The quadratic decrease of the intensity with increasing distance can
also be deduced from figure 8.2 where it can be seen that the full
energy of the light from the spotlight is distributed over a circle
whose radius growth is linear with the distance.

Therefore, the surface grows quadratically with the distance.
Light sources
As




For a more realistic model of a spotlight, it should be taken into
account that the intensity of the light is smaller close to the boundary
of the cone of light than at the centre.







Light sources
In the Warn model a parameter p is used to control how fast the
intensity of the light decreases from the centre of the cone to its
boundary.

Consider a point on a surface that is illuminated by a spotlight. Let l
be a vector that points from the point where the spotlight is located
to a point on the surface of the illuminated object, and let lS be the
axis of the cone pointing in the direction of the light.








Light sources
Then the intensity of light at the point on the surface coming from the
spotlight is computed in the Warn model by

I = IS fatt (cos )

[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

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy