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

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

CS-184: Computer Graphics. Today

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

Today. Global illumination. Shading. Interactive applications. Rendering pipeline. Computergrafik. Shading Introduction Local shading models

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

Illumination. Illumination CMSC 435/634

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

w Foley, Section16.1 Reading

Computer Graphics. Illumination and Shading

Illumination and Shading

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

Interactive Real-Time Raycasting

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

Illumination & Shading: Part 1

Shading. Brian Curless CSE 557 Autumn 2017

Lighting and Shading

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

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

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

Computer Graphics. Illumination and Shading

ECS 175 COMPUTER GRAPHICS. Ken Joy.! Winter 2014

Sung-Eui Yoon ( 윤성의 )

CPSC / Illumination and Shading

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

Shading I Computer Graphics I, Fall 2008

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

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

Raytracing CS148 AS3. Due :59pm PDT

Illumination & Shading

Lighting and Shading. Slides: Tamar Shinar, Victor Zordon

Visualisatie BMT. Rendering. Arjan Kok

Shading 1: basics Christian Miller CS Fall 2011

Shading. Brian Curless CSE 457 Spring 2017

Comp 410/510 Computer Graphics. Spring Shading

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

Introduction to Visualization and Computer Graphics

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

CSE 681 Illumination and Phong Shading

Announcement. Lighting and Photometric Stereo. Computer Vision I. Surface Reflectance Models. Lambertian (Diffuse) Surface.

CS 5625 Lec 2: Shading Models

Color and Light CSCI 4229/5229 Computer Graphics Fall 2016

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

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.

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

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

Pipeline Operations. CS 4620 Lecture 10

Simple Lighting/Illumination Models

Topics and things to know about them:

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

Lecture 15: Shading-I. CITS3003 Graphics & Animation

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

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

How do we draw a picture?

Rendering Light Reflection Models

Rendering Light Reflection Models

Introduction to Computer Graphics 7. Shading

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

Illumination and Shading

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

Lighting/Shading III. Week 7, Wed Mar 3

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

CS 325 Computer Graphics

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

Light Reflection Models

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

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

Light Sources. Spotlight model

Complex Shading Algorithms

Lecture 4: Reflection Models

9. Illumination and Shading

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

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

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

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

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

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

CEng 477 Introduction to Computer Graphics Fall

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

Reflection and Shading

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

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

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

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

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

Light Transport Baoquan Chen 2017

CENG 477 Introduction to Computer Graphics. Ray Tracing: Shading

02 Shading and Frames. Steve Marschner CS5625 Spring 2016

LEVEL 1 ANIMATION ACADEMY2010

And if that 120MP Camera was cool

Shading. Brian Curless CSE 457 Spring 2015

CS770/870 Spring 2017 Color and Shading

Shading , Fall 2004 Nancy Pollard Mark Tomczak

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

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

Transcription:

CS-184: Computer Graphics Lecture #3: Shading Prof. James O Brien University of California, Berkeley V2011-F-03-1.0 Announcements Assignment 1: due Friday, Sept 2 Assignment 2: due Tuesday, Sept 6 Assignment 3: due Monday, Sept 19 2

Today Local Illumination & Shading The BRDF Simple diffuse and specular approximations Shading interpolation: flat, Gouraud, Phong Some miscellaneous tricks 3 Local Shading Local: consider in isolation 1 light 1 surface The viewer Recall: lighting is linear Almost always... 4

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

The BRDF The Bi-directional Reflectance Distribution Function Given Surface material ρ = ρ(θ V,θ L ) Incoming light direction = ρ(v,l,n) Direction of viewer Orientation of surface Return: fraction of light that reaches the viewer We ll worry about physical units later... 6 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 ) 7

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

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

A Simple Model Approximate BRDF as sum of A diffuse component A specular component A ambient term + + = 12 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 13

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

Diffuse Component Plot light leaving in a given direction: Plot light leaving from each point on surface 15 Diffuse Component Plot light leaving in a given direction: Plot light leaving from each point on surface 15

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 16 Specular Component k s I(ˆr ˆv) p N k s I max(ˆr ˆv,0) p L V R 17

Specular Component Computing the reflected direction ˆr = ˆl + 2(ˆl ˆn)ˆn n l r θ n cos θ n cos θ -l 18 Specular Component Half-angle approximation for specular ĥ = ˆl + ˆv ˆl + ˆv l n ω h e different specular term k s I(ĥ ˆn)p *Don t use half-angle approximation in your assignment! 19

Specular Component Plot light leaving in a given direction: Plot light leaving from each point on surface 20 Specular Component Plot light leaving in a given direction: Plot light leaving from each point on surface 20

Specular Component Plot light leaving in a given direction: Plot light leaving from each point on surface 20 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 21

Ambient Term Really, its a cheap hack Accounts for ambient, omnidirectional light Without it everything looks like it s in space 22 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 k? RGB in practice Sum over all lights are by wavelength 23

Anisotropy 24 Metal -vs- Plastic 25

Metal -vs- Plastic 26 Other Color Effects 27

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. is pure black and. This fuse shading where would look much like traditional diffuse shading, but the entire ob. What we ject would vary in luminance, including where would really like is a compromise between these strategies. These transitions will result in a combination of tone scaled object-color and a cool-to-warm undertone, an effect which artists achieve by combining pigments. We can simulate undertones by a linear blend between the blue/yellow and black/object-color tones: 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. select pure black to object color 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. + = final tone (3) 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 colors recede while Images from Gooch et. al, 1998 warm colors advance. In addition, object colors change tempera28 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 leaves us with four free parameters:,,, and. The values for and will determine the strength of the overall temperature shift, and the values of and will determine the prominence of the object color and the strength of the luminance shift. Because we want to stay away from shading which will visually interfere with black and white, we should supply intermediate values for these constants. An example of a resulting tone for a pure red object is shown in Figure 2. and from Equation 3 Substituting the values for into the tone Equation 2 results in shading with values within the, middle luminance range as desired. Figure 7 is shown with,, and. To show that the exact values are not crucial to appropriate appearance, the same model is shown in,,, and. Unlike Figure 8 with Figure 5, subtleties of shape in the claws are visible in Figures 7 and 8. The model is appropriate for a range of object colors. Both traditional shading and the new tone-based shading are applied to a set of spheres in Figure 9. Note that with the new shading method objects retain their color name so colors can still be used to differentiate objects like countries on a political map, but the intensities used do not interfere with the clear perception of black edge lines and white highlights. 4.3 Shading of Metal Objects (2) Measured BRDFs Note that the quantity varies over the interval. To ensure the image shows this full variation, the light vector should be perpendicular to the gaze direction. Because the human vision system assumes illumination comes from above [9], we chose to position the light up and to the right and to keep this position constant. An image that uses a color scale with little luminance variation is shown in Figure 6. This image shows that a sense of depth can be communicated at least partially by a hue shift. However, the lack of a strong cool to warm hue shift and the lack of a luminance shift makes the shape information subtle. We speculate that the unnatural colors are also problematic. In order to automate this hue shift technique and to add some luminance variation to our use of tones, we can examine two extreme possibilities for color scale generation: blue to yellow tones and scaled object-color shades. Our final model is a linear combination of these techniques. Blue and yellow tones are chosen to insure a cool to warm color transition regardless of the diffuse color of the object. The blue-to-yellow tones range from a fully saturated blue: in RGB space to a fully saturated yel. This produces a very sculpted low: but unnatural image, and is independent of the object s diffuse reis a variation of difflectance. The extreme tone related to BRDFs for automotive paint Images from Cornell University Program of Computer Graphics 29 Illustrators use a different technique to communicate whether or not an object is made of metal. In practice illustrators represent a metallic surface by alternating dark and light bands. This technique is the artistic representation of real effects that can be seen on milled metal parts, such as those found on cars or appliances. Milling creates what is known as anisotropic reflection. Lines are streaked in the direction of the axis of minimum curvature, parallel to the milling axis. Interestingly, this visual convention is used even for smooth metal objects [15, 18]. This convention emphasizes that realism is not the primary goal of technical illustration. To simulate a milled object, we map a set of twenty stripes of varying intensity along the parametric axis of maximum curvature. The stripes are random intensities between 0.0 and 0.5 with the stripe closest to the light source direction overwritten with white. Between the stripe centers the colors are linearly interpolated. An object is shown Phong-shaded, metal-shaded (with and without edge lines), and metal-shaded with a cool-warm hue shift in Figure 10. The metal-shaded object is more obviously metal than the Phong-shaded image. The cool-warm hue metal-shaded object is not quite as convincing as the achromatic image, but it is more visually consistent with the cool-warm matte shaded model of Section 4.2, so it is useful when both metal and matte objects are shown together. We note that our banding algorithm is very similar to the technique Williams applied to a clear drinking glass using image processing [25].

Measured BRDFs BRDFs for aerosol spray paint Images from Cornell University Program of Computer Graphics 30 Measured BRDFs BRDFs for house paint Images from Cornell University Program of Computer Graphics 31

Measured BRDFs BRDFs for lucite sheet Images from Cornell University Program of Computer Graphics 32 Details Beget Realism The computer generated look is often due to a lack of fine/subtle details... a lack of richness. From bustledress.com 33

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 34 Falloff Physically correct: 1/r 2 Tends to look bad (why?) Not used in practice Sometimes compromise of light intensify falloff 1/r used 35

Spot and Other Lights Other calculations for useful effects Spot light Only light certain objects Negative lights etc. 36 Ugly... 37

Ugly... 38 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 39

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... 40 Smooth Shading Compute average normal at vertices Interpolate across polygons Use threshold for sharp edges Vertex may have different normals for each face 41

Smooth Shading 42 Gouraud Shading Compute shading at each vertex Interpolate colors from vertices Pros: fast and easy, looks smooth Cons: terrible for specular reflections Flat Note: Gouraud was hardware rendered... Gouraud 43

Phong Shading Compute shading at each pixel Interpolate normals from vertices Pros: looks smooth, better speculars Cons: expensive Gouraud Note: Gouraud was hardware rendered... Phong 44