CMSC427 Shading Intro. Credit: slides from Dr. Zwicker

Similar documents
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

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

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

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

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

Comp 410/510 Computer Graphics. Spring Shading

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

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

Shading. Brian Curless CSE 557 Autumn 2017

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

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

Computer Graphics. Illumination and Shading

CS 5625 Lec 2: Shading Models

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

CPSC 314 LIGHTING AND SHADING

Illumination & Shading: Part 1

rendering equation computer graphics rendering equation 2009 fabio pellacini 1

Illumination & Shading

w Foley, Section16.1 Reading

Shading 1: basics Christian Miller CS Fall 2011

CENG 477 Introduction to Computer Graphics. Ray Tracing: Shading

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

CS5620 Intro to Computer Graphics

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

Shading I Computer Graphics I, Fall 2008

Shading. Brian Curless CSE 457 Spring 2017

Lighting and Materials

Illumination and Shading

The Rendering Equation. Computer Graphics CMU /15-662

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

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

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

CSE 681 Illumination and Phong Shading

Sung-Eui Yoon ( 윤성의 )

Illumination Models & Shading

Illumination. Illumination CMSC 435/634

Simple Lighting/Illumination Models

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

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

Lecture 15: Shading-I. CITS3003 Graphics & Animation

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

CS6670: Computer Vision

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

Shading & Material Appearance

CSE 167: Introduction to Computer Graphics Lecture #5: Illumination Model

Introduction to Computer Graphics 7. 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 2014

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

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

Radiometry and reflectance

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

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

CS 4600 Fall Utah School of Computing

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

Rendering Light Reflection Models

Virtual Reality for Human Computer Interaction

ECS 175 COMPUTER GRAPHICS. Ken Joy.! Winter 2014

Lighting affects appearance

Rendering Light Reflection Models

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

Understanding Variability

CS6670: Computer Vision

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

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

Color and Light CSCI 4229/5229 Computer Graphics Fall 2016

Light Reflection Models

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

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

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

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

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

Local vs. Global Illumination & Radiosity

CS-184: Computer Graphics. Today

BRDF Computer Graphics (Spring 2008)

Capturing light. Source: A. Efros

02 Shading and Frames. Steve Marschner CS5625 Spring 2016

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

Shading and Illumination

Illumination in Computer Graphics

LIGHTING AND SHADING

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

Visualisatie BMT. Rendering. Arjan Kok

Global Illumination. Why Global Illumination. Pros/Cons and Applications. What s Global Illumination

Illumination & Shading

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

The Rendering Equation. Computer Graphics CMU /15-662, Fall 2016

Computer Graphics. Illumination and Shading

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

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

Lighting and Shading. Slides: Tamar Shinar, Victor Zordon

Visual Appearance and Color. Gianpaolo Palma

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

Lighting affects appearance

Light. Properties of light. What is light? Today What is light? How do we measure it? How does light propagate? How does light interact with matter?

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

CS5670: Computer Vision

Reflection models and radiometry Advanced Graphics

Transcription:

CMSC427 Shading Intro Credit: slides from Dr. Zwicker

2 Today Shading Introduction Radiometry & BRDFs Local shading models Light sources Shading strategies

Shading Compute interaction of light with surfaces Requires simulation of physics Solve Maxwell s equations (wave model)? http://en.wikipedia.org/wiki/maxwell's_equations Use geometrical optics (ray model)? http://en.wikipedia.org/wiki/geometrical_optics http://en.wikipedia.org/wiki/ray_(optics) 3

Global illumination in computer graphics http://en.wikipedia.org/wiki/global_illumination Gold standard for photorealistic image synthesis Based on geometrical optics (ray model) Multiple bounces of light Reflection, refraction, volumetric scattering, subsurface scattering Computationally expensive, minutes per image Movies, architectural design, etc. 4

Global illumination Henrik Wann Jensen Henrik Wann Jensen http://www.pbrt.org/gallery.php Henrik Wann Jensen 5

Interactive applications Approximations to global illumination possible, but not standard today Usually Reproduce perceptually most important effects One bounce of light between light source and viewer Local/direct illumination Object Indirect illumination, Not supported Surface One bounce of light, direct illumination 6

Local illumination Each object rendered by itself 7

8 Today Shading Introduction Radiometry & BRDFs Local shading models Light sources Shading strategies

9 Material appearance What is giving a material its color and appearance? How is light reflected by a Mirror White sheet of paper Blue sheet of paper Glossy metal

10 Radiometry Physical units to measure light energy Based on the geometrical optics model Light modeled as rays Rays are idealized narrow beams of light http://en.wikipedia.org/wiki/ray_%28optics%29 Rays carry a spectrum of electromagnetic energy No wave effects, like interference or diffraction Diffraction pattern from square aperture

Solid angle Area of a surface patch on the unit sphere In our context: area spanned by a set of directions Unit: steradian Directions usually denoted by Unit sphere 11

12 Angle and solid angle Circle with radius r Sphere with radius R Angle Unit circle has radians Solid angle Unit sphere has steradians

13 Radiance http://en.wikipedia.org/wiki/radiance Energy carried along a narrow beam (ray) of light Energy passing through a small area in a small bundle of directions, divided by area and by solid angle spanned by bundle of directions, in the limit as area and solid angle tend to zero Units: energy per area per solid angle

14 Radiance Think of light consisting of photon particles, each traveling along a ray Radiance is photon ray density Number of photons per area per solid angle Number of photons passing through small cylinder, as cylinder becomes infinitely thin

15 Pinhole camera Records radiance on projection screen http://en.wikipedia.org/wiki/pinhole_camera

Radiance Spectral radiance: energy at each wavelength/frequency (count only photons of given wavelength) Usually, work with radiance for three discrete wavelengths Corresponding to R,G,B primaries Energy Frequency 16

Irradiance Energy per area: energy going through a small area, divided by size of area Radiance summed up over all directions Units Irradiance: Count number of photons per area, in the limit as area becomes infinitely small 17

For each pair of light/view direction, BRDF gives fraction of reflected light 18 Local shading Goal: model reflection of light at surfaces Bidirectional reflectance distribution function (BRDF) http://en.wikipedia.org/wiki/bidirectional_reflectance_distribution_function Given light direction, viewing direction, obtain fraction of light reflected towards the viewer For any pair of light/viewing directions! For different wavelenghts (or R, G, B) separately

BRDFs BRDF describes appearance of material Color Diffuse Glossy Mirror Etc. BRDF can be different at each point on surface Spatially varying BRDF (SVBRDF) Textures 19

20 Technical definition Given incident and outgoing directions BRDF is fraction of radiance reflected in outgoing direction over incident irradiance arriving from narrow beam of directions Units Incident irradiance from small beam of directions Reflected radiance

21 Irradiance from a narrow beam Narrow beam of parallel rays shining on a surface Area covered by beam varies with the angle between the beam and the normal n The larger the area, the less incident light per area Irradiance (incident light per unit area) is proportional to the cosine of the angle between the surface normal n and the light rays Equivalently, irradiance contributed by beam is radiance of beam times cosine of angle between normal n and beam direction n n n Area covered by beam

22 Shading with BRDFs Given radiance arriving from each direction, outgoing direction For all incoming directions over the hemisphere 1. Compute irradiance from incoming beam 2. Evaluate BRDF with incoming beam direction, outgoing direction 3. Multiply irradiance and BRDF value 4. Accumulate Mathematically, a hemispherical integral ( shading integral ) https://en.wikipedia.org/wiki/rendering_equation Incident irradiance from small beam of directions Hemisphere Reflected radiance

23 Shading with BRDFs If only discrete number of small light sources taken into account, need minor modification of algorithm For each light source 1. Compute irradiance arriving from light source 2. Evaluate BRDF with direction to light source, outgoing direction 3. Multiply irradiance and BRDF value 4. Accumulate Incident irradiance for each light source Reflected radiance

Limitations of BRDF model Cannot model Fluorescence Subsurface and volume scattering Polarization Interference/diffraction 24

25 Visualizing BRDFs Given viewing or light direction, plot BRDF value over sphere of directions Illustration in flatland (1D slices of 2D BRDFs) Diffuse reflection Glossy reflection

26 Visualizing BRDFs Can add up several BRDFs to obtain more complicated ones

BRDF representation How to define and store BRDFs that represent physical materials? Physical measurements Gonioreflectometer: robot with light source and camera Measures reflection for each light/camera direction Store measurements in table Too much data for interactive application 4 degrees of freedom! Light source Material sample Camera Cornell University Gonioreflectometer 27

BRDF representation Analytical models Try to describe phyiscal properties of materials using mathematical expressions Many models proposed in graphics http://en.wikipedia.org/wiki/bidirectional_reflectance_distribution_function http://en.wikipedia.org/wiki/cook-torrance http://en.wikipedia.org/wiki/oren-nayar_diffuse_model Will restrict ourselves to simple models here 28

29 Today Shading Introduction Radiometry & BRDFs Local shading models Light sources Shading strategies

30 Simplified model BRDF is sum of diffuse, specular, and ambient components Covers a large class of real surfaces Each is simple analytical function Incident light from discrete set of light sources (discrete set of directions) Model is not completely physically justified! diffuse specular ambient

Simplified physical model Approximate model for two-layer materials Subsurface scattering leading to diffuse reflection on bottom layer Mirror reflection on (rough) top layer + diffuse specular 31

Diffuse reflection Ideal diffuse material reflects light equally in all directions Also called Lambertian surfaces http://en.wikipedia.org/wiki/lambert's_cosine_law View-independent Surface looks the same independent of viewing direction Matte, not shiny materials Paper Unfinished wood Unpolished stone Diffuse reflection Diffuse sphere 32

33 Diffuse reflection Radiance reflected by a diffuse ( Lambertian ) surface is constant over all directions Hm, why do we see brightness variations over diffuse surfaces?

Diffuse reflection Given Light color (radiance) c l Unit surface normal One light source, unit light direction Material diffuse reflectance (material color) k d Diffuse reflection c d Cosine between normal and light, converts radiance to incident irradiance 34

35 Diffuse reflection Notes on Parameters k d, c l are r,g,b vectors c l : radiance of light source : irradiance on surface k d is diffuse BRDF, a constant! Compute r,g,b values of reflected color c d separately

Diffuse reflection Provides visual cues Surface curvature Depth variation Lambertian (diffuse) sphere under different lighting directions 36

37 Simplified model diffuse specular ambient

Specular reflection Shiny or glossy surfaces Polished metal Glossy car finish Plastics Specular highlight Blurred reflection of the light source Position of highlight depends on viewing direction Sphere with specular highlight 38

Shiny or glossy materials 39

Specular reflection Ideal specular reflection is mirror reflection Perfectly smooth surface Incoming light ray is bounced in single direction Angle of incidence equals angle of reflection Angle of incidence Angle of reflection 40

Law of reflection Angle of incidence equals angle of reflection applied to 3D vectors L and R Equation expresses constraints: 1. Normal, incident, and reflected direction all in same plane (L+R is a point along the normal) 2. Angle of incidence q i = angle of reflection q r 41

42 Glossy materials Many materials not quite perfect mirrors Glossy materials have blurry reflection of light source Mirror direction Glossy teapot with highlights from many light sources

43 Physical model Assume surface composed of small mirrors with random orientation (microfacets) Smooth surfaces Microfacet normals close to surface normal Sharp highlights Rough surfaces Microfacet normals vary strongly Leads to blurry highlight Polished Smooth Rough Very rough

Physical model Expect most light to be reflected in mirror direction Because of microfacets, some light is reflected slightly off ideal reflection direction Reflection Brightest when view vector is aligned with reflection Decreases as angle between view vector and reflection direction increases 44

45 Phong model http://en.wikipedia.org/wiki/phong_shading Simple implementation of the physical model Radiance of light source c l Specular reflectance coefficient k s Phong exponent p Higher p, smaller (sharper) highlight Reflected radiance

46 Note Technically, Phong BRDF is Irradiance BRDF Phong model is not usually considered a BRDF, because it violates energy conservation http://en.wikipedia.org/wiki/bidirectional_reflectance_distribution_function#physically_based_brdfs

Phong model 47

48 Blinn model (Jim Blinn, 1977) Alternative to Phong model Define unit halfway vector Halfway vector represents normal of microfacet that would lead to mirror reflection to the eye

49 Blinn model The larger the angle between microfacet orientation and normal, the less likely Use cosine of angle between them Shininess parameter Very similar to Phong Reflected radiance

50 Simplified model diffuse specular ambient

51 Ambient light In real world, light is bounced all around scene Could use global illumination techniques to simulate Simple approximation Add constant ambient light at each point Ambient light Ambient reflection coefficient Areas with no direct illumination are not completely dark

52 Complete model Blinn model with several light sources i diffuse specular ambient

Notes All colors, reflection coefficients have separate values for R,G,B Usually, ambient = diffuse coefficient For metals, specular = diffuse coefficient Highlight is color of material For plastics, specular coefficient = (x,x,x) Highlight is color of light 53

54 Today Shading Introduction Radiometry & BRDFs Local shading models Light sources Shading strategies

Light sources Light sources can have complex properties Geometric area over which light is produced Anisotropy in direction Variation in color Reflective surfaces act as light sources Interactive rendering is based on simple, standard light sources 55

Light sources At each point on surfaces need to know Direction of incoming light (the L vector) Radiance of incoming light (the c l values) Standard, simplified light sources Directional: from a specific direction Point light source: from a specific point Spotlight: from a specific point with intensity that depends on the direction No model for light sources with an area! 56

Directional light Light from a distant source Light rays are parallel Direction and radiance same everywhere in 3D scene As if the source were infinitely far away Good approximation to sunlight Specified by a unit length direction vector, and a color Light source Receiving surface 57

Point lights Simple model for light bulbs Infinitesimal point that radiates light in all directions equally Light vector varies across the surface Radiance drops off proportionally to the inverse square of the distance from the light Intuition for inverse square falloff? Not physically plausible! 58

59 Point lights p c src Light source c l v c l Receiving surface v Incident light direction Radiance

Spotlights Like point source, but radiance depends on direction Parameters Position, the location of the source Spot direction, the center axis of the light Falloff parameters how broad the beam is (cone angle q max ) how light tapers off at edges of he beam (cosine exponent f) 60

61 Spotlights Light source Receiving surface

62 Spotlights Photograph of spotlight Spotlights in OpenGL

63 Today Shading Introduction Radiometry & BRDFs Local shading models Light sources Shading strategies

Per-triangle, -vertex, -pixel shading May compute shading operations Once per triangle Once per vertex Once per pixel Scene data Vertex processing, Modeling and viewing transformation Projection Rasterization, visibility, (shading) Image 64

Per-triangle shading Known as flat shading Evaluate shading once per triangle using pertriangle normal Advantages Fast Disadvantages Faceted appearance 65

66 Per-vertex shading Known as Gouraud shading (Henri Gouraud 1971) Per-vertex normals Interpolate vertex colors across triangles Advantages Fast Smoother than flat shading Disadvantages Problems with small highlights

Per-pixel shading Also known as Phong interpolation (not to be confused with Phong illumination model) Rasterizer interpolates normals across triangles Illumination model evaluated at each pixel Implemented using programmable shaders (next week) Advantages Higher quality than Gouraud shading Disadvantages Much slower, but no problem for today s GPUs 67

68 Gouraud vs. per-pixel shading Gouraud has problems with highlights Could use more triangles Gouraud Per-pixel, same triangles

What about shadows? Standard shading assumes light sources are visible everywhere Does not determine if light is blocked No shadows! Shadows require additional work Later in the course 69

70 What about textures? How to combine colors stored in textures and lighting computations? Interpret textures as shading coefficients Usually, texture used as ambient and diffuse reflectance coefficient k d, k a Textures provide spatially varying BRDFs Each point on surface has different BRDF parameters, different appearance

71 Summary Local illumination (single bounce) is computed using BRDF BRDF captures appearance of a material Amount of reflected light for each pair of light/viewing directions Simplified model for BRDF consists of diffuse + Phong/Blinn + ambient Lambert s law for diffuse surfaces Microfacet model for specular part Ambient to approximate multiple bounces Light source models Directional Point, spot, inverse square fall-off Different shading strategies Per triangle, Gouraud, per pixel