Title: Lighting and Shading
1Lighting and Shading
2Topics
- Illumination in Imaging pipeline
- Surface Rendering
- Shading
- Reflectance and refraction properties
- Light Sources
- VRML
3Lighting, Shading and reflectance
- shadowing and shading give realism and depth
- Combination of surface properties and the light
sources used - Surfaces are constructed to reflect or refract
the light - Colour and texture used with different methods to
render result
4(No Transcript)
5Example
6Wireframe model Orthographic views
7Perspective View
8Depth Cue
9Hidden Line Removal add colour
10Constant Shading - Ambient
11Faceted Shading - Flat
12Gouraud shading, no specular highlights
13Specular highlights added
14Phong shading
15Texture Mapping
16Texture Mapping
17Reflections, shadows Bump mapping
18Lighting, Shading
- Lighting and shading give objects shape
- Important effects
- shading
- shiny highlights
- reflections
- shadows
- Local techniques simplify these effects to
improve performance
19Shading/ lighting
- Diffuse ambient light creates no shading...
Simplest - Illumination can vary by angle between N (normal
to the polygon) and L (the source) - Source of illumination can be a point or a region
(expressed as cosn ?). The larger the n the
narrower the beam - Compute N and L across polygon face
20Shading
- Can interpolate shade across a polygon
- Gouraud shading interpolates shade across edges,
reduces effect of intensity change. - Phong shading (and illumination) interpolates
surface normal vector across polygons then
interpolates illumination.
21(No Transcript)
22Gouraud Shading
- Compute shading for each pixel by averaging
shading based on distance and shading of vertices.
23Different Illumination
24Different Illumination
25Global illumination
- Global techniques provide more accuracy by
simulating light propagation among all surfaces
in a 3D world. - Local shading (Gauroud shading, Phong shading)
does not calculate global effect (shadow,
reflection, refraction, scattering, etc) - Technique
- ray tracing
- radiosity
26Solid Modeling
- Which surfaces should be drawn?
- Object space methods
- Hidden Surface Removal
- Painters Algorithm
- BSP Trees
- Image space methods
- Z-Buffering
- Ray Casting
27(No Transcript)
28Ray Tracing
- Image space technique that mimics physical
processes of light - Extremely computationally intensive, but
beautiful - Hidden surface removal
- Transparency
- Reflections
- Refraction
- Ambient lighting
- Point source lighting
- Shadows
29Shadows and beyond
- Can be computationally intensive, project each
polygon on light source find projection on other
polygons - 3D shadows, transparency, fog and atmospherics
all complicate the computation.
30Why Lighting?
-
- What light source is used and how the object
response to the light makes difference - Ocean looks bright bluish green in sunny day but
dim gray green in cloudy day - Lighting gives you a 3D view to an object
- A unlit sphere looks no different from a 2D disk
- To get realistic pictures, the color computation
of pixels must include lighting calculations
31Types of Light
- Ambient
- Light thats been scattered so much by the
environment that its direction is impossible to
determine - it seems to come from all directions - Diffuse
- Light that comes from one direction, but it gets
scattered equally in all directions - Specular
- Light comes from a particular direction, and its
tends to bounce off the surface in a preferred
direction
32Materials Colors
- A materials color depends on the percentage of
the incoming different lights it reflects - Materials have different ambient, diffuse and
specular reflectances - Material can also have an emissive color which
simulates light originating from an object - Headlights on a automobile
33VRML Lighting Model
- Lighting has four independent components that are
computed independently - Emissive, Ambient, Diffuse, and Specular
- VRML approximates lighting as if light can be
broken into red, green, and blue components - The RGB values for lights mean different than for
materials - For light, the numbers correspond to a percentage
of full intensity for each color - For materials, the numbers correspond to the
reflected proportions of those colors
34Theory of Illumination
- Not only knowledge about light but also about
what happens when light is reflected from an
object into our eyes is important to obtain
realistic images - The general problem is to compute the apparent
color at each pixel that corresponds to part of
the object on the screen - The color produced by lighting a vertex (or an
object) has several contributions - Emission
- Global ambient light
- Contributions from light sources
35Adding Lighting to the Scene
- Define normal vectors for each vertex of each
object - Create, select, and position one ore more light
sources - Create and select a lighting model
- Define material properties for the objects in the
scene
36Multiple Lights
- You can define up to eight light sources
- Need to specify all the parameters defining the
position and characteristics of the light - VRML performs calculations to determine how much
light each vertex from each source - Increasing numbers of lights affects performance
37Controlling a Lights Position and Direction
- A light source is subject to the same matrix
transformations as a geometric model - Position or direction is transformed in the same
way that an element of geometry is. - Keeping the light stationary
- Specify the light position
- Independently moving the light
- Set the light position after the modeling
transformation that you want to apply for light - Moving the light together with the viewpoint
- route the light position to the same movement as
the viewpoint
38Defining Material Properties
- Specifying the ambient, diffuse, and specular
colors, the shininess, and the color of any
emitted light - Diffuse and ambient reflection
- Gives color
- Specular reflection
- Produces highlights
- Emission
- Make an object glow (to simulate lamps and other
light sources
39VRML material node
Material exposedField SFFloat ambientIntensity
0.2 0,1 exposedField SFColor diffuseColor
0.8 0.8 0.8 0,1 exposedField SFColor
emissiveColor 0 0 0 0,1 exposedField
SFFloat shininess 0.2 0,1 exposedField
SFColor specularColor 0 0 0 0,1
exposedField SFFloat transparency 0 0,1