Shading. Brian Curless CSE 557 Autumn 2017

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

Shading. Brian Curless CSE 457 Spring 2017

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

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

Shading. Brian Curless CSE 457 Spring 2015

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

w Foley, Section16.1 Reading

Shading. CSE 457 Winter 2015

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

Lecture 15: Shading-I. CITS3003 Graphics & Animation

Comp 410/510 Computer Graphics. Spring Shading

Shading I Computer Graphics I, Fall 2008

Computer Graphics. Illumination and Shading

Illumination & Shading

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

Lighting affects appearance

Simple Lighting/Illumination Models

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

Lighting affects appearance

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

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

CSE 681 Illumination and Phong Shading

CS 5625 Lec 2: Shading Models

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

CS5620 Intro to Computer Graphics

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

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

CPSC 314 LIGHTING AND SHADING

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

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

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

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

Shading & Material Appearance

Introduction to Computer Graphics 7. Shading

Virtual Reality for Human Computer Interaction

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

Illumination Models & Shading

Lighting and Shading. Slides: Tamar Shinar, Victor Zordon

ECS 175 COMPUTER GRAPHICS. Ken Joy.! Winter 2014

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

CENG 477 Introduction to Computer Graphics. Ray Tracing: Shading

Rendering Light Reflection Models

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

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

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

Illumination in Computer Graphics

Illumination & Shading: Part 1

Why we need shading?

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

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

CS452/552; EE465/505. Intro to Lighting

Lighting. Figure 10.1

Illumination. Illumination CMSC 435/634

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

Local Reflection Models

BRDF Computer Graphics (Spring 2008)

Sung-Eui Yoon ( 윤성의 )

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

CS6670: Computer Vision

rendering equation computer graphics rendering equation 2009 fabio pellacini 1

Illumination and Shading - II

CEng 477 Introduction to Computer Graphics Fall

Timothy Walsh. Reflection Models

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

Raytracing CS148 AS3. Due :59pm PDT

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

Illumination and Shading

CS6670: Computer Vision

Shading 1: basics Christian Miller CS Fall 2011

CS 4600 Fall Utah School of Computing

Lecture 4: Reflection Models

Light Reflection Models

Rendering Light Reflection Models

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

CS770/870 Spring 2017 Color and Shading

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

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

Complex Shading Algorithms

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

Color and Light CSCI 4229/5229 Computer Graphics Fall 2016

Interactive Real-Time Raycasting

Radiance. Radiance properties. Radiance properties. Computer Graphics (Fall 2008)

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

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

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

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

Lighting and Materials

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

Ray-Tracing. Misha Kazhdan

Illumination & Shading I

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

Visualisatie BMT. Rendering. Arjan Kok

The Rendering Equation. Computer Graphics CMU /15-662

02 Shading and Frames. Steve Marschner CS5625 Spring 2016

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

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

Radiometry and reflectance

Transcription:

Shading Brian Curless CSE 557 Autumn 2017 1

Reading Optional: Angel and Shreiner: chapter 5. Marschner and Shirley: chapter 10, chapter 17. Further reading: OpenGL red book, chapter 5. 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: M 1 M 2 To synthesize an image of the scene, we also need to add light sources and a viewer/camera: 3

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. [Angel, 2011] The image is rendered onto an image plane (usually in front of the camera). Viewing rays emanate from the center of projection (COP) at the center of the pinhole. 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 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 5

An abundance of photons 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 6

Our problem We re going to build up to 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. 7

Setup 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 8

Iteration zero The simplest thing you can do is Assign each polygon a single color: where I k e 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. 9

Iteration one Let s make the color at least dependent on the overall quantity of light available in the scene: I k e k a I La 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? 10

Wavelength dependence Really, k e, k a, and I La 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 a ()I La () then we would find good RGB values to represent the spectrum I(). Traditionally, though, k a and I La are represented as RGB triples, and the computation is performed on each color channel separately: I R k R R a I La I G k G G a I La I B k B B a I La 11

Diffuse reflectors Emissive and ambient reflection don t model realistic lighting and reflection. To improve this, we will look at diffuse (a.k.a., Lambertian) reflection. Diffuse reflection can occur from dull, matte surfaces, like latex paint, or chalk. These diffuse reflectors reradiate light equally in all directions. Picture a rough surface with lots of tiny microfacets. 12

Diffuse reflectors or picture a surface with little pigment particles embedded beneath the surface (neglect reflection at the surface for the moment): 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 in this and the previous slide are intuitive, but not strictly (physically) correct. 13

Diffuse reflectors, cont. 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: 14

Iteration two The incoming energy is proportional to the diffuse reflection equations:, giving I k e k a I La k d I L B k e k a I La k d I L B( ) 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: B 1 if N L 0 0 if N L 0 15

Specular reflection 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 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) 16

Specular reflection derivation For a perfect mirror reflector, light is reflected about N, so I I L if V R 0 otherwise 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

Phong specular reflection cos n s φ 1 0.9 0.8 0.7 0.6 ns = 1 0.5 0.4 0.3 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. Phong specular reflection is proportional to: where (x) + max(0, x). I specular ~ B(R V) n s Q: As n s gets larger, does the highlight on a curved surface get smaller or larger? 18

Blinn-Phong specular reflection 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: Analogous to Phong specular reflection, we can compute the specular contribution in terms of (N H), raised to a power n s : I specular ~ B(N H) n s where, again, (x) + max(0, x). 19

Iteration three The next update to the Blinn-Phong shading model is then: I k e k a I La k d I L B(N L) k s I L B(N H) n s where: n k e k a I La I L Bk d (N L) k s (N H) s 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. 20

Directional lights 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. Using affine notation, what is the homogeneous coordinate for a directional light? 21

Point lights The direction of a point light sources is determined by the vector from the light position to the surface point. E-P L= E-P r =E-P Physics tells us the intensity must drop off inversely with the square of the distance: f atten 1 r 2 Sometimes, this distance-squared dropoff is considered too harsh. A common alternative is: 1 f atten a br cr 2 with user-supplied constants for a, b, and c. Using affine notation, what is the homogeneous coordinate for a point light? 22

Spotlights We can also apply a directional attenuation of a point light source, giving a spotlight effect. A common choice for the spotlight intensity is: LS e f = spot a br cr 2 0 otherwise where 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 23

Iteration four Since light is additive, we can handle multiple lights by taking the sum over every light. Our equation is now (for spotlight lighting): I k e j k a I La, j L j S j e j j a j b j r j c j r I B k 2 L, j j d N L j k s N H j j n s This is the Blinn-Phong illumination model (for spotlights). Note that, in practice, we usually set k a = k d. Which quantities are spatial vectors? Which are RGB triples? Which are scalars? 24

Choosing Blinn-Phong shading parameters 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 Metal large Small, color of metal Large, color of metal Plastic medium Medium, color of plastic Medium, white Planet 0 varying 0 25

BRDF For more physical correctness, we would also weight the specular part by N L: n I I L Bk d (N L) k s (N L) N L V s L V I L B(N L) k d k s N L V n s L V I L B(N L) f r (L,V) The function f r maps incoming (light) directions in to outgoing (viewing) directions out : f r ( in, out ) or f r ( in out ) This function is called the Bi-directional Reflectance Distribution Function (BRDF). Here s a plot with in held constant: in f r ( in, out ) BRDF s can be quite sophisticated 26

More sophisticated BRDF s [Cook and Torrance, 1982] Anisotropic BRDFs [Westin, Arvo, Torrance 1992] Artistics BRDFs [Gooch] 27

More sophisticated BRDF s (cont d) Hair illuminated from different angles [Marschner et al., 2003] Wool cloth and silk cloth [Irawan and Marschner, 2012] 28

BSSRDFs for subsurface scattering [Jensen et al., 2001] 29