/
Lighting Jeff Chastine Lighting Jeff Chastine

Lighting Jeff Chastine - PowerPoint Presentation

kittie-lecroy
kittie-lecroy . @kittie-lecroy
Follow
352 views
Uploaded On 2020-01-10

Lighting Jeff Chastine - PPT Presentation

Lighting Jeff Chastine 1 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 ID: 772453

jeff light lighting chastine light jeff chastine lighting directional specular color diffuse lights basic emit object final triangle ambient

Share:

Link:

Embed:

Download Presentation from below link

Download Presentation The PPT/PDF document "Lighting Jeff Chastine" is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.


Presentation Transcript

Lighting Jeff Chastine 1

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)THUSWe’re forced to make approximationsTradeoff 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 Jeff Chastine

Two components Light Source Properties Color (Wavelength(s) of light) Shape DirectionObject PropertiesMaterialGeometryAbsorption

4 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? P 2 P 0 P 1 Directional light - position doesn’t matter - triangle is almost fully lit   Jeff Chastine 5

A Basic Lighting Concept How can we determine how much light should be cast onto a triangle from a directional light? P 2 P 0 P 1 (Triangle less lit)   Jeff Chastine 6

A Basic Lighting Concept How can we determine how much light should be cast onto a triangle from a directional light? P 2 P 0 P 1 (Little to no light hits the surface)   Jeff Chastine 7

A Basic Lighting Concept How can we determine how much light should be cast onto a triangle from a directional light? P 2 P 0 P 1 (Directional light)   Jeff Chastine 8

A Basic Lighting Concept How can we determine how much light should be cast onto a triangle from a directional light? P 2 P 0 P 1 (Directional light)     Jeff Chastine 9

A Basic Lighting Concept How can we determine how much light should be cast onto a triangle from a directional light? P 2 P 0 P 1 (Directional light)     Lesson learned: Lighting depends on angles between vectors! Jeff Chastine 10

A Basic Lighting Concept How can we determine how much light should be cast onto a triangle from a directional light? P 2 P 0 P 1 (Directional light)       Assuming N and L are normalized, and N∙L isn’t negative Jeff Chastine 11

Basic Lighting Four independent components: Diffuse – the way light “falls off” of an object Specular – the “shininess” of the objectAmbient – a minimum amount of light used to simulate “global illumination”Emit – a “glowing” effect Only diffuse Jeff Chastine 12

Basic Lighting Four independent components: Diffuse – the way light “falls off” of an object Specular – the “shininess” of the objectAmbient – a minimum amount of light used to simulate “global illumination”Emit – a “glowing” effect Diffuse+Specular Jeff Chastine 13

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 Jeff Chastine 14

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 15

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 surfaceAny textures we apply (later)Materials and lights have four individual componentsDiffuse color (cd and ld) Specular color (cs and l s) Ambient color ( ca and la) Emit color (c e and l e ) c d * l d = [cd.r*ld.r , cd.g* ld.g , cd.b*ld.b] // R, G, BJeff Chastine16

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)

General Lighting Primary vectors l – the incoming light vector n – the normal of the plane/vertexr – the reflection vectorv – the viewpoint (camera) l n r θ θ v Jeff Chastine 18

Diffuse Term Contribution that a light has on the surface, regardless of viewing direction . A ray of light coming in has an equal chance of being reflected in any direction.What are some ideal diffuse surfaces?

Lambertian ReFlectance(diffuse Component) Light falling on an object is the same regardless of the observer’s viewpointGood for rough surfaces without specular highlights where and are normalized  l n θ Jeff Chastine 20

Lambertian ReFlectance(diffuse Component) Light falling on an object is the same regardless of the observer’s viewpointGood for rough surfaces without specular highlights where and are normalized  l n θ Note: final_color diffuse has R, G, B scalar 3 parts (R, G, B) Jeff Chastine 21

Lambertian ReFlectance(diffuse Component) Technically, it should be:   l n θ Jeff Chastine 22

BLINN-PHONG Reflection (Specular Component) Describes the specular highlight and is dependent on viewpoint vAlso describes a “half-vector” h that is halfway between v and l l n r θ θ v h Jeff Chastine 23

BLINN-PHONG Reflection (Specular Component) - which is really Blinn’s contribution to the original Phong model   l n r θ θ v h Note: vectors should be normalized Jeff Chastine 24

BLINN-PHONG Reflection (Specular Component) Our final specular equation is:   l n r θ θ v h Jeff Chastine 25

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 26  

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 viewpointSuper easy to calculate   Jeff Chastine 27

Final Color To determine the final color (excluding textures) we sum up all components: http://en.wikipedia.org/wiki/Phong_reflection_model final_color diffuse final_color specular final_colorambientfinal_color emit final_color + Jeff Chastine 28

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 29

Common Kinds of Lights Point light Directional Light Spot Light Area LightInteresting fact:Lights cannot be seen!Only their effectsWe can light per vertex (fast) or per fragment (slower)Jeff Chastine30

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 31

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 32

Directional Lights Are infinitely far away position in NO WAY matters Have only directionAll objects are lit evenlySometimes called a “Sun” Jeff Chastine 33

Spotlights Point light source Conical in shape Jeff Chastine 34

Spotlights Point light source Conical in shape Have: An inner and outer cone angleUmbra – areas that are fully in shadowPenumbra – areas that are in partial shadowNote: There’s an ambient light Jeff Chastine 35

Area Lights A “surface” lights objects Has a position and direction Provides for a smoother drop off than point Larger surface == smoother shadowsExpensive to calculate Jeff Chastine 36

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