lighting
play

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


  1. LIGHTING 1

  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

  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 •

  4. 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) •

  5. POSITIONAL AND SPOTLIGHT ATTENUATION

  6. SPOTLIGHT

  7. 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 •

  8. LIGHTING COMPUTATIONS

  9. LIGHTING - DIFFUSE

  10. LIGHTING - SPECULAR

  11. SHININESS COEFFICIENT (N IN PREVIOUS SLIDE)

  12. FACETED SHADING

  13. 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

  14. 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

  15. PHONG SHADING • Normals get interpolated instead of just colors

  16. PHONG SHADING • Drawback is that it is expensive to calculate

  17. BLINN-PHONG SHADING • Instead of calculating R, use L + V to calculate H Angle α not exactly the same as ψ , but gives very similar results •

  18. BLINN-PHONG LIGHTING

  19. EXTERNAL MODELS AND PHONG LIGHTING Both use Phong lighting • • Stanford dragon has over 800,000 triangles

  20. 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

  21. 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

Recommend


More recommend