Lightingksuweb.kennesaw.edu/.../CGDD4003/Slides/Lighting.pdf · 2016-09-13 · Here, per vertex...
Transcript of Lightingksuweb.kennesaw.edu/.../CGDD4003/Slides/Lighting.pdf · 2016-09-13 · Here, per vertex...
LIGHTING
WHAT IS LIGHT?• A very complex process
• Find a dark area – how is it being lit?
• Light bounces (mirrors, shiny objects)
• Light refracts through other media (water, heat)
• Light comes from everywhere (Global Illumination)
• Light bounces off of lakes in weird ways (Fresnel effect)
• THUS
• We’re forced to make approximations
• Tradeoff between time and realism
• “If it looks good, it is good” – Michael Abrash
http://darrentakenaga.com/3d.html
http://en.wikipedia.org/wiki/File:Global_illumination.JPG
TWO COMPONENTS
• Light Source Properties
• Color (Wavelength(s) of light)
• Shape
• Direction
• Object Properties
• Material
• Geometry
• Absorption
GLOBAL EFFECTS
translucent surface
shadow
multiple reflection
A BASIC LIGHTING CONCEPT• How can we determine how much light should be cast onto a triangle from a directional
light?
P2
P0
P1
Directional light - position doesn’t matter- triangle is almost fully lit
𝑁𝑁
5
A BASIC LIGHTING CONCEPT• How can we determine how much light should be cast onto a triangle from a directional
light?
P2
P0
P1
(Triangle less lit)𝑁𝑁
6
A BASIC LIGHTING CONCEPT• How can we determine how much light should be cast onto a triangle from a directional
light?
P2
P0
P1
(Little to no light hits the surface)
𝑁𝑁
7
A BASIC LIGHTING CONCEPT• How can we determine how much light should be cast onto a triangle from a directional
light?
P2
P0
P1
(Directional light)𝑁𝑁
8
A BASIC LIGHTING CONCEPT• How can we determine how much light should be cast onto a triangle from a directional
light?
P2
P0
P1
(Directional light)𝑁𝑁
𝐿𝐿
9
BASIC LIGHTING• Four independent components:
• Diffuse – the way light “falls off” of an object
• Specular – the “shininess” of the object
• Ambient – a minimum amount of light used to simulate “global illumination”
• Emit – a “glowing” effect
Only diffuse
10
BASIC LIGHTING• Four independent components:
• Diffuse – the way light “falls off” of an object
• Specular – the “shininess” of the object
• Ambient – a minimum amount of light used to simulate “global illumination”
• Emit – a “glowing” effect
Diffuse+Specular
11
BASIC LIGHTING• Four independent components:
• Diffuse – the way light “falls off” of an object
• Specular – the “shininess” of the object
• Ambient – a minimum amount of light used to simulate “global illumination”
• Emit – a “glowing” effect
Ambient
Diffuse+Specular+Ambient
12
BASIC LIGHTING• Four independent components:
• Diffuse – the way light “falls off” of an object
• Specular – the “shininess” of the object
• Ambient – a minimum amount of light used to simulate “global illumination”
• Emit – a “glowing” effect
D+S+A+Emit
Note: emit does not produce light!13
LIGHT SOURCE DIRECTION
• In computer graphics, we usually treat lights as rays emanating from a source. The direction of these rays can either be:
• Omni-directional (point light source)
• Directional angle (spotlights)
• Directional (parallel rays)
POINT LIGHTS• These lights have a position in 3D space
• Sometimes called a “Lamp”
• Light emanates from the light in all directions
• Distance d determines brightness (“attenuation”):
𝑖𝑖𝑖𝑖𝑖𝑖𝑖𝑖𝑖𝑖𝑖𝑖𝑖𝑖𝑖𝑖𝑖𝑖 = 1/𝑑𝑑2
Here, per fragment lighting used15
POINT LIGHTS• These lights have a position in 3D space
• Sometimes called a “Lamp”
• Light emanates from the light in all directions
• Distance d determines brightness (“attenuation”):
𝑖𝑖𝑖𝑖𝑖𝑖𝑖𝑖𝑖𝑖𝑖𝑖𝑖𝑖𝑖𝑖𝑖𝑖 = 1/𝑑𝑑2
Here, per vertex lighting used16
DIRECTIONAL LIGHTS• Are infinitely far away
• position in NO WAY matters
• Have only direction
• All objects are lit evenly
• Sometimes called a “Sun”
17
SPOTLIGHTS• Point light source
• Conical in shape
18
SPOTLIGHTS• Point light source
• Conical in shape
• Have:
• An inner and outer cone angle
• Umbra – areas that are fully in shadow
• Penumbra – areas that are in partial shadow
• Note: There’s an ambient light
JEFF CHASTINE 19
AREA LIGHTS• A “surface” lights objects
• Has a position and direction
• Provides for a smoother drop off than point
• Larger surface == smoother shadows
• Expensive to calculate
20