CS-184: Computer Graphics. Today

Similar documents
CS-184: Computer Graphics. Announcements. Lecture #3: Shading. 03-Shading.key - January 28, 2014

CS-184: Computer Graphics. Announcements. Lecture #3: Shading. Wednesday, August 31, 11

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

Illumination. Illumination CMSC 435/634

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

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

Illumination Models & Shading

CS5620 Intro to Computer Graphics

CPSC 314 LIGHTING AND SHADING

Illumination and Shading

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

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

Computer Graphics. Illumination and Shading

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

w Foley, Section16.1 Reading

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

Lighting and Shading

Illumination & Shading: Part 1

Shading. Brian Curless CSE 557 Autumn 2017

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

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

CPSC / Illumination and Shading

Computer Graphics. Illumination and Shading

Shading I Computer Graphics I, Fall 2008

ECS 175 COMPUTER GRAPHICS. Ken Joy.! Winter 2014

Raytracing CS148 AS3. Due :59pm PDT

Interactive Real-Time Raycasting

Visualisatie BMT. Rendering. Arjan Kok

CSE 681 Illumination and Phong Shading

Introduction to Visualization and Computer Graphics

Lighting and Shading. Slides: Tamar Shinar, Victor Zordon

Simple Lighting/Illumination Models

Sung-Eui Yoon ( 윤성의 )

Shading. Brian Curless CSE 457 Spring 2017

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

Rendering Light Reflection Models

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

Rendering Light Reflection Models

Illumination & Shading

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

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

Comp 410/510 Computer Graphics. Spring Shading

Shading 1: basics Christian Miller CS Fall 2011

Pipeline Operations. CS 4620 Lecture 10

Introduction to Computer Graphics 7. Shading

Light Reflection Models

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

CS580: Ray Tracing. Sung-Eui Yoon ( 윤성의 ) Course URL:

Rendering. Illumination Model. Wireframe rendering simple, ambiguous Color filling flat without any 3D information

CS 5625 Lec 2: Shading Models

Pipeline Operations. CS 4620 Lecture 14

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

Color and Light CSCI 4229/5229 Computer Graphics Fall 2016

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

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

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

Ambien Occlusion. Lighting: Ambient Light Sources. Lighting: Ambient Light Sources. Summary

How do we draw a picture?

Topics and things to know about them:

Lighting/Shading III. Week 7, Wed Mar 3

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

Lecture 15: Shading-I. CITS3003 Graphics & Animation

The Rasterization Pipeline

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

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

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

Complex Shading Algorithms

CEng 477 Introduction to Computer Graphics Fall

Illumination and Shading

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

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

Point based global illumination is now a standard tool for film quality renderers. Since it started out as a real time technique it is only natural

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

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

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

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

Lecture 4: Reflection Models

Global Illumination. CSCI 420 Computer Graphics Lecture 18. BRDFs Raytracing and Radiosity Subsurface Scattering Photon Mapping [Ch

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

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

Reflection and Shading

Illumination in Computer Graphics

Color and Shading. Color. Shapiro and Stockman, Chapter 6. Color and Machine Vision. Color and Perception

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

9. Illumination and Shading

Graphics Hardware and Display Devices

Virtual Reality for Human Computer Interaction

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

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

Global Illumination CS334. Daniel G. Aliaga Department of Computer Science Purdue University

Light Transport Baoquan Chen 2017

Illumination and Shading

02 Shading and Frames. Steve Marschner CS5625 Spring 2016

CS 325 Computer Graphics

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

CENG 477 Introduction to Computer Graphics. Ray Tracing: Shading

-=Bui Tuong Phong's Lighting=- University of Utah, but with shaders. Anton Gerdelan Trinity College Dublin

Transcription:

CS-184: Computer Graphics Lecture #8: Shading Prof. James O Brien University of California, Berkeley V2006-S-08-2.0 Today Local Illumination & Shading The BRDF Simple diffuse and specular approximations Shading interpolation: flat, Gouraud, Phong Some miscellaneous tricks Normal Vectors 2

Local Shading Local: consider in isolation 1 light 1 surface The viewer Recall: lighting is linear Almost always... Counter example: photochromatic materials 3 Local Shading Examples of non-local phenomena Shadows Reflections Refraction Indirect lighting 4

The BRDF The Bi-directional Reflectance Distribution Function Given! =!(" V," L ) Surface material =!(v,l,n) Incoming light direction Direction of viewer Orientation of surface Return: fraction of light that reaches the viewer We ll worry about physical units later... 5 The BRDF!(v,l,n) ˆl ˆn ˆv Spatial variation capture by the material Frequency dependent Typically use separate RGB functions Does not work perfectly Better:! =!(" V," L,# in,# out ) 6

Obtaining BRDFs Measure from real materials Images from Marc Levoy 7 Obtaining BRDFs Measure from real materials Computer simulation Simple model + complex geometry Derive model by analysis Make something up 8

Beyond BRDFs The BRDF model does not capture everything e.g. Subsurface scattering (BSSRDF) Images from Jensen et. al, SIGGRAPH 2001 9 Beyond BRDFs The BRDF model does not capture everything e.g. Inter-frequency interactions! =!(" V," L,# in,# out ) This version would work... 10

A Simple Model Approximate BRDF as sum of A diffuse component A specular component A ambient term + + = 11 Diffuse Component Lambert s Law Intensity of reflected light proportional to cosine of angle between surface and incoming light direction Applies to diffuse, Lambertian, or matte surfaces Independent of viewing angle Use as a component of non-lambertian surfaces 12

Diffuse Component k d I(ˆl ˆn) Comment about two-side lighting in text is wrong... max(k d I(ˆl ˆn),0) 13 Diffuse Component Plot light leaving in a given direction: Plot light leaving from each point on surface 14

Specular Component Specular component is a mirror-like reflection Phong Illumination Model A reasonable approximation for some surfaces Fairly cheap to compute Depends on view direction 15 Specular Component k s I(ˆr ˆv) p k s I max(ˆr ˆv,0) p L N V R 16

Specular Component Computing the reflected direction ˆr = ˆl + 2(ˆl ˆn)ˆn n l r θ n cos θ n cos θ ĥ = ˆl + ˆv ˆl + ˆv l n ω h -l e 17 Specular Component Plot light leaving in a given direction: Plot light leaving from each point on surface 18

Specular Component Specular exponent sometimes called roughness n=1 n=2 n=4 n=8 n=16 n=32 n=64 n=128 n=256 19 Ambient Term Really, its a cheap hack Accounts for ambient, omnidirectional light Without it everything looks like it s in space 20

Summing the Parts R = k a I + k d I max(ˆl ˆn,0) + k s I max(ˆr ˆv,0) p + + = Recall that the RGB in practice k? Sum over all lights are by wavelength 21 Anisotropy 22

Metal -vs- Plastic 23 Metal -vs- Plastic 24

Other Color Effects 25 Other Color Effects Figure 9: Top: Colored Phong-shaded spheres with edge lines and highlights. Bottom: Colored spheres shaded with hue and luminance shift, including edge lines and highlights. Note: In the first Phong shaded sphere (violet), the edge lines disappear, but are visible in the corresponding hue and luminance shaded violet sphere. In the last Phong shaded sphere (white), the highlight vanishes, but is noticed in the corresponding hue and luminance shaded white sphere below it. The spheres in the second row also retain their color name. Figure 9: Top: Colored Phong-shaded spheres with edge lines and highlights. Bottom: Colored spheres shaded with hue and luminance shift, including edge lines and highlights. Note: In the first Phong shaded sphere (violet), the edge lines disappear, but are visible in the corresponding hue and luminance shaded violet sphere. In the last Phong shaded sphere (white), the highlight vanishes, but is noticed in the corresponding hue and luminance shaded white sphere below it. The spheres in the second row also retain their color name. darken pure blue to yellow Figure 10: Left to Right: a) Phong shaded object. b) New metal-shaded object without edge lines. c) New metal-shaded object with edge lines. d) New metal-shaded object with a cool-to-warm shift. Figure 10: Left to Right: a) Phong shaded object. b) New metal-shaded object without edge lines. c) New metal-shaded object with edge lines. d) New metal-shaded object with a cool-to-warm shift. select pure black to object color + = is pure black an fuse shading where would look much like traditional diffuse sha ject would vary in luminance, including wh would really like is a compromise between transitions will result in a combination of to and a cool-to-warm undertone, an effect w combining pigments. We can simulate unde between the blue/yellow and black/object-co final tone Figure 2: How the tone is created for a pure red object by summing a blue-to-yellow and a dark-red-to-red tone. Figure 11: Left to Right: a) Phong model for colored object. b) New shading model with highlights, cool-to-warm hue shift, and without edge lines. c) New model using edge lines, highlights, and cool-to-warm hue shift. d) Approximation using conventional Phong shading, two colored lights, and edge lines. Figure 11: Left to Right: a) Phong model for colored object. b) New shading model with highlights, cool-to-warm hue shift, and without edge lines. c) New model using edge lines, highlights, and cool-to-warm hue shift. d) Approximation using conventional Phong shading, two colored lights, and edge lines. created by adding grey to a certain color they are called tones [2]. Such tones vary in hue but do not typically vary much in luminance. When the complement of a color is used to create a color scale, they are also called tones. Tones are considered a crucial concept to illustrators, and are especially useful when the illustrator is restricted to a small luminance range [12]. Another quality of color used by artists is the temperature of the color. The temperature of a color is defined as being warm (red, orange, and yellow), cool (blue, violet, and green), or temperate (red-violets and yellow-greens). The depth cue comes from the perception that cool recede while Images from Gooch et.colors al, 1998 warm colors advance. In addition, object colors change tempera26 ture in sunlit scenes because cool skylight and warm sunlight vary in relative contribution across the surface, so there may be ecological reasons to expect humans to be sensitive to color temperature variation. Not only is the temperature of a hue dependent upon the hue itself, but this advancing and receding relationship is effected by proximity [4]. We will use these techniques and their psychophysical relationship as the basis for our model. We can generalize the classic computer graphics shading model ) of Equato experiment with tones by using the cosine term ( and : tion 1 to blend between two RGB colors, Plugging these values into Equation 2 leave rameters:,,, and. The values for an strength of the overall temperature shift, and will determine the prominence of the object of the luminance shift. Because we want to ing which will visually interfere with black supply intermediate values for these consta resulting tone for a pure red object is shown and Substituting the values for into the tone Equation 2 results in shading middle luminance range as desired. Figure 7,, and. To show t not crucial to appropriate appearance, the s,, Figure 8 with Figure 5, subtleties of shape in the claws a and 8. The model is appropriate for a range of o ditional shading and the new tone-based sh set of spheres in Figure 9. Note that with th objects retain their color name so colors ca entiate objects like countries on a political m used do not interfere with the clear percept and white highlights.

Measured BRDFs BRDFs for automotive paint Images from Cornell University Program of Computer Graphics 27 Measured BRDFs BRDFs for aerosol spray paint Images from Cornell University Program of Computer Graphics 28

Measured BRDFs BRDFs for house paint Images from Cornell University Program of Computer Graphics 29 Measured BRDFs BRDFs for lucite sheet Images from Cornell University Program of Computer Graphics 30

Details Beget Realism The computer generated look is often due to a lack of fine/subtle details... a lack of richness. From bustledress.com 31 Direction -vs- Point Lights For a point light, the light direction changes over the surface For distant light, the direction is constant Similar for orthographic/perspective viewer 32

Falloff Physically correct: 1/r 2 light intensify falloff Tends to look bad (why?) Not used in practice Sometimes compromise of 1/r used 33 Spot and Other Lights Other calculations for useful effects Spot light Only light certain objects Negative lights etc. 34

Surface Normals The normal vector at a point on a surface is perpendicular to all surface tangent vectors For triangles normal given by right-handed cross product 35 Flat Shading Use constant normal for each triangle (polygon) Polygon objects don t look smooth Faceted appearance very noticeable, especially at specular highlights Recall mach bands... 36

Smooth Shading Compute average normal at vertices Interpolate across polygons Use threshold for sharp edges Vertex may have different normals for each face 37 Gouraud Shading Compute shading at each vertex Interpolate colors from vertices Pros: fast and easy, looks smooth Cons: terrible for specular reflections Flat Gouraud Note: Gouraud was hardware rendered... 38

Phong Shading Compute shading at each pixel Interpolate normals from vertices Pros: looks smooth, better speculars Cons: expensive Gouraud Phong Note: Gouraud was hardware rendered... 39 Transforming Normals Normals are directions But they must maintain underlaying geometric property A bit of manipulation ˆn (a b) = 0 ˆn T (a b) = 0 ˆn T new(ta Tb) = 0 ˆn T newt(a b) = 0 ˆn T T 1 T(a b) = 0 ˆn new = T Tˆn 40

Transforming Normals Special transformation rule for normals ˆn new = T Tˆn Note: A rotation is its own inverse transpose 41 Depth Distortion Recall depth distortion from perspective Interpolating in screen space different than in world Ok, for shading (mostly) Bad for texture Half way in world space World Screen Half way in screen space 42

Depth Distortion S 1 = P 1 /h 1 P 1 P 4 S 4 = P 4 /h 4 S 3 = P 3 /h 3 S 2 = P 2 /h 2 P 2 P 3 43 42 Depth Distortion S 1 = P 1 /h 1 P 1 P 4 S 4 = P 4 /h 4 S 3 = P 3 /h 3 S 2 = P 2 /h 2 X = i S i b i P 2 P 3 Q = P i a i i We know the S i, P i, and b i, but not the a i. 44 42

Depth Distortion S 1 = P 1 /h 1 P 1 P 4 S 4 = P 4 /h 4 S 3 = P 3 /h 3 P 2 P 3 S 2 = P 2 /h X = S 2 i b i Q = P i i a i i X = Q/h = P i a i / h j a j i j 45 42 Depth Distortion S 1 = P 1 /h 1 P 1 P 4 S 4 = P 4 /h 4 S 3 = P 3 /h 3 P 2 P 3 S 2 = P 2 /h X = S 2 i b i Q = P i i a i i S i b i = P i a i / h j a j i i j 46 42

Depth Distortion S 1 = P 1 /h 1 P 1 P 4 S 4 = P 4 /h 4 S 3 = P 3 /h 3 P 2 P 3 S 2 = P 2 /h X = S 2 i b i Q = P i i a i i P i b i /h i = P i a i / h j a j i i j 47 42 Depth Distortion Independent of given vertex locations. P i b i /h i = P i a i / h j a j i i j b i /h i = a i / h j a j i j 48 42

Depth Distortion Linear equations in the. a i b i /h i = a i / h j a j j h j a j b i /h i a i = 0 j i i 49 42 Depth Distortion Linear equations in the. a i Not invertible so add some extra constraints. h j a j b i /h i a i = 0 j a i = i i b i = 1 i 50

Depth Distortion For a line: a 1 = h 2 b i /(b 1 h 2 + h 1 b 2 ) For a triangle: a 1 = h 2 h 3 b 1 /(h 2 h 3 b 1 + h 1 h 3 b 2 + h 1 h 2 b 3 ) Obvious Permutations for other coefficients. 51