Lighting and Shading Flashcards
(22 cards)
3 major shading techniques
?
interactions between light and materials can be classified into the 3 groups
- Specular surfaces
- Diffuse surfaces
- Translucent surfaces
Specular surfaces
appear shiny because most of the light that is reflected or
scattered is in a narrow range of angles close to the angle of reflection.Mirrors
are perfectly specular surfaces
Diffuse surfaces
characterized by reflected light being scattered in all
directions. Walls painted with matte or flat paint are diffuse reflectors.
Perfectly diffuse surfaces scatter light equally in all directions,
Translucent surfaces
allow some light to penetrate the surface and to emerge
from another location on the object
Polygonal Mesh
A polygonal mesh comprises many flat polygons, each of which has a well-defined normal
3 ways to shade polygons
- Flat shading
- Gouraud Shading
- Phong Shading
Flat shading
(constant shading)
The shading calculation is carried out only once for each polygon, and each point on the polygon is assigned the same shade. Flat shading will show differences in shading among adjacent polygons
Gouraud shading
(smooth shading)
(Vertex shader)
The lighting calculation is done at each vertex using the material properties and the vectors π, π, and π . Thus, each vertex will have its own colour that the rasterizer can use to interpolate a shade for each fragment
Phong shading
(Fragment shader)
Instead of interpolating vertex intensities (colours), we interpolate normals across each polygon. We can thus make an independent lighting calculation for each fragment. We implement Phong shading in the fragment shader.
4 types of light sources
- Ambient Light
- Point Light (source)
- Spotlights
- Distant Light (source)
Ambient Light
Ambient illumination is characterized by an intensity, πΌa, that is identical at every point in the scene. (In many rooms, such as class rooms, the lights have been designed and positioned to provide uniform illumination throughout the room )
Point source
An ideal point source emits light equally in all directions. The intensity of illumination received from a point source is proportional to the inverse square of the distance between the source and surface, called the distance term
Spotlight
Spotlights are characterized by a narrow range of angles (a cone) through which light is emitted. More realistic spotlights are characterized by the distribution of light within the cone β usually with most of the light concentrated in the centre of the cone.
Distant Light Source
All rays are parallel and we replace the location (point) of the light source with the direction (vector) of the light.
Local Lighting Models
- Phong
- Model source from light reflected once off a surface towards the eye
- Indirect light is included with an ad hoc βambientβ term which is normally constant across the scene
Global Lighting Models
- Raytracing or radiosity
- Try to measure light propagation in the scene
- Model interaction between objects and other objects and
objects and their environment
Phong Reflection Model: 4 vectors used for calculations
- n: the normal at p
- v: direction from p to the COP/viewer
- l: direction from p to an arbitrary point on the light source
- r: direction that a perfectly reflected ray would take from
Phong Reflection Model: Ambient
The intensity of ambient light πΌa is the same at every point on the surface. Some of this light is absorbed and some are reflected. The amount reflected is given by the ambient reflection coefficient
Phong Reflection Model: Ambient
The intensity of ambient light πΌa is the same at every point on the surface. Some of this light is absorbed and some is reflected. The amount reflected is given by the ambient reflection coefficient
Phong Reflection Model: Lamberts Law
- we see only the vertical component of the incoming light
- π πβcosπ
- where π is the angle between the normal at the point of interest π and the direction of the light source π
- If both π and π are unit-length vectors, then
- cosπ=πβπ
Phong Reflection Model: Diffuse Reflection
- add in a reflection coefficient πd (0β€πdβ€1) representing the fraction of incoming diffuse light that is reflected we have the diffuse reflection term
- πΌd=πdπΏd(πβπ)