Lighting
Download
1 / 33

Lighting - PowerPoint PPT Presentation


  • 82 Views
  • Uploaded on

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)

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about ' Lighting' - tarmon


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
Lighting

Lighting

Jeff Chastine


What is light
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://en.wikipedia.org/wiki/File:Global_illumination.JPG

http://darrentakenaga.com/3d.html

Jeff Chastine


A basic lighting concept
A Basic Lighting Concept

  • How can we determine how much light should be cast onto a triangle from a directional light?

Directional light - position doesn’t matter

- triangle is almost fully lit

P0

P1

P2

Jeff Chastine


A basic lighting concept1
A Basic Lighting Concept

  • How can we determine how much light should be cast onto a triangle from a directional light?

P0

(Triangle less lit)

P1

P2

Jeff Chastine


A basic lighting concept2
A Basic Lighting Concept

  • How can we determine how much light should be cast onto a triangle from a directional light?

P0

P1

P2

(Little to no light hits the surface)

Jeff Chastine


A basic lighting concept3
A Basic Lighting Concept

  • How can we determine how much light should be cast onto a triangle from a directional light?

P0

(Directional light)

P1

P2

Jeff Chastine


A basic lighting concept4
A Basic Lighting Concept

  • How can we determine how much light should be cast onto a triangle from a directional light?

P0

(Directional light)

P1

P2

Jeff Chastine


A basic lighting concept5
A Basic Lighting Concept

  • How can we determine how much light should be cast onto a triangle from a directional light?

Lesson learned: Lighting depends on angles between vectors!

P0

(Directional light)

P1

P2

Jeff Chastine


A basic lighting concept6
A Basic Lighting Concept

  • How can we determine how much light should be cast onto a triangle from a directional light?

P0

(Directional light)

P1

P2

Assuming N and L are normalized, and N∙L isn’t negative

Jeff Chastine


Basic lighting
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

Jeff Chastine


Basic lighting1
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

Jeff Chastine


Basic lighting2
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+Ambient

Ambient

Jeff Chastine


Basic lighting3
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!

Jeff Chastine


Interaction between material and lights
Interaction between Material and Lights

  • Final color of an object is comprised of many things:

    • The base object color (called a “material”)

    • The light color

    • Example: a purple light on a white surface

    • Any textures we apply (later)

  • Materials and lights have four individual components

    • Diffuse color (cdand ld)

    • Specular color (csand ls)

    • Ambient color (caand la)

    • Emit color (ceand le)

    • cd* ld = [cd.r*ld.r, cd.g*ld.g, cd.b*ld.b] // R, G, B

Jeff Chastine


General lighting
General Lighting

  • Primary vectors

    • l – the incoming light vector

    • n – the normal of the plane/vertex

    • r – the reflection vector

    • v – the viewpoint (camera)

v

n

l

r

θ

θ

Jeff Chastine


Lambertian reflectance diffuse component
LambertianReFlectance(diffuse Component)

  • Light falling on an object is the same regardless of the observer’s viewpoint

  • Good for rough surfaces without specular highlights

  • where and are normalized

n

l

θ

Jeff Chastine


Lambertian reflectance diffuse component1
LambertianReFlectance(diffuse Component)

  • Light falling on an object is the same regardless of the observer’s viewpoint

  • Good for rough surfaces without specular highlights

  • where and are normalized

3 parts (R, G, B)

scalar

n

l

θ

Note: final_colordiffusehas R, G, B

Jeff Chastine


Lambertian reflectance diffuse component2
LambertianReFlectance(diffuse Component)

  • Technically, it should be:

n

l

θ

Jeff Chastine


Blinn phong reflection specular component
BLINN-PHONG Reflection(Specular Component)

  • Describes the specular highlight and is dependent on viewpoint v

  • Also describes a “half-vector” h that is halfway between v and l

h

v

n

r

l

θ

θ

Jeff Chastine


Blinn phong reflection specular component1
BLINN-PHONG Reflection(Specular Component)

  • - which is really Blinn’s contribution to the original Phong model

h

v

n

r

l

θ

θ

Note: vectors should be normalized

Jeff Chastine


Blinn phong reflection specular component2
BLINN-PHONG Reflection(Specular Component)

  • Our final specular equation is:

h

v

n

r

l

θ

θ

Jeff Chastine


Determining
Determining

  • Realize that will always be < 1.0, so raising it to a power will make it smaller

  • is the “shininess” factor

    • It relates to the size of the specular highlight

s = ~1

s = ~30

s = ~255

Jeff Chastine


Ambient and emit components
Ambient and Emit Components

  • Ambient:

    • Used to simulate light bouncing around the environment (global illumination)

    • Real world is far too complex for real time, so just add a little light!

  • Emit:

    • Used to make the object “glow”

    • Does not emit light!!!

  • Both:

    • Independent of viewpoint

    • Super easy to calculate

Jeff Chastine


Final color
Final Color

  • To determine the final color (excluding textures) we sum up all components:

final_colordiffuse

final_colorspecular

final_colorambient

final_coloremit

final_color

+

http://en.wikipedia.org/wiki/Phong_reflection_model

Jeff Chastine


What about multiple lights
What about Multiple lights?

  • Calculate final colors and sum them all together

  • Assuming results are in f [ ] and there are count number of lights

Jeff Chastine


Common kinds of lights
Common Kinds of Lights

  • Point light

  • Directional Light

  • Spot Light

  • Area Light

  • Interesting fact:

    • Lights cannot be seen!

    • Only their effects

    • We can light per vertex (fast) or per fragment (slower)

Jeff Chastine


Point lights
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”):

Here, per fragment lighting used

Jeff Chastine


Point lights1
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”):

Here, per vertex lighting used

Jeff Chastine


Directional lights
Directional Lights

  • Are infinitely far away

    • position in NO WAY matters

    • Have only direction

  • All objects are lit evenly

  • Sometimes called a “Sun”

Jeff Chastine


Spotlights
Spotlights

  • Point light source

  • Conical in shape

Jeff Chastine


Spotlights1
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


Area lights
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

Jeff Chastine


The end

What you’ll see if you don’t glEnable(GL_LIGHTING)

The End!


ad