Shading. Reading. Pinhole camera. Basic 3D graphics. Brian Curless CSE 457 Spring 2017

Similar documents
Shading. Reading. Pinhole camera. Basic 3D graphics. Brian Curless CSE 457 Spring Required: Angel chapter 5.

Shading. Brian Curless CSE 457 Spring 2017

Shading. Reading. Pinhole camera. Basic 3D graphics. Brian Curless CSE 557 Fall Required: Shirley, Chapter 10

Shading. Brian Curless CSE 557 Autumn 2017

Shading. Brian Curless CSE 457 Spring 2015

Shading. CSE 457 Winter 2015

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

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

Introduction. Lighting model Light reflection model Local illumination model Reflectance model BRDF

w Foley, Section16.1 Reading

Lighting and Shading

Projections and Hardware Rendering. Brian Curless CSE 557 Fall 2014

CS5620 Intro to Computer Graphics

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

Illumination Models & Shading

CPSC 314 LIGHTING AND SHADING

Complex Shading Algorithms

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

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

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

Illumination. Illumination CMSC 435/634

ECS 175 COMPUTER GRAPHICS. Ken Joy.! Winter 2014

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

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

Comp 410/510 Computer Graphics. Spring Shading

Universität Augsburg. Institut für Informatik. Approximating Optimal Visual Sensor Placement. E. Hörster, R. Lienhart.

Orthogonal Projection Matrices. Angel and Shreiner: Interactive Computer Graphics 7E Addison-Wesley 2015

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

Computer Graphics. Illumination and Shading

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

CMSC427 Shading Intro. Credit: slides from Dr. Zwicker

CS 5625 Lec 2: Shading Models

Homework #2. Shading, Ray Tracing, and Texture Mapping

Illumination & Shading: Part 1

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

Illumination and Shading

Illumination & Shading

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

Simple Lighting/Illumination Models

Lecture 15: Shading-I. CITS3003 Graphics & Animation

Shading 1: basics Christian Miller CS Fall 2011

Computer Graphics. Illumination and Shading

Virtual Reality for Human Computer Interaction

Pipeline Operations. CS 4620 Lecture 10

CPSC / Illumination and Shading

Ray Tracing. Brian Curless CSEP 557 Fall 2016

Computer Graphics. Shading. Based on slides by Dianna Xu, Bryn Mawr College

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

Introduction to Computer Graphics 7. Shading

CS 4600 Fall Utah School of Computing

Gray-level histogram. Intensity (grey-level) transformation, or mapping. Use of intensity transformations:

Computer Vision Systems. Viewing Systems Projections Illuminations Rendering Culling and Clipping Implementations

Representations and Transformations. Objectives

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

CEng 477 Introduction to Computer Graphics Fall

Mid-term review ECE 161C Electrical and Computer Engineering University of California San Diego

Sung-Eui Yoon ( 윤성의 )

Illumination and Shading

Shading, lighting, & BRDF Theory. Cliff Lindsay, PHD

CS Illumination and Shading. Slide 1

CS770/870 Spring 2017 Color and Shading

CS452/552; EE465/505. Intro to Lighting

Shading & Material Appearance

Illumination and Shading

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

Shading I Computer Graphics I, Fall 2008

Lets assume each object has a defined colour. Hence our illumination model is looks unrealistic.

Pipeline Operations. CS 4620 Lecture 14

Photorealistic Real-Time Outdoor Light Scattering Some of the most striking aspects of outdoor scenes

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

Topics and things to know about them:

Lighting/Shading III. Week 7, Wed Mar 3

Reflection & Refraction

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

Introduction to Visualization and Computer Graphics

TSBK 07! Computer Graphics! Ingemar Ragnemalm, ISY

BRDF Computer Graphics (Spring 2008)

Visualisatie BMT. Rendering. Arjan Kok

Graphics Hardware and Display Devices

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

Illumination and Shading - II

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

Lab 9 - Metal and Glass

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

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

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

Lecture 17: Shading in OpenGL. CITS3003 Graphics & Animation

Why we need shading?

Mirror shape recovery from image curves and intrinsic parameters: Rotationally symmetric and conic mirrors. Abstract. 2. Mirror shape recovery

Raytracing CS148 AS3. Due :59pm PDT

University of Victoria CSC 305 Shading. Brian Wyvill 2016

9. Illumination and Shading

CS-184: Computer Graphics. Today

Computer Graphics I Lecture 11

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

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

Analyzing Hydra Historical Statistics Part 2

S U N G - E U I YO O N, K A I S T R E N D E R I N G F R E E LY A VA I L A B L E O N T H E I N T E R N E T

Rendering Light Reflection Models

Transcription:

Reading Optional: Angel and Shreiner: chapter 5. Marchner and Shirley: chapter 0, chapter 7. Shading Further reading: OpenGL red book, chapter 5. Brian Curle CSE 457 Spring 207 2 Baic 3D graphic With affine matrice, we can now tranform virtual 3D object in their local coordinate ytem into a global (world) coordinate ytem: Pinhole camera To create an image of a virtual cene, we need to define a camera, and we need to model lighting and hading. For the camera, we ue a pinhole camera. M M 2 [Angel, 20] The image i rendered onto an image plane (uually in front of the camera). To yntheize an image of the cene, we alo need to add light ource and a viewer/camera: Viewing ray emanate from the center of projection (COP) at the center of the pinhole. 3 The image of an object point P i at the interection of the viewing ray through P and the image plane. But i P viible? Thi the problem of hidden urface removal (a.k.a., viible urface determination). We ll conider thi problem later. 4

Shading An abundance of photon Next, we ll need a model to decribe how light interact with urface. Such a model i called a hading model. Other name: Lighting model Light reflection model Local illumination model Reflectance model BRDF Given the camera and hading model, properly determining the right color at each pixel i extremely hard. Look around the room. Each light ource ha different characteritic. Trillion of photon are pouring out every econd. Thee photon can: interact with molecule and particle in the air ( participating media ) trike a urface and be aborbed be reflected (cattered) caue fluorecence or phophorecence. interact in a wavelength-dependent manner generally bounce around and around 5 6 Our problem Setup We re going to build up to a approximation of reality called the Phong and Blinn-Phong illumination model. They have the following characteritic: not phyically correct give a firt-order approximation to phyical light reflection very fat widely ued In addition, we will aume local illumination, i.e., light goe: light ource -> urface -> viewer. No interreflection, no hadow. Given: a point P on a urface viible through pixel p The normal N at P The lighting direction, L, and (color) intenity, I L, at P The viewing direction, V, at P The hading coefficient at P Compute the color, I, of pixel p. Aume that the direction vector are normalized: N L V 7 8

Iteration zero Iteration one The implet thing you can do i Aign each polygon a ingle color: I=k e where I i the reulting intenity k e i the emiivity or intrinic hade aociated with the object Thi ha ome pecial-purpoe ue, but not really good for drawing a cene. Let make the color at leat dependent on the overall quantity of light available in the cene: Ik k I k a i the ambient reflection coefficient. really the reflectance of ambient light ambient light i aumed to be equal in all direction I La i the ambient light intenity. Phyically, what i ambient light? e 9 0 Wavelength dependence Diffue reflector Really, k e, k a, and I La are function over all wavelength. Ideally, we would do the calculation on thee function. For the ambient hading equation, we would tart with: I ( ) =k ( ) I ( ) then we would find good RGB value to repreent the pectrum I (). a La Emiive and ambient reflection don t model realitic lighting and reflection. To improve thi, we will look at diffue (a.k.a., Lambertian) reflection. Diffue reflection can occur from dull, matte urface, like latex paint, or chalk. Thee diffue reflector reradiate light equally in all direction. Picture a rough urface with lot of tiny microfacet. Traditionally, though, k a and I La are repreented a RGB triple, and the computation i performed on each color channel eparately: I =k I I I =k I R R R G G G =k a ILa B B B 2

Diffue reflector Diffue reflector, cont. or picture a urface with little pigment particle embedded beneath the urface (neglect reflection at the urface for the moment): The reflected intenity from a diffue urface doe not depend on the direction of the viewer. The incoming light, though, doe depend on the direction of the light ource: The microfacet and pigment ditribute light ray in all direction. Embedded pigment are reponible for the coloration of diffuely reflected light in platic and paint. Note: the figure in thi and the previou lide are intuitive, but not trictly (phyically) correct. 3 4 Iteration two Specular reflection The incoming energy i proportional to the diffue reflection equation:, giving Specular reflection account for the highlight that you ee on ome object. I=k +k I e d L +k I B =k +k I +k I B( ) e d L where: k d i the diffue reflection coefficient I L i the (color) intenity of the light ource N i the normal to the urface (unit vector) L i the direction to the light ource (unit vector) B prevent contribution of light from below the urface: if NL 0 B= 0 if NL 0 It i particularly important for mooth, hiny urface, uch a: metal polihed tone platic apple kin Propertie: Specular reflection depend on the viewing direction V. For non-metal, the color i determined olely by the color of the light. For metal, the color may be altered (e.g., bra) 5 6

Specular reflection derivation Phong pecular reflection co n φ 0.9 0.8 0.7 0.6 n = 0.5 0.4 0.3 0.2 For a perfect mirror reflector, light i reflected about N, o I L if V R I 0 otherwie For a near-perfect reflector, you might expect the highlight to fall off quickly with increaing angle. Alo known a: rough pecular reflection directional diffue reflection gloy reflection 0. n = 28 0 00 80 60 40 20 0 20 40 60 80 00 One way to get thi effect i to take (R V), raied to a power n. Phong pecular reflection i proportional to: where (x ) + max(0, x ). n pecular ~ B RV I ( ) Q: A n get larger, doe the highlight on a curved urface get maller or larger? φ 7 8 Blinn-Phong pecular reflection Iteration three A common alternative for pecular reflection i the Blinn-Phong model (ometime called the modified Phong model.) We compute the vector halfway between L and V a: The next update to the Blinn-Phong hading model i then: n I=k +k I +k I B( NL ) +k I B( NH) e d L L k e+kai La+ ILBk d( NL ) +k( NH) n where: Analogou to Phong pecular reflection, we can compute the pecular contribution in term of (N H), raied to a power n : n pecular ~ B NH I ( ) k i the pecular reflection coefficient n i the pecular exponent or hinine H i the unit halfway vector between L and V, where V i the viewing direction. where, again, (x ) + max(0, x ). 9 20

Directional light The implet form of light upported by renderer are ambient, directional, and point. Spotlight are alo upported often a a pecial form of point light. We ve een ambient light ource, which are not really geometric. Directional light ource have a ingle direction and intenity aociated with them. Point light The direction of a point light ource i determined by the vector from the light poition to the urface point. E-P L= E-P r =E-P Uing affine notation, what i the homogeneou coordinate for a directional light? 2 Phyic tell u the intenity mut drop off inverely with the quare of the ditance: f atten r 2 Sometime, thi ditance-quared dropoff i conidered too harh. A common alternative i: f atten 2 a+br +cr with uer-upplied contant for a, b, and c. Uing affine notation, what i the homogeneou coordinate for a point light? 22 Spotlight We can alo apply a directional attenuation of a point light ource, giving a potlight effect. A common choice for the potlight intenity i: LS f = 2 pot abrcr 0 otherwie where L i the direction to the point light. S i the center direction of the potlight. i the angle between L and S i the cutoff angle for the potlight e i the angular falloff coefficient Note: co ( LS ) LS co. e 23 Iteration four Since light i additive, we can handle multiple light by taking the um over every light. Our equation i now: I=k +k I + Thi i the Blinn-Phong illumination model (for potlight). Which quantitie are patial vector? Which are RGB triple? Which are calar? ej Lj Sj j n I B NH L,j j k d NLj +k 2 j j a+b j jrj +cjrj e 24

Shading in OpenGL The OpenGL lighting model allow you to aociate different lighting color according to material propertie they will influence. 3D Geometry in the Graphic Hardware Pipeline Graphic hardware applie tranformation to bring the object and lighting into the camera coordinate ytem: Thu, our original hading equation (for point light): I=k +k I + e a+b r +cr NL NH I B k +k 2 L,j j d j j + j j j j j j n become: I=k +k I + e a+b r +cr 2 j j j j j j ki + B ki ( NL ) +ki ( NH ) n,j j d Ld, j j L,j j + where you can have a global ambient light with intenity I La in addition to having an ambient light intenity I La, j aociated with each individual light, a well a eparate diffue and pecular intenitie, I Ld, j and I L, j, repectively. 25 The geometry i aumed to be made of triangle, and the vertice are projected onto the image plane. 26 Raterization Shading the interior of triangle After projecting the vertice, graphic hardware mear vertex propertie acro the interior of the triangle in a proce called raterization. We will be computing color uing the Blinn-Phong lighting model. Let aume (a graphic hardware doe) that we are working with triangle. How hould we hade the interior of triangle? Smearing the z-value and uing a Z-buffer will enable the graphic hardware to determine if a point inide a triangle i viible. (More on thi in another lecture.) If we have tored color at the vertice, then we can mear thee a well. 27 28

Shading with per-face normal Faceted hading (cont d) Aume each face ha a contant normal: For a ditant viewer and a ditant light ource and contant material propertie over the urface, how will the color of each triangle vary? 29 [William and Siegel 990] 30 Gouraud interpolation Facted hading v. Gouraud interpolation To get a moother reult that i eaily performed in hardware, we can do Gouraud interpolation. Here how it work:. Compute normal at the vertice. 2. Shade only the vertice. 3. Interpolate the reulting vertex color. 3 [William and Siegel 990] 32

Gouraud interpolation artifact Phong interpolation Gouraud interpolation ha ignificant limitation.. If the polygonal approximation i too coare, we can mi pecular highlight. To get an even moother reult with fewer artifact, we can perform Phong interpolation. Here how it work:. Compute normal at the vertice. 2. Interpolate normal and normalize. 3. Shade uing the interpolated normal. 2. We will encounter Mach banding (derivative dicontinuity enhanced by human eye). Thi i what graphic hardware doe by default. A ubtantial improvement i to do 33 34 Gouraud v. Phong interpolation Vertex proceor Primitive aembler Old pipeline: Gouraud interpolation Default vertex proceing: Ldetermine lighting direction Vdetermine viewing direction Nnormalize( n e ) cblinn-phong hade with LV,, Nk, d, k, n attach c blinn-phong to vertex a varying v i project v to image 2 3 vi, vi, vi triangle Raterizer Fragment proceor Default fragment proceing: p color c blinn-phong [William and Siegel 990] 35 36

Vertex proceor Primitive aembler Programmable pipeline: Phong-interpolated normal! Vertex hader: attach n e to vertex a varying attach v e to vertex a varying v i project v to image v, v, v 2 3 i i i triangle Chooing Blinn-Phong hading parameter Experiment with different parameter etting. To get you tarted, here are a few uggetion: Try n in the range [0,00] Try k a + k d + k < Ue a mall k a (~0.) n k d k Raterizer Metal Platic large medium Small, color of metal Medium, color of platic Large, color of metal Medium, white Planet 0 varying 0 Fragment proceor Fragment hader: p L determine lighting direction (uing v e ) p Vnormalizev e p N normalize( n e ) color hade with LV,, N, k, k, n d 37 38 BRDF More ophiticated BRDF The diffue+pecular part of the Blinn-Phong illumination model are a mapping from light to viewing direction: L V I= I LB k d( NL) +kn L V I f ( LV, ) L r The mapping function f r i often written in term of incoming (light) direction in and outgoing (viewing) direction out : n [Cook and Torrance, 982] f (, ) or f ( ) r in out r in out Thi function i called the Bi-directional Reflectance Ditribution Function (BRDF). Aniotropic BRDF [Wetin, Arvo, Torrance 992] Here a plot with in held contant: f (, ) r in out in BRDF can be quite ophiticated 39 Artitic BRDF [Gooch] 40

More ophiticated BRDF (cont d) BSSRDF for uburface cattering Hair illuminated from different angle [Marchner et al., 2003] [Jenen et al. 200] Wool cloth and ilk cloth [Irawan and Marchner, 202] 4 42 Summary You hould undertand the equation for the Blinn- Phong lighting model decribed in the Iteration Four lide: What i the phyical meaning of each variable? How are the term computed? What effect doe each term contribute to the image? What doe varying the parameter do? You hould alo undertand the difference between faceted, Gouraud, and Phong interpolated hading. 43