MIT EECS 6.837, Durand and Cutler Transformations & Local Illumination.

Slides:



Advertisements
Similar presentations
Transformations in Ray Tracing MIT EECS 6.837, Durand and Cutler.
Advertisements

1 Graphics CSCI 343, Fall 2013 Lecture 18 Lighting and Shading.
Transformations.
MIT EECS 6.837, Durand and Cutler Transformations.
Virtual Realism LIGHTING AND SHADING. Lighting & Shading Approximate physical reality Ray tracing: Follow light rays through a scene Accurate, but expensive.
Foundations of Computer Graphics (Spring 2012) CS 184, Lecture 21: Radiometry Many slides courtesy Pat Hanrahan.
Physically Based Illumination Models
Advanced Computer Graphics (Spring 2013) CS 283, Lecture 8: Illumination and Reflection Many slides courtesy.
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 British Columbia CPSC 314 Computer Graphics Jan-Apr 2008 Tamara Munzner Lighting/Shading II Week.
University of Texas at Austin CS395T - Advanced Image Synthesis Spring 2006 Don Fussell Previous lecture Reflectance I BRDF, BTDF, BSDF Ideal specular.
Computer Graphics (Spring 2008) COMS 4160, Lecture 20: Illumination and Shading 2
Computer Graphics (Fall 2008) COMS 4160, Lecture 19: Illumination and Shading 2
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.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2005 Tamara Munzner Lighting and Shading Week.
Computer Graphics (Fall 2004) COMS 4160, Lecture 16: Illumination and Shading 2 Lecture includes number of slides from.
Course Website: Computer Graphics 16: Illumination.
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.
Illumination.
CS 445 / 645: Introductory Computer Graphics
Shading (introduction to rendering). Rendering  We know how to specify the geometry but how is the color calculated.
Shading / Light Thanks to Srinivas Narasimhan, Langer-Zucker, Henrik Wann Jensen, Ravi Ramamoorthi, Hanrahan, Preetham.
MIT EECS 6.837, Durand and Cutler Local Illumination.
MIT EECS 6.837, Durand and Cutler Graphics Pipeline: Projective Transformations.
CSC418 Computer Graphics n Illumination n Lights n Lightinging models.
MIT EECS 6.837, Cutler and Durand 1 MIT Ray Tracing.
David Luebke 1 10/26/2015 Lighting CS 445/645 Introduction to Computer Graphics David Luebke, Spring 2003.
MIT EECS 6.837, Durand and Cutler Transformations.
Taku KomuraComputer Graphics Local Illumination and Shading Computer Graphics – Lecture 10 Taku Komura Institute for Perception, Action.
Steve Sterley. Real World Lighting Physical objects tend to interact with light in three ways: Absorption (black body) Reflection (mirror) Transmission.
Advanced Illumination Models Chapter 7 of “Real-Time Rendering, 3 rd Edition”
Illumination.
Announcements Office hours today 2:30-3:30 Graded midterms will be returned at the end of the class.
Photo-realistic Rendering and Global Illumination in Computer Graphics Spring 2012 Material Representation K. H. Ko School of Mechatronics Gwangju Institute.
CSCE 641 Computer Graphics: Reflection Models Jinxiang Chai.
Lecture Fall 2001 Illumination and Shading in OpenGL Light Sources Empirical Illumination Shading Transforming Normals Tong-Yee Lee.
Computer Graphics (Spring 2003) COMS 4160, Lecture 18: Shading 2 Ravi Ramamoorthi Guest Lecturer: Aner Benartzi.
MIT EECS 6.837, Durand and Cutler The Graphics Pipeline: Projective Transformations.
02/2/05© 2005 University of Wisconsin Last Time Reflectance part 1 –Radiometry –Lambertian –Specular.
Local Illumination and Shading
Cornell CS465 Spring 2004 Lecture 4© 2004 Steve Marschner 1 Shading CS 465 Lecture 4.
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.
1 CSCE 441: Computer Graphics Lighting Jinxiang Chai.
David Luebke3/16/2016 CS 551 / 645: Introductory Computer Graphics David Luebke
Illumination Study of how different materials reflect light Definition of radiance, the fundamental unit of light transfer in computer graphics How the.
Physically-based Illumination Models (2) CPSC 591/691.
CS552: Computer Graphics Lecture 33: Illumination and Shading.
Computer Graphics Lecture 30 Mathematics of Lighting and Shading - IV Taqdees A. Siddiqi
1 CSCE 441: Computer Graphics Lighting Jinxiang Chai.
Reflection Models (1) Physically-Based Illumination Models (2)
Computer Graphics: Illumination
Illumination and Shading. Illumination (Lighting) Model the interaction of light with surface points to determine their final color and brightness OpenGL.
Shading CS 465 Lecture 4 © 2004 Steve Marschner • 1.
© University of Wisconsin, CS559 Spring 2004
Advanced Computer Graphics
BRDFs Randy Rauwendaal.
Radiometry (Chapter 4).
© 2002 University of Wisconsin
Shading Variation in observed color across an object
Transformations.
Previous lecture Reflectance I BRDF, BTDF, BSDF Ideal specular model
Isaac Gang University of Mary Hardin-Baylor
Computer Graphics (Fall 2003)
CS 480/680 Computer Graphics Shading.
Presentation transcript:

MIT EECS 6.837, Durand and Cutler Transformations & Local Illumination

MIT EECS 6.837, Durand and Cutler Last Time? Transformations –Rigid body, affine, similitude, linear, projective Linearity –f(x+y)=f(x)+f(y); f(ax) = a f(x) Homogeneous coordinates –(x, y, z, w) ~ (x/w, y/w, z/w) –Translation in a matrix –Projective transforms Non-commutativity Transformations in modeling

MIT EECS 6.837, Durand and Cutler Today Intro to Transformations Classes of Transformations Representing Transformations Combining Transformations Transformations in Modeling Adding Transformations to our Ray Tracer Local illumination and shading

MIT EECS 6.837, Durand and Cutler Why is a Transform an Object3D? To position the logical groupings of objects within the scene

MIT EECS 6.837, Durand and Cutler Recursive call and composition Recursive call tree: leaves are evaluated first Apply matrix from right to left Natural composition of transformations from object space to world space –First put finger in hand frame –Then apply elbow transform –Then shoulder transform –etc.

MIT EECS 6.837, Durand and Cutler Questions?

MIT EECS 6.837, Durand and Cutler Today Intro to Transformations Classes of Transformations Representing Transformations Combining Transformations Transformations in Modeling Adding Transformations to our Ray Tracer

MIT EECS 6.837, Durand and Cutler Incorporating Transforms 1.Make each primitive handle any applied transformations 2.Transform the Rays Transform { Translate { } Scale { } Sphere { center radius 1 } Sphere { center radius 2 }

MIT EECS 6.837, Durand and Cutler Primitives handle Transforms Complicated for many primitives r major r minor (x,y) Sphere { center z_rotation 30 r_major 2 r_minor 1 }

MIT EECS 6.837, Durand and Cutler (0,0) Transform the Ray Move the ray from World Space to Object Space Object Space World Space r = 1 r major r minor (x,y) p WS = M p OS p OS = M -1 p WS

MIT EECS 6.837, Durand and Cutler Transform Ray New origin: New direction: origin OS = M -1 origin WS direction OS = M -1 (origin WS + 1 * direction WS ) - M -1 origin WS origin OS origin WS direction OS direction WS Object Space World Space q WS = origin WS + t WS * direction WS q OS = origin OS + t OS * direction OS direction OS = M -1 direction WS

MIT EECS 6.837, Durand and Cutler Transforming Points & Directions Transform point Transform direction Homogeneous Coordinates: (x,y,z,w) w = 0 is a point at infinity (direction) With the usual storage strategy (no w) you need different routines to apply M to a point and to a direction

MIT EECS 6.837, Durand and Cutler What to do about the depth, t If M includes scaling, direction OS will NOT be normalized 1.Normalize the direction 2.Don't normalize the direction

MIT EECS 6.837, Durand and Cutler 1. Normalize direction t OS ≠ t WS and must be rescaled after intersection Object Space World Space t WS t OS

MIT EECS 6.837, Durand and Cutler 2. Don't normalize direction t OS = t WS Don't rely on t OS being true distance during intersection routines (e.g. geometric ray-sphere intersection, a≠1 in algebraic solution) Object Space World Space t WS t OS

MIT EECS 6.837, Durand and Cutler Questions?

MIT EECS 6.837, Durand and Cutler New component of the Hit class Surface Normal: unit vector that is locally perpendicular to the surface

MIT EECS 6.837, Durand and Cutler Why is the Normal important? It's used for shading — makes things look 3D! object color only (Assignment 1) Diffuse Shading (Assignment 2)

MIT EECS 6.837, Durand and Cutler Visualization of Surface Normal ± x = Red ± y = Green ± z = Blue

MIT EECS 6.837, Durand and Cutler How do we transform normals? Object Space World Space n OS n WS

MIT EECS 6.837, Durand and Cutler Transform the Normal like the Ray? translation? rotation? isotropic scale? scale? reflection? shear? perspective?

MIT EECS 6.837, Durand and Cutler Transform the Normal like the Ray? translation? rotation? isotropic scale? scale? reflection? shear? perspective?

MIT EECS 6.837, Durand and Cutler Similitudes What class of transforms? Translation Rotation Rigid / Euclidean Linear Affine Projective Similitudes Isotropic Scaling Scaling Shear Reflection Perspective Identity Translation Rotation Isotropic Scaling Identity Reflection a.k.a. Orthogonal Transforms

MIT EECS 6.837, Durand and Cutler Transformation for shear and scale Incorrect Normal Transformation Correct Normal Transformation

MIT EECS 6.837, Durand and Cutler More Normal Visualizations Incorrect Normal TransformationCorrect Normal Transformation

MIT EECS 6.837, Durand and Cutler Think about transforming the tangent plane to the normal, not the normal vector So how do we do it right? OriginalIncorrectCorrect n OS Pick any vector v OS in the tangent plane, how is it transformed by matrix M? v OS v WS n WS v WS = M v OS

MIT EECS 6.837, Durand and Cutler Transform tangent vector v v is perpendicular to normal n: n OS T v OS = 0 n OS T (M -1 M) v OS = 0 n WS T = n OS T (M -1 ) (n OS T M -1 ) (M v OS ) = 0 (n OS T M -1 ) v WS = 0 n WS T v WS = 0 v WS is perpendicular to normal n WS : n WS = (M -1 ) T n OS n OS v WS n WS v OS Dot product

MIT EECS 6.837, Durand and Cutler Comment So the correct way to transform normals is: But why did n WS = M n OS work for similitudes? Because for similitude / similarity transforms, (M -1 ) T = M e.g. for orthonormal basis: n WS = (M -1 ) T n OS xuyuzuxuyuzu xvyvzvxvyvzv xnynznxnynzn uxvxnxuxvxnx uyvynyuyvyny uzvznzuzvznz M -1 = M = Sometimes noted M -T

MIT EECS 6.837, Durand and Cutler Questions?

MIT EECS 6.837, Durand and Cutler Local Illumination Local shading

MIT EECS 6.837, Durand and Cutler BRDF Ratio of light coming from one direction that gets reflected in another direction Bidirectional Reflectance Distribution Function Incoming direction Outgoing direction

MIT EECS 6.837, Durand and Cutler BRDF Bidirectional Reflectance Distribution Function –4D 2 angles for each direction –R(θ i,  i ; θ o,  o )

MIT EECS 6.837, Durand and Cutler Slice at constant incidence 2D spherical function Example: Plot of “PVC” BRDF at 55° incidence highlight incoming

MIT EECS 6.837, Durand and Cutler Unit issues - radiometry We will not be too formal in this lecture Typical issues: –Directional quantities vs. integrated over all directions –Differential terms: per solid angle, per area, per time –Power, intensity, flux

MIT EECS 6.837, Durand and Cutler Light sources Today, we only consider point light sources For multiple light sources, use linearity –We can add the solutions for two light sources I(a+b)=I(a)+I(b) –We simply multiply the solution when we scale the light intensity I(s a) = s I(a) a b

MIT EECS 6.837, Durand and Cutler Light intensity 1/r 2 falloff –Why? –Same power in all concentric circles

MIT EECS 6.837, Durand and Cutler Incoming radiance The amount of light received by a surface depends on incoming angle –Bigger at normal incidence Similar to Winter/Summer difference By how much? –Cos  law –Dot product with normal –This term is sometimes included in the BRDF, sometimes not Surface  n

MIT EECS 6.837, Durand and Cutler Questions?

MIT EECS 6.837, Durand and Cutler Ideal Diffuse Reflectance Assume surface reflects equally in all directions. An ideal diffuse surface is, at the microscopic level, a very rough surface. –Example: chalk, clay, some paints Surface

MIT EECS 6.837, Durand and Cutler Ideal diffuse reflectors reflect light according to Lambert's cosine law. Ideal Diffuse Reflectance

MIT EECS 6.837, Durand and Cutler Ideal Diffuse Reflectance Single Point Light Source –k d : diffuse coefficient. –n: Surface normal. –l: Light direction. –L i : Light intensity –r: Distance to source Surface  l n r

MIT EECS 6.837, Durand and Cutler Ideal Diffuse Reflectance – More Details If n and l are facing away from each other, n l becomes negative. Using max( ( n l ),0 ) makes sure that the result is zero. – From now on, we mean max() when we write. Do not forget to normalize your vectors for the dot product!

MIT EECS 6.837, Durand and Cutler Questions?

MIT EECS 6.837, Durand and Cutler Ideal Specular Reflectance Reflection is only at mirror angle. –View dependent –Microscopic surface elements are usually oriented in the same direction as the surface itself. –Examples: mirrors, highly polished metals. Surface  l n r 

MIT EECS 6.837, Durand and Cutler Non-ideal Reflectors Real materials tend to deviate significantly from ideal mirror reflectors. Highlight is blurry They are not ideal diffuse surfaces either …

MIT EECS 6.837, Durand and Cutler Non-ideal Reflectors Simple Empirical Model: –We expect most of the reflected light to travel in the direction of the ideal ray. –However, because of microscopic surface variations we might expect some of the light to be reflected just slightly offset from the ideal reflected ray. –As we move farther and farther, in the angular sense, from the reflected ray we expect to see less light reflected.

MIT EECS 6.837, Durand and Cutler The Phong Model How much light is reflected? –Depends on the angle between the ideal reflection direction and the viewer direction . Surface  l n r  Camera v 

MIT EECS 6.837, Durand and Cutler The Phong Model Parameters –k s : specular reflection coefficient –q : specular reflection exponent Surface  l n r  Camera v 

MIT EECS 6.837, Durand and Cutler The Phong Model Effect of the q coefficient

MIT EECS 6.837, Durand and Cutler How to get the mirror direction? Surface  l n  r r

MIT EECS 6.837, Durand and Cutler Blinn-Torrance Variation Uses the halfway vector h between l and v. Surface l n Camera v h 

MIT EECS 6.837, Durand and Cutler Phong Examples The following spheres illustrate specular reflections as the direction of the light source and the coefficient of shininess is varied. Phong Blinn-Torrance

MIT EECS 6.837, Durand and Cutler The Phong Model Sum of three components: diffuse reflection + specular reflection + “ambient”. Surface

MIT EECS 6.837, Durand and Cutler Ambient Illumination Represents the reflection of all indirect illumination. This is a total hack! Avoids the complexity of global illumination.

MIT EECS 6.837, Durand and Cutler Putting it all together Phong Illumination Model

MIT EECS 6.837, Durand and Cutler For Assignment 3 Variation on Phong Illumination Model

MIT EECS 6.837, Durand and Cutler Adding color Diffuse coefficients: –k d-red, k d-green, k d-blue Specular coefficients: –k s-red, k s-green, k s-blue Specular exponent: q

MIT EECS 6.837, Durand and Cutler Questions?

MIT EECS 6.837, Durand and Cutler Shaders ( Material class) Functions executed when light interacts with a surface Constructor: –set shader parameters Inputs: –Incident radiance –Incident & reflected light directions –surface tangent (anisotropic shaders only) Output: –Reflected radiance

MIT EECS 6.837, Durand and Cutler BRDFs in the movie industry For the Matrix movies Clothes of the agent Smith are CG, with measured BRDF

MIT EECS 6.837, Durand and Cutler How do we obtain BRDFs? Gonioreflectometer –4 degrees of freedom Source: Greg Ward

MIT EECS 6.837, Durand and Cutler BRDFs in the movie industry For the Matrix movies gonioreflectometerMeasured BRDF Test rendering

MIT EECS 6.837, Durand and Cutler PhotoCGPhotoCG

MIT EECS 6.837, Durand and Cutler BRDF Models Phenomenological –Phong [75] Blinn-Phong [77] –Ward [92] –Lafortune et al. [97] –Ashikhmin et al. [00] Physical –Cook-Torrance [81] –He et al. [91] Roughly increasing computation time

MIT EECS 6.837, Durand and Cutler Fresnel Reflection Increasing specularity near grazing angles. Source: Lafortune et al. 97

MIT EECS 6.837, Durand and Cutler Anisotropic BRDFs Surfaces with strongly oriented microgeometry elements Examples: –brushed metals, –hair, fur, cloth, velvet Source: Westin et.al 92

MIT EECS 6.837, Durand and Cutler Off-specular & Retro-reflection Off-specular reflection –Peak is not centered at the reflection direction Retro-reflection: –Reflection in the direction of incident illumination –Examples: Moon, road markings

MIT EECS 6.837, Durand and Cutler Questions?