LIGHTING Part One - Theory based on Chapter 6. Lights in the real world Lights bounce off surfaces and reflect colors, scattering light in many directions.

Slides:



Advertisements
Similar presentations
Computer Graphics - Shading -
Advertisements

SI23 Introduction to Computer Graphics
5.1 si31_2001 SI31 Advanced Computer Graphics AGR Lecture 5 A Simple Reflection Model.
1 Graphics CSCI 343, Fall 2013 Lecture 18 Lighting and Shading.
CAP 4703 Computer Graphic Methods Prof. Roy Levow Chapter 6.
Virtual Realism LIGHTING AND SHADING. Lighting & Shading Approximate physical reality Ray tracing: Follow light rays through a scene Accurate, but expensive.
1 Computer Graphics By : Mohammed abu Lamdy ITGD3107 University of Palestine Supervision: Assistant Professor Dr. Sana’a Wafa Al-Sayegh.
1. What is Lighting? 2 Example 1. Find the cubic polynomial or that passes through the four points and satisfies 1.As a photon Metal Insulator.
Based on slides created by Edward Angel
1 Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009 Shading I.
University of New Mexico
Computer Graphics - Class 10
IMGD 1001: Illumination by Mark Claypool
Lighting and Shading Wen-Chieh (Steve) Lin
1 CSCE 641: Computer Graphics Lighting Jinxiang Chai.
7M836 Animation & Rendering
Objectives Learn to shade objects so their images appear three- dimensional Learn to shade objects so their images appear three- dimensional Introduce.
6.1 Vis_04 Data Visualization Lecture 6 - A Rough Guide to Rendering.
Illumination and Shading
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Shading I Ed Angel Professor of Computer Science, Electrical and Computer Engineering,
Course Website: Computer Graphics 16: Illumination.
Lighting & Shading.
Shading Surface can either (both) 1.Emit light. E.g. light bult 2.Reflect light. E.g. Mirror.
CS 480/680 Computer Graphics Shading I Dr. Frederick C Harris, Jr.
SET09115 Intro Graphics Programming
Illumination.
Fundamentals of Computer Graphics Part 6 Shading prof.ing.Václav Skala, CSc. University of West Bohemia Plzeň, Czech Republic ©2002 Prepared with Angel,E.:
CS 445 / 645: Introductory Computer Graphics
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
Shading (introduction to rendering). Rendering  We know how to specify the geometry but how is the color calculated.
COMPUTER GRAPHICS CS 482 – FALL 2014 AUGUST 27, 2014 FIXED-FUNCTION 3D GRAPHICS MESH SPECIFICATION LIGHTING SPECIFICATION REFLECTION SHADING HIERARCHICAL.
CSC418 Computer Graphics n Illumination n Lights n Lightinging models.
Rendering Overview CSE 3541 Matt Boggus. Rendering Algorithmically generating a 2D image from 3D models Raster graphics.
David Luebke 1 10/26/2015 Lighting CS 445/645 Introduction to Computer Graphics David Luebke, Spring 2003.
Steve Sterley. Real World Lighting Physical objects tend to interact with light in three ways: Absorption (black body) Reflection (mirror) Transmission.
University of Texas at Austin CS 378 – Game Technology Don Fussell CS 378: Computer Game Technology Basic Rendering Pipeline and Shading Spring 2012.
CSE 381 – Advanced Game Programming GLSL Lighting.
Illumination.
Illumination and Shading
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
Lecture Fall 2001 Illumination and Shading in OpenGL Light Sources Empirical Illumination Shading Transforming Normals Tong-Yee Lee.
Specular Reflection Lecture 27 Mon, Nov 10, 2003.
Local Illumination and Shading
Cornell CS465 Spring 2004 Lecture 4© 2004 Steve Marschner 1 Shading CS 465 Lecture 4.
Illumination and Shading Prof. Lizhuang Ma Shanghai Jiao Tong University.
Basic Lighting and Shading. The Important Properties of Light It can Reflect, bend, spread and scatter.
Where We Stand So far we know how to: –Transform between spaces –Rasterize –Decide what’s in front Next –Deciding its intensity and color.
Lighting and Shading Part 2. Global Ambient Light There are at least 8 OpenGL lights and 1 Global Ambient Setting the Global Ambient globalAmbient[] =
1 CSCE 441: Computer Graphics Lighting Jinxiang Chai.
OpenGL Shading. 2 Objectives Learn to shade objects so their images appear three-dimensional Introduce the types of light-material interactions Build.
Lighting and Reflection Angel Angel: Interactive Computer Graphics5E © Addison-Wesley
1 CSCE 441: Computer Graphics Lighting Jinxiang Chai.
Computer Graphics Lecture 25 Fasih ur Rehman. Last Class Shading.
CS552: Computer Graphics Lecture 33: Illumination and Shading.
1 CSCE 441: Computer Graphics Lighting Jinxiang Chai.
Computer Graphics Ken-Yi Lee National Taiwan University (the slides are adapted from Bing-Yi Chen and Yung-Yu Chuang)
Computer Graphics: Illumination
Illumination and Shading. Illumination (Lighting) Model the interaction of light with surface points to determine their final color and brightness OpenGL.
© University of Wisconsin, CS559 Spring 2004
Shading To determine the correct shades of color on the surface of graphical objects.
Unit-7 Lighting and Shading
CSC461: Lecture 23 Shading Computation
CSE 470 Introduction to Computer Graphics Arizona State University
Fundamentals of Computer Graphics Part 6 Shading
Isaac Gang University of Mary Hardin-Baylor
Chapter IX Lighting.
Illumination Model 고려대학교 컴퓨터 그래픽스 연구실.
Illumination Model 고려대학교 컴퓨터 그래픽스 연구실.
CS 480/680 Computer Graphics Shading.
Lighting Calculations
Presentation transcript:

LIGHTING Part One - Theory based on Chapter 6

Lights in the real world Lights bounce off surfaces and reflect colors, scattering light in many directions. recursive process Numeric methods are not fast enough to generate true lighting effects in real-time close is usually good enough So… We use a simpler lighting model, such the Phong Reflection Model figure 6.1

Components of Lighting Model? What are the components (variables) of a lighting model? Light Sources Location distance direction of light rays Color red, green, blue Surfaces Color Location orientation Material reflectivity

Surface Types 1.Specular mirrors are perfectly specular 2.Diffuse perfectly diffuse scatters light in all directions, thus appears the same to all viewers 3.Translucent 4.Emissive We must specify ambient, specular and diffuse for all surfaces. figure 6.4

Types of Lights Ambient easiest to model Point Sources scene with a single point source tend to have high contrast, so add some ambient Spot Lights same as point source, but light does not emit in 360 o Distant reflection across a surface does not change from point to point [ x, y, z, 1 ] is a local point [ x, y, z, 0 ] is a distant point

light intensity

spot light effects a true spot light is not equally intense from side to side think of a flashlight cos e Φ exponent e controls the intensity drop off figure 6.12

Phong Reflection Model I = L a R a + L d R d + L s R s L = light R = reflection a = ambient d = diffuse s = specular We calculate the intensity for each point. Each light source adds more color. Lights and Reflections have red,green,blue components. We usually also add a global ambient component.

Uses four vectors n = normal v = direction to viewer l = direction to light source r = direction of perfectly reflected light ray vectors can change from point to point on a surface Phong Reflection Model figure 6.13

Ambient Component ambient light reflects evenly across the surface, so calculation is simple Ia = La Ka where Ka is the material's ambient coefficient 0 ≤ Ka ≤ 1

Diffuse Component

Specular Component To determine glare, we need to factor in the difference between the direction to the viewer (v) and the perfect reflection (r). That angle is Φ. We also need to account for the shininess (α) I s = K s L s cos α Φ α near infinity is a perfect mirror α between 100 and 500 is metal What about distance? What if cos Φ is negative? max ( (l  n), 0 )

Combining all Components

Finding Normal Vectors Given 3 non-linear points, P1 P2 P3 n = (P3 - P1) X (P2 - P1) remember to observe the right hand rule nx = (P3y-P2y)(P2z-P1z) - (P3z-P2z)(P2y-P1y) ny = (P3z-P2z)(P2x-P1x) - (P3x-P2x)(P2z-P1z) nz = (P3x-P2x)(P2y-P1y) - (P3y-P2y)(P2x-P1x)

Implementation Issues Which model do we use A. Constant shading with distant source B. Interpolative shading with distant source C. Constant shading with local source D. Interpolative shading with local source

Implementation Issues Last line of the Fragment Shader: gl_FragColor = ambient + diffuse + specular; Where do we compute those values? A. inside the application B. in the vertex shader C. in the fragment shader D. some combination of those

Next Time Lighting Code Exam #2