Local Illumination physics. Law of reflection and Snell s law of refraction

Similar documents
Illumination and Shading

Global Illumination. CMPT 361 Introduction to Computer Graphics Torsten Möller. Machiraju/Zhang/Möller

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

CS5620 Intro to Computer Graphics

Pipeline Operations. CS 4620 Lecture 10

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

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

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

Reflection and Shading

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

Pipeline Operations. CS 4620 Lecture 14

Illumination and Shading

TSBK 07! Computer Graphics! Ingemar Ragnemalm, ISY

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

Comp 410/510 Computer Graphics. Spring Shading

Introduction Rasterization Z-buffering Shading. Graphics 2012/2013, 4th quarter. Lecture 09: graphics pipeline (rasterization and shading)

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

Sung-Eui Yoon ( 윤성의 )

Introduction to Computer Graphics 7. Shading

COMPLETION OF Z-buffer Graphics Pipeline

Pipeline Operations. CS 4620 Lecture Steve Marschner. Cornell CS4620 Spring 2018 Lecture 11

CSE 167: Lecture #7: Color and Shading. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2011

Local vs. Global Illumination & Radiosity

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

Illumination and Shading

Computer Graphics. Illumination and Shading

Rendering. Mike Bailey. Rendering.pptx. The Rendering Equation

CMSC427 Shading Intro. Credit: slides from Dr. Zwicker

The Rendering Equation & Monte Carlo Ray Tracing

Shading and Illumination

CS Computer Graphics: Illumination and Shading I

CS Computer Graphics: Illumination and Shading I

Computer Graphics. Lecture 13. Global Illumination 1: Ray Tracing and Radiosity. Taku Komura

Computer Graphics 1. Chapter 7 (June 17th, 2010, 2-4pm): Shading and rendering. LMU München Medieninformatik Andreas Butz Computergraphik 1 SS2010

CPSC 314 LIGHTING AND SHADING

Projections and Hardware Rendering. Brian Curless CSE 557 Fall 2014

Computer Graphics. Illumination and Shading

Illumination & Shading: Part 1

Computer Graphics. Lecture 14 Bump-mapping, Global Illumination (1)

Complex Shading Algorithms

Computer Graphics. Lecture 10. Global Illumination 1: Ray Tracing and Radiosity. Taku Komura 12/03/15

Illumination & Shading

Graphics and Visualization

CS452/552; EE465/505. Intro to Lighting

CSE 681 Illumination and Phong Shading

Interpolation using scanline algorithm

A Brief Overview of. Global Illumination. Thomas Larsson, Afshin Ameri Mälardalen University

CPSC / Illumination and Shading

Virtual Reality for Human Computer Interaction

Rasterization Overview

CS130 : Computer Graphics Lecture 8: Lighting and Shading. Tamar Shinar Computer Science & Engineering UC Riverside

CS770/870 Spring 2017 Color and Shading

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

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

Recollection. Models Pixels. Model transformation Viewport transformation Clipping Rasterization Texturing + Lights & shadows

CS 488. More Shading and Illumination. Luc RENAMBOT

INF3320 Computer Graphics and Discrete Geometry

Illumination. The slides combine material from Andy van Dam, Spike Hughes, Travis Webb and Lyn Fong

surface: reflectance transparency, opacity, translucency orientation illumination: location intensity wavelength point-source, diffuse source

CS 130 Final. Fall 2015

Graphics for VEs. Ruth Aylett

ECS 175 COMPUTER GRAPHICS. Ken Joy.! Winter 2014

Global Illumination. Global Illumination. Direct Illumination vs. Global Illumination. Indirect Illumination. Soft Shadows.

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

Three-Dimensional Graphics V. Guoying Zhao 1 / 55

Rendering Light Reflection Models

Simple Lighting/Illumination Models

Turn on the Lights: Reflectance

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

Phong Lighting & Materials. Some slides modified from: David Kabala Others from: Andries Van Damm, Brown Univ.

Computer Graphics 10 - Shadows

The Rendering Equation and Path Tracing

Illumination and Shading

03 RENDERING PART TWO

Local Illumination. CMPT 361 Introduction to Computer Graphics Torsten Möller. Machiraju/Zhang/Möller

CS 4620 Program 3: Pipeline

Lessons Learned from HW4. Shading. Objectives. Why we need shading. Shading. Scattering

Illumination & Shading I

Objectives. Introduce Phong model Introduce modified Phong model Consider computation of required vectors Discuss polygonal shading.

Shadow Algorithms. CSE 781 Winter Han-Wei Shen

CSE 690: GPGPU. Lecture 2: Understanding the Fabric - Intro to Graphics. Klaus Mueller Stony Brook University Computer Science Department

Shading 1: basics Christian Miller CS Fall 2011

Computer Graphics. Shadows

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

CS 381 Computer Graphics, Fall 2008 Midterm Exam Solutions. The Midterm Exam was given in class on Thursday, October 23, 2008.

Global Illumination CS334. Daniel G. Aliaga Department of Computer Science Purdue University

Illumination in Computer Graphics

C O M P U T E R G R A P H I C S. Computer Graphics. Three-Dimensional Graphics V. Guoying Zhao 1 / 65

Models and Architectures. Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico

WHY WE NEED SHADING. Suppose we build a model of a sphere using many polygons and color it with glcolor. We get something like.

Computergrafik. Matthias Zwicker. Herbst 2010

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

INFOGR Computer Graphics. J. Bikker - April-July Lecture 10: Shading Models. Welcome!

Lab 9 - Metal and Glass

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

Problem Set 4 Part 1 CMSC 427 Distributed: Thursday, November 1, 2007 Due: Tuesday, November 20, 2007

Affine Transformations in 3D

CMSC427 Advanced shading getting global illumination by local methods. Credit: slides Prof. Zwicker

Chapter 7 - Light, Materials, Appearance

Transcription:

Local Illumination physics Law of reflection and Snell s law of refraction

What are we trying to model?

Surface

Proof of Lambert s cosine law n db da

Computing R All vectors unit length!!

The effect of the exponent n

Comparison

The Blinn-Torrance Specular Model Agrees better with experimental results I s =I i K spec (H V) n Halfway vector H

Advantages of the Blinn Specular Model Theoritical basis No need to compute reflective direction R N H cannot be negative if N L>0 and N V>0 If the light is directional and we have orthographic projection then N*H constant

Lights and materials ObjectColor r = I r = I a_r K a_r + I i_r K diff_r (N L)+I i_r K spec_r (R V) n ObjectColor g = I g =I a_g K a_g + I i_g K diff_g (N L)+I i_g K spec_g (R V) n ObjectColor b = I b = I a_b K a_b + I i_b K diff_b (N L)+I i_b K spec_b (R V) n Material properties: K a,k diff,k spec,n Light properties I a,i diff,i spec

Questions If you shine red light (1,0,0) to a white object what color does the object appear to have? What if you shine red light (1,0,0) to a green object (0,1,0)? What is the color of the highlight?

Special cases What should be done if I >1? Clamp the value of I to one. What should be done if N*L < 0? Clamp the value of I to zero or flip the normal. How can we handle multiple light sources? Sum the intensity of the individual contributions.

Tricky Point about light position in OpenGL The light position is specified in world coordinates, transformed with the current modelview matrix and stored in EYE coordinates. What does that mean? It means that if you change the position of the eye after the light position is set GLfloat pos[4] = {0,0,0,1} ; gllightfv(gl_light0, GL_POSITION, pos) ; glulookat(..) ; The light will maintain its position with the respect to the new eye! i.e it will move with the camera.

Example1: Where is the light with respect to the eye? GLfloat pos[4] = {0,0,0,1} ; GLfloat eye[3] = {0,0,10} ; GLfloat ref[3] = {0,0,0} ; GLfloat up[3] = {0,1,0} ; glmatrixmode(gl_modelview) ; glloadidentity() ; gllightfv(gl_light0, GL_POSITION, pos) ; glulookat(eye,ref,up) ; World?

Example1: Where is the light with respect to the eye? GLfloat pos[4] = {0,0,0,1} ; GLfloat eye[3] = {0,0,10} ; GLfloat ref[3] = {0,0,0} ; GLfloat up[3] = {0,1,0} ; glmatrixmode(gl_modelview) ; glloadidentity() ; // that means camera matrix identity as well gllightfv(gl_light0, GL_POSITION, pos) ; // 0 with respect to glulookat(eye,ref,up) ; World? (0,0,10) // current camera // 0 with respect to new // camera

Example2: Where is the light with respect to the eye? GLfloat pos[4] = {0,0,0,1} ; GLfloat eye[3] = {0,0,10} ; GLfloat ref[3] = {0,0,0} ; GLfloat up[3] = {0,1,0} ; glmatrixmode(gl_modelview) ; glloadidentity() ; gltranslatef(0,0,-10) ; gllightfv(gl_light0, GL_POSITION, pos) ; glulookat(eye,ref,up) ; World?

Example3: Where is the light with respect to the eye? GLfloat pos[4] = {0,0,0,1} ; GLfloat eye[3] = {0,0,10} ; GLfloat ref[3] = {0,0,0} ; GLfloat up[3] = {0,1,0} ; glmatrixmode(gl_modelview) ; glloadidentity() ; glulookat(eye,ref,up) ; gllightfv(gl_light0, GL_POSITION, pos) ; glutswapbuffers() ; World?

Examples

Problems with shading algorithms Orientation dependence Silhouettes Perspective distortion It happens at screen space so need to use hyperbolic interpolation T-vertices If you do not have smooth normals color changes if polygon order changes Generation of vertex normals

Advanced concepts Physics-based illumination models BRDF: Bidirectional reflectance function

Illumination in Graphics Pipeline OCS WCS VCS CCS Modeling transformation Viewing transformation Projection transformation Rasterization DCS Viewport transformation NDCS Perspective division

Illumination in Graphics Pipeline Illumination OCS WCS VCS CCS Modeling transformation Viewing transformation Projection transformation Rasterization DCS Viewport transformation NDCS Perspective division

Z-buffer Graphics Pipeline Illumination OCS WCS VCS CCS Modeling transformation Viewing transformation Projection transformation Rasterization DCS Viewport transformation NDCS Perspective division

Z-buffer algorithm for each polygon in model project vertices of polygon onto viewing plane for each pixel inside the projected polygon calculate pixel colour calculate pixel z-value compare pixel z-value to value stored for pixel in z-buffer if pixel is closer, draw it in frame-buffer and z-buffer end end

COMPLETION OF Z-buffer Graphics Pipeline Illumination OCS WCS VCS CCS Modeling transformation Viewing transformation Projection transformation Rasterization DCS Viewport transformation NDCS Perspective division

Global Illumination Computing light interface between all surfaces Radiosity Courtesy of Henrik Wann Jensen Ray tracing

Radiosity (Hill: not covered. Foley & van Dam: Ch 16.13, p. 793-806) Physics-based (heat transfer and illumination engineering) Suited for Diffuse reflection Infinite reflections Soft shadows

Radiosity algorithm Break scene into small patches Assume uniform reflection and emission per patch Energy balance for all patches: Light leaving surface=emitted light + reflected light

Notation Flux: energy per unit time (W) Radiosity B: exiting flux density (W/m^2) E: exiting flux density for light sources Reflectivity R: fraction of incoming light reflected (unitless) Form factor Fij: fraction of energy leaving Ai and arriving at Aj determined by the geometry of polygons i and j

Energy balance

Linear system Matrix o(n^2) Form-factor computing Constant radiosity patches

Example: The Cornell scene

Radiosity summary Object space algorithm Suited for diffuse reflections Nice soft-shadows