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

Similar documents
Shading. Brian Curless CSE 557 Autumn 2017

Shading. Brian Curless CSE 457 Spring 2017

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

Shading. Brian Curless CSE 457 Spring 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.

Shading. CSE 457 Winter 2015

w Foley, Section16.1 Reading

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

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

CMSC427 Shading Intro. Credit: slides from Dr. Zwicker

Shading I Computer Graphics I, Fall 2008

Comp 410/510 Computer Graphics. Spring Shading

Illumination & Shading

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

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

Lecture 15: Shading-I. CITS3003 Graphics & Animation

CS5620 Intro to Computer Graphics

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

Lighting affects appearance

Lighting affects appearance

Simple Lighting/Illumination Models

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

Computer Graphics. Illumination and Shading

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

CS 5625 Lec 2: Shading Models

CPSC 314 LIGHTING AND SHADING

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

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

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

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

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

CSE 681 Illumination and Phong Shading

Illumination Models & Shading

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

Shading & Material Appearance

Illumination in Computer Graphics

Virtual Reality for Human Computer Interaction

Introduction to Computer Graphics 7. Shading

ECS 175 COMPUTER GRAPHICS. Ken Joy.! Winter 2014

Lights, Surfaces, and Cameras. Light sources emit photons Surfaces reflect & absorb photons Cameras measure photons

CS452/552; EE465/505. Intro to Lighting

Lighting. Figure 10.1

Rendering: Reality. Eye acts as pinhole camera. Photons from light hit objects

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

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

Illumination. Illumination CMSC 435/634

Illumination & Shading: Part 1

Lecture 4: Reflection Models

Rendering Light Reflection Models

CENG 477 Introduction to Computer Graphics. Ray Tracing: Shading

Why we need shading?

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

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

CS6670: Computer Vision

Interactive Real-Time Raycasting

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

Raytracing CS148 AS3. Due :59pm PDT

Local Reflection Models

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

Sung-Eui Yoon ( 윤성의 )

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

rendering equation computer graphics rendering equation 2009 fabio pellacini 1

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

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

Illumination and Shading - II

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

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

CS6670: Computer Vision

Illumination and Shading

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

Ray Tracing. Brian Curless CSEP 557 Fall 2016

CEng 477 Introduction to Computer Graphics Fall

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

BRDF Computer Graphics (Spring 2008)

Timothy Walsh. Reflection Models

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

Lighting and Shading. Slides: Tamar Shinar, Victor Zordon

Light Reflection Models

CS770/870 Spring 2017 Color and Shading

Rendering Light Reflection Models

Shading / Light. Thanks to Srinivas Narasimhan, Langer-Zucker, Henrik Wann Jensen, Ravi Ramamoorthi, Hanrahan, Preetham

CS 4600 Fall Utah School of Computing

Lighting and Materials

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

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

Complex Shading Algorithms

Color and Light CSCI 4229/5229 Computer Graphics Fall 2016

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

Ray-Tracing. Misha Kazhdan

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

Overview. Radiometry and Photometry. Foundations of Computer Graphics (Spring 2012)

Shading 1: basics Christian Miller CS Fall 2011

The Rendering Equation. Computer Graphics CMU /15-662

Visualisatie BMT. Rendering. Arjan Kok

02 Shading and Frames. Steve Marschner CS5625 Spring 2016

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

CPSC / Illumination and Shading

Projections and Hardware Rendering. Brian Curless CSE 557 Fall 2014

Transcription:

Reading Required: Shirley, Chapter 10 Shading Brian Curless CSE 557 Fall 2014 1 2 Basic 3D graphics With affine matrices, we can now transform virtual 3D objects in their local coordinate systems into a global (world) coordinate system: Pinhole camera To create an image of a virtual scene, we need to define a camera, and we need to model lighting and shading. For the camera, we use a pinhole camera. M 1 M 2 [Angel, 2011] The image is rendered onto an image plane (usually in front of the camera). To synthesize an image of the scene, we also need to add light sources and a viewer/camera: Viewing rays emanate from the center of projection (COP) at the center of the pinhole. 3 The image of an object point P is at the intersection of the viewing ray through P and the image plane. But is P visible? This the problem of hidden surface removal (a.k.a., visible surface determination). We ll consider this problem later. 4

Shading An abundance of photons Next, we ll need a model to describe how light interacts with surfaces. Such a model is called a shading model. Other names: Lighting model Light reflection model Local illumination model Reflectance model BRDF Given the camera and shading model, properly determining the right color at each pixel is extremely hard. Look around the room. Each light source has different characteristics. Trillions of photons are pouring out every second. These photons can: interact with molecules and particles in the air ( participating media ) strike a surface and be absorbed be reflected (scattered) cause fluorescence or phosphorescence. interact in a wavelength-dependent manner generally bounce around and around 5 6 Our problem Setup We re going to build up to a approximations of reality called the Phong and Blinn-Phong illumination models. They have the following characteristics: not physically correct gives a first-order approximation to physical light reflection very fast widely used In addition, we will assume local illumination, i.e., light goes: light source -> surface -> viewer. No interreflections, no shadows. Given: a point P on a surface visible through pixel p The normal N at P The lighting direction, L, and (color) intensity, I L, at P The viewing direction, V, at P The shading coefficients at P Compute the color, I, of pixel p. Assume that the direction vectors are normalized: N L V 1 7 8

Iteration zero Iteration one The simplest thing you can do is Assign each polygon a single color: I=k e where I is the resulting intensity k e is the emissivity or intrinsic shade associated with the object This has some special-purpose uses, but not really good for drawing a scene. Let s make the color at least dependent on the overall quantity of light available in the scene: I k k I k a is the ambient reflection coefficient. really the reflectance of ambient light ambient light is assumed to be equal in all directions I La is the ambient light intensity. Physically, what is ambient light? e a La [Note: k e is omitted in Shirley.] 9 [Note: Shirley uses c a instead of I La.] 10 Wavelength dependence Diffuse reflection Really, k e, k a, and I L are functions over all wavelengths. Ideally, we would do the calculation on these functions. For the ambient shading equation, we would start with: I ( ) =k ( ) I ( ) a La Let s examine the ambient shading model: objects have different colors we can control the overall light intensity what happens when we turn off the lights? what happens as the light intensity increases? what happens if we change the color of the lights? then we would find good RGB values to represent the spectrum I(). Traditionally, though, k and I L are represented as RGB triples, and the computation is performed on each color channel separately: I =k I I I =k I R R R a La G G G =k a ILa B B B a La So far, objects are uniformly lit. not the way things really appear in reality, light sources are localized in position or direction Diffuse, or Lambertian reflection will allow reflected intensity to vary with the direction of the light. 11 12

Diffuse reflectors Diffuse reflectors Diffuse reflection occurs from dull, matte surfaces, like latex paint, or chalk. These diffuse or Lambertian reflectors reradiate light equally in all directions. or picture a surface with little pigment particles embedded beneath the surface (neglect reflection at the surface for the moment): Picture a rough surface with lots of tiny microfacets. The microfacets and pigments distribute light rays in all directions. Embedded pigments are responsible for the coloration of diffusely reflected light in plastics and paints. Note: the figures above are intuitive, but not strictly (physically) correct. 13 14 Diffuse reflectors, cont. Iteration two The reflected intensity from a diffuse surface does not depend on the direction of the viewer. The incoming light, though, does depend on the direction of the light source: The incoming energy is proportional to the diffuse reflection equations: I=k +k I e a La d L +k I B, giving =k +k I +k I B( ) e a La d L where: k d is the diffuse reflection coefficient I L is the (color) intensity of the light source N is the normal to the surface (unit vector) L is the direction to the light source (unit vector) B prevents contribution of light from below the surface: 1 if NL 0 B= 0 if NL 0 [Note: Shirley uses c r and c l instead of k d and L.] 15 16

Specular reflection Specular reflection derivation Specular reflection accounts for the highlight that you see on some objects. It is particularly important for smooth, shiny surfaces, such as: metal polished stone plastics apples skin For a perfect mirror reflector, light is reflected about N, so I L if V R I 0 otherwise Properties: Specular reflection depends on the viewing direction V. For non-metals, the color is determined solely by the color of the light. For metals, the color may be altered (e.g., brass) For a near-perfect reflector, you might expect the highlight to fall off quickly with increasing angle. Also known as: rough specular reflection directional diffuse reflection glossy reflection 17 18 Phong specular reflection Blinn-Phong specular reflection cos ns φ 1 0.9 0.8 0.7 0.6 0.5 0.4 0.3 ns = 1 A common alternative for specular reflection is the Blinn-Phong model (sometimes called the modified Phong model.) We compute the vector halfway between L and V as: 0.2 0.1 ns = 128 0 100 80 60 40 20 0 20 40 60 80 100 φ One way to get this effect is to take (R V), raised to a power n s. As n s gets larger, the dropoff becomes {more,less} gradual gives a {larger,smaller} highlight simulates a {more,less} mirror-like surface Phong specular reflection is proportional to: where (x) + max(0, x). n I B( R V) s specular Analogous to Phong specular reflection, we can compute the specular contribution in terms of (N H), raised to a power n s : where, again, (x) + max(0, x). n I B( NH ) s specular 19 20

Iteration three Directional lights The next update to the Blinn-Phong shading model is then: ns I=k +k I +k I B( NL ) +k I B( NH) e a La d L s L k e+kai La+ ILB k d( NL ) +ks( NH) where: k s is the specular reflection coefficient n s is the specular exponent or shininess H is the unit halfway vector between L and V, where V is the viewing direction, and: ns The simplest form of lights supported by renderers are ambient, directional, and point. Spotlights are also supported often as a special form of point light. We ve seen ambient light sources, which are not really geometric. Directional light sources have a single direction and intensity associated with them. H if H H n s s = ( N ) N 0 ( N ) 0 if NH 0 n [Note: Shirley uses e, r, h, and p instead of V, R, H, and n s.] 21 Using affine notation, what is the homogeneous coordinate for a directional light? 22 Point lights Spotlights The direction of a point light sources is determined by the vector from the light position to the surface point. We can also apply a directional attenuation of a point light source, giving a spotlight effect. E-P L= E-P r =E-P Physics tells us the intensity must drop off inversely with the square of the distance: 1 f atten r 2 Sometimes, this distance-squared dropoff is considered too harsh. A common alternative is: 1 f atten 2 a+br +cr with user-supplied constants for a, b, and c. Using affine notation, what is the homogeneous coordinate for a point light? 23 A common choice for the spotlight intensity is: where e LS f = 2 spot abrcr 0 otherwise L is the direction to the point light. S is the center direction of the spotlight. is the angle between L and S is the cutoff angle for the spotlight e is the angular falloff coefficient 1 Note: cos ( LS ) LS cos. 24

Iteration four Choosing the parameters Since light is additive, we can handle multiple lights by taking the sum over every light. Our equation is now: I=k +k I + e j Lj Sj j n I B NH s L,j j k d NLj +k 2 s j j a+b j jrj +cjrj e a La Experiment with different parameter settings. To get you started, here are a few suggestions: Try n s in the range [0,100] Try k a + k d + k s < 1 Use a small k a (~0.1) n s k d k s This is the Blinn-Phong illumination model (for spotlights). Which quantities are spatial vectors? Metal Plastic large medium Small, color of metal Medium, color of plastic Large, color of metal Medium, white Which are RGB triples? Planet 0 varying 0 Which are scalars? 25 26 BRDF The diffuse+specular parts of the Blinn-Phong illumination model are a mapping from light to viewing directions: ns L V I= I LB k d( NL) +ksn L V I f ( LV, ) The mapping function f r is often written in terms of incoming (light) directions in and outgoing (viewing) directions out : f (, ) or f ( ) r L in r out This function is called the Bi-directional Reflectance Distribution Function (BRDF). Here s a plot with in held constant: r in out More sophisticated BRDF s [Cook and Torrance, 1982] Anisotropic BRDFs [Westin, Arvo, Torrance 1992] in f (, ) r in out BRDF s can be quite sophisticated 27 Artistics BRDFs [Gooch] 28

BSSRDFs for subsurface scattering More sophisticated BRDF s (cont d) Hair illuminated from different angles [Marschner et al., 2003] [Jensen et al. 2001] Wool cloth and silk cloth [Irawan and Marschner, 2012] 29 30