Ambient reflection. Jacobs University Visualization and Computer Graphics Lab : Graphics and Visualization 407

Similar documents
CS Computer Graphics: Illumination and Shading I

CS Computer Graphics: Illumination and Shading I

CEng 477 Introduction to Computer Graphics Fall

Computer Graphics Lighting

Computer Graphics Lighting. Why Do We Care About Lighting?

Lighting. CSC 7443: Scientific Information Visualization

INF3320 Computer Graphics and Discrete Geometry

Computer Graphics. Illumination and Shading

Virtual Reality for Human Computer Interaction

Lecture 4 Advanced Computer Graphics (CS & SE )

Light Transport Baoquan Chen 2017

Illumination & Shading I

Reading. Shading. Introduction. An abundance of photons. Required: Angel , Optional: OpenGL red book, chapter 5.

Shading and Illumination

Today s class. Simple shadows Shading Lighting in OpenGL. Informationsteknologi. Wednesday, November 21, 2007 Computer Graphics - Class 10 1

Graphics and Visualization

Overview. Shading. Shading. Why we need shading. Shading Light-material interactions Phong model Shading polygons Shading in OpenGL

蔡侑庭 (Yu-Ting Tsai) National Chiao Tung University, Taiwan. Prof. Wen-Chieh Lin s CG Slides OpenGL 2.1 Specification

Illumination and Shading ECE 567

Illumination Model. The governing principles for computing the. Apply the lighting model at a set of points across the entire surface.

Three-Dimensional Graphics V. Guoying Zhao 1 / 55

Ligh%ng and Shading. Ligh%ng and Shading. q Is this a plate or a ball? q What color should I set for each pixel?

Illumination and Shading

Reading. Shading. An abundance of photons. Introduction. Required: Angel , 6.5, Optional: Angel 6.4 OpenGL red book, chapter 5.

Light Sources. Spotlight model

Shading. Brian Curless CSE 457 Spring 2015

Shading. CSE 457 Winter 2015

Why we need shading?

Lights, Colour and Materials In OpenGL

CS Surface Rendering

ECS 175 COMPUTER GRAPHICS. Ken Joy.! Winter 2014

Realtime 3D Computer Graphics & Virtual Reality. Shading and Color. Introduction to Lighting and Shading

Illumination Models & Shading

CS5620 Intro to Computer Graphics

CSE 681 Illumination and Phong Shading

Shading , Fall 2004 Nancy Pollard Mark Tomczak

Illumination & Shading: Part 1

Illumination in Computer Graphics

Topic 9: Lighting & Reflection models 9/10/2016. Spot the differences. Terminology. Two Components of Illumination. Ambient Light Source

Topic 9: Lighting & Reflection models. Lighting & reflection The Phong reflection model diffuse component ambient component specular component

Shading I Computer Graphics I, Fall 2008

Illumination & Shading

Today we will start to look at illumination models in computer graphics

Lecture 15: Shading-I. CITS3003 Graphics & Animation

Illumination and Shading

Comp 410/510 Computer Graphics. Spring Shading

Lighting and Shading Computer Graphics I Lecture 7. Light Sources Phong Illumination Model Normal Vectors [Angel, Ch

Illumination and Shading

Reflection and Shading

Sung-Eui Yoon ( 윤성의 )

Visualisatie BMT. Rendering. Arjan Kok

Chapter 3. Illumination Models and Surface-Rendering Methods. Department of Computer Science and Engineering

Shading Intro. Shading & Lighting. Light and Matter. Light and Matter

Projections and Hardware Rendering. Brian Curless CSE 557 Fall 2014

COMP3421. Hidden surface removal Illumination

Lighting. Figure 10.1

Rendering. Illumination Model. Wireframe rendering simple, ambiguous Color filling flat without any 3D information

Surface Rendering Methods

Computer Graphics (CS 4731) Lecture 16: Lighting, Shading and Materials (Part 1)

Lighting Models. CS116B Chris Pollett Mar 21, 2004.

Display Issues Week 5

Illumination Models. To calculate the color of an illuminated position on the

OpenGL Lighting Computer Graphics Spring Frank Palermo

Introduction to Computer Graphics. Farhana Bandukwala, PhD Lecture 14: Light Interacting with Surfaces

Lighting/Shading III. Week 7, Wed Mar 3

CENG 477 Introduction to Computer Graphics. Ray Tracing: Shading

Lighting/Shading II. Week 7, Mon Mar 1

Module 5: Video Modeling Lecture 28: Illumination model. The Lecture Contains: Diffuse and Specular Reflection. Objectives_template

CSE 167: Introduction to Computer Graphics Lecture #6: Lights. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2016

CSCI 4620/8626. Computer Graphics Illumination Models and Surface Rendering Methods (Chapter 17)

Computer Graphics (CS 543) Lecture 7b: Intro to lighting, Shading and Materials + Phong Lighting Model

Illumination and Shading

w Foley, Section16.1 Reading

Virtual Reality for Human Computer Interaction

Why Do We Care About Lighting? Computer Graphics Lighting. The Surface Normal. Flat Shading (Per-face) Setting a Surface Normal in OpenGL

CS230 : Computer Graphics Lighting and Shading. Tamar Shinar Computer Science & Engineering UC Riverside

OpenGl Pipeline. triangles, lines, points, images. Per-vertex ops. Primitive assembly. Texturing. Rasterization. Per-fragment ops.

Computer Graphics. Illumination Models and Surface-Rendering Methods. Somsak Walairacht, Computer Engineering, KMITL

CS770/870 Spring 2017 Color and Shading

Today. Global illumination. Shading. Interactive applications. Rendering pipeline. Computergrafik. Shading Introduction Local shading models

University of British Columbia CPSC 314 Computer Graphics Sep-Dec Tamara Munzner (guest lecturing) Lighting/Shading

Shading. Why we need shading. Scattering. Shading. Objectives

Introduction to Computer Graphics 7. Shading

Methodology for Lecture. Importance of Lighting. Outline. Shading Models. Brief primer on Color. Foundations of Computer Graphics (Spring 2010)

CSE 167: Lecture #8: Lighting. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2011

Lighting. Chapter 5. Chapter Objectives. After reading this chapter, you'll be able to do the following:

Chapter 10. Surface-Rendering Methods. Somsak Walairacht, Computer Engineering, KMITL

Today. Global illumination. Shading. Interactive applications. Rendering pipeline. Computergrafik. Shading Introduction Local shading models

Shading Models. Simulate physical phenomena

Illumination. Michael Kazhdan ( /657) HB Ch. 14.1, 14.2 FvDFH 16.1, 16.2

CS Illumination and Shading. Slide 1

Computer Graphics and GPGPU Programming

API for creating a display window and using keyboard/mouse interations. See RayWindow.cpp to see how these are used for Assignment3

Understand how real-world lighting conditions are approximated by OpenGL

CS 4600 Fall Utah School of Computing

CPSC / Illumination and Shading

Computer Graphics. Illumination and Shading

Illumination & Shading

Color and Light. CSCI 4229/5229 Computer Graphics Summer 2008

hw1-2 review hw 3 questions?

Transcription:

Ambient reflection Phong reflection is a local illumination model. It only considers the reflection of light that directly comes from the light source. It does not compute secondary reflection of light that is being reflected at one object and indirectly illuminates another object. To account for secondary reflection, a general light is added that distributes homogeneously through the entire 3D scene. This is called ambient reflection. Ambient light models undirected light from an infinitely large light source. 320322: Graphics and Visualization 407

Ambient reflection The light intensity I a of the ambient light source is distributed constantly throughout the scene. The reflected ambient light I at a surface point can be written as I = k a I a where k a is the ambient reflection coefficient. The ambient reflection coefficient is a constant out of the range [0,1]. It represents the material property of the illuminated object. 320322: Graphics and Visualization 408

Ambient reflection As ambient lighting is not directed, uni-colored and uni-material objects still appear in one color. Still, only the silhouettes can be perceived. The color of the object depends on the amount of reflected light defined by the reflection coefficient. 320322: Graphics and Visualization 409

Ambient reflection Ambient reflection with different reflection coefficients: 320322: Graphics and Visualization 410

Diffuse reflection Diffuse reflection denotes light scattering at a dull surface. The incoming directional light is reflected uniformly in each direction. The intensity of the reflected light is independent of the viewing angle. It depends on the direction of the incoming light ray. 320322: Graphics and Visualization 411

Diffuse reflection Lambert s law: The reflected light intensity I at a point p on a surface is proportional to cos θ, where θ is the angle between the vector l pointing from p to the light source and the surface normal n in point p. 320322: Graphics and Visualization 412

Diffuse reflection The reflected diffuse light I at a surface point p is given by I = I P k d cosθ = I P k d (n l) where I P is the intensity of the diffuse light source and k d is the diffuse reflection coefficient (and assuming that l is normalized). The diffuse reflection coefficient is a constant out of the range [0,1] and represents the material property of the illuminated object. 320322: Graphics and Visualization 413

Diffuse reflection This model assumes that the light source sends out directed light and is of infinitely small extent (point light source). Obviously, I=0 if n l < 0. Taking this into account, we should write: I = I P k d max(n l,0) 320322: Graphics and Visualization 414

Diffuse reflection Attenuation: Light intensity that spreads from a light source with finite extent decreases with increasing distance r P to the light source. We need to add an attenuation factor f att (r P ). We obtain: I = I P k d f att (r P ) max(n l,0). Physical law: f att (r P ) ~ 1/r P2. In practice, we use: f att (r P ) = min (1/(c 0 +c 1 r P + c 2 r P2 ),1) with real constants c 0,c 1, and c 2. 320322: Graphics and Visualization 415

Diffuse reflection 320322: Graphics and Visualization 416

Diffuse reflection Diffuse reflection with different reflection coefficients: 320322: Graphics and Visualization 417

Specular reflection Specular reflection models reflection at shiny surfaces. It adds highlights to the illumination. Phong s specular reflection model is based on perfect mirror reflection of light rays: r: direction of reflection rule: α = β 320322: Graphics and Visualization 418

Specular reflection Specular reflection depends on viewpoint: Specular reflection is highest, if viewpoint is in direction r. 320322: Graphics and Visualization 419

Phong s model: Specular reflection The light intensity I of reflected specular light is dependent on cos α, where α is the angle between the direction of the reflected light ray r and the direction v from the surface point to the viewpoint. 320322: Graphics and Visualization 420

Specular reflection Phong s model: I = I P k s f att (r P ) cos n α = I P k s f att (r P ) (r v) n where k s is the specular reflection coefficient and n is the specular reflection exponent. (and assuming that v is normalized). The specular reflection coefficient is a constant out of the range [0,1]. The specular reflection exponent is a constant natural number. They represents the material property of the illuminated object. 320322: Graphics and Visualization 421

Specular reflection The influence of the specular reflection exponent: 320322: Graphics and Visualization 422

Specular reflection Specular reflection with different reflection coefficients: 320322: Graphics and Visualization 423

Phong reflection model Putting it all together: Considering multiple point light sources P i, the Phong reflection model computes the reflected light intensity 320322: Graphics and Visualization 424

Phong reflection model Thederivedformulaisappliedfora certain wavelength of the light. It has to be applied for light of all wavelengths. Using the RGB color model, we compute the reflection independently for each of the three color channels. 320322: Graphics and Visualization 425

Phong reflection model 320322: Graphics and Visualization 426

How OpenGL Simulates Lights Phong lighting model Computed at vertices Lighting contributors Surface material properties Light properties Lighting model properties 320322: Graphics and Visualization 427

Surface Normals Normals define how a surface reflects light glnormal3f( x, y, z ) Current normal is used to compute vertex color Use unit normals for proper lighting scaling affects a normal s length glenable( GL_NORMALIZE ) 320322: Graphics and Visualization 428

Material Properties In addition to the ambient, diffuse, and specular reflection, OpenGL also allows a surface to emit light. The emitted light is constant and is added to the reflected component. Emitting surfaces do not affect other objects, i.e., they do not appear as light sources. 320322: Graphics and Visualization 429

Material Properties Define the surface properties of a primitive glmaterialfv( face, property, value ); GL_DIFFUSE GL_SPECULAR GL_AMBIENT GL_EMISSION GL_SHININESS Diffuse refl. coeff. Specular refl. coeff. Ambient refl. coeff. Emission Specular refl. exponent separate materials for front and back of a face 320322: Graphics and Visualization 430

Light Properties gllightfv( light, property, value ); light specifies which light is affected multiple lights, starting with GL_LIGHT0 glgetintegerv( GL_MAX_LIGHTS, &n ); properties colors position and type attenuation 320322: Graphics and Visualization 431

Light Colors Light color properties GL_AMBIENT GL_DIFFUSE GL_SPECULAR 320322: Graphics and Visualization 432

Types of Lights OpenGL supports two types of Lights Local (Point) light sources Infinite (Directional) light sources Type of light controlled by w coordinate w = 0 w 0 Infinite Light directed along Local Light positioned at ( x y z) ( ) x y z w w w 320322: Graphics and Visualization 433

Attenuation Light attenuation decrease light intensity with distance GL_CONSTANT_ATTENUATION GL_LINEAR_ATTENUATION GL_QUADRATIC_ATTENUATION f i = k c + k l 1 d + k q d 2 320322: Graphics and Visualization 434

Turning on the Lights Flip each light s switch glenable( GL_LIGHTn ); Turn on the power glenable( GL_LIGHTING ); 320322: Graphics and Visualization 435

Light & Material 320322: Graphics and Visualization 436

Advanced Lighting Features Spotlights localize lighting affects GL_SPOT_DIRECTION GL_SPOT_CUTOFF GL_SPOT_EXPONENT 320322: Graphics and Visualization 437