LIGHTING 1 OUTLINE Review Factors affecting light Review - - PowerPoint PPT Presentation

lighting
SMART_READER_LITE
LIVE PREVIEW

LIGHTING 1 OUTLINE Review Factors affecting light Review - - PowerPoint PPT Presentation

LIGHTING 1 OUTLINE Review Factors affecting light Review Types of lights Materials Lighting Computations Implementing Lighting Gouraud Shading Phong Shading Blinn-Phong Shading Combining Light


slide-1
SLIDE 1

1

LIGHTING

slide-2
SLIDE 2

OUTLINE

  • Review – Factors affecting light
  • Review – Types of lights
  • Materials
  • Lighting Computations
  • Implementing Lighting
  • Gouraud Shading
  • Phong Shading
  • Blinn-Phong Shading
  • Combining Light and Texture

2

slide-3
SLIDE 3

FACTORS AFFECTING LIGHT

  • Type of light source
  • Ambient, diffuse and specular components
  • Object material
  • Ambient, diffuse and specular characteristics
  • Object’s shininess
  • Angle at which light hits object
  • Angle of incidence
  • Angle from which object is viewed
slide-4
SLIDE 4
slide-5
SLIDE 5

TYPES OF LIGHTS

  • Global
  • “Global ambient”
  • Only includes an ambient component
  • Directional (or distant)
  • No location, only a direction
  • Positional (point source)
  • Location and direction
  • May include attenuation factors
  • Spotlight
  • Location, direction, cutoff and exponent (intensity factor)
slide-6
SLIDE 6

POSITIONAL AND SPOTLIGHT ATTENUATION

slide-7
SLIDE 7

SPOTLIGHT

slide-8
SLIDE 8

MATERIALS

  • Ambient, diffuse and specular characteristics
  • One each for R, G, B
  • Shininess coefficient
  • Transparency
  • Emissiveness
  • graphicsLib3D includes predefined materials of GOLD, SILVER and BRONZE
  • e.g.: graphicsLib3D.Materials.BRONZE
slide-9
SLIDE 9

LIGHTING COMPUTATIONS

slide-10
SLIDE 10

LIGHTING - DIFFUSE

slide-11
SLIDE 11

LIGHTING - SPECULAR

slide-12
SLIDE 12

SHININESS COEFFICIENT (N IN PREVIOUS SLIDE)

slide-13
SLIDE 13

FACETED SHADING

slide-14
SLIDE 14

GOURAUD SHADING

  • Determine the lighting/color at each vertex
  • Interpolate between vertices
  • Using the normal rasterization process
  • Means that lighting will be done in the vertex shader
slide-15
SLIDE 15
slide-16
SLIDE 16

PHONG SHADING

  • Shading done per pixel instead of per vertex
  • Normal and light vectors calculated in vertex shader
  • Interpolation done per pixel in the fragment shader
slide-17
SLIDE 17

PHONG SHADING

  • Normals get interpolated instead of just colors
slide-18
SLIDE 18

PHONG SHADING

  • Drawback is that it is expensive to calculate
slide-19
SLIDE 19

BLINN-PHONG SHADING

  • Instead of calculating R, use L + V to calculate H
  • Angle α not exactly the same as ψ, but gives very similar results
slide-20
SLIDE 20

BLINN-PHONG LIGHTING

slide-21
SLIDE 21

EXTERNAL MODELS AND PHONG LIGHTING

  • Both use Phong lighting
  • Stanford dragon has over 800,000 triangles
slide-22
SLIDE 22

COMBINING LIGHT AND TEXTURE

  • If only a texture (no material):
  • fragColor = textureColor *

(ambientLight + diffuseLight) + specularLight

  • If both texture and material:
  • fragColor = textureColor *

(ambientLight + diffuseLight + specularLight)

  • Can use weighted sum when there are

multiple lights and/or textures

slide-23
SLIDE 23

SUMMARY

  • Review – Factors affecting light
  • Review – Types of lights
  • Materials
  • Lighting Computations
  • Implementing Lighting
  • Gouraud Shading
  • Phong Shading
  • Blinn-Phong Shading
  • Combining Light and Texture

23