University of Victoria CSC 305 Shading. Brian Wyvill 2016

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

Comp 410/510 Computer Graphics. Spring Shading

Illumination Models & Shading

Illumination and Shading

CS5620 Intro to Computer Graphics

Shading I Computer Graphics I, Fall 2008

w Foley, Section16.1 Reading

Illumination & Shading

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

Illumination in Computer Graphics

Visualisatie BMT. Rendering. Arjan Kok

Shading. Introduction to Computer Graphics Torsten Möller. Machiraju/Zhang/Möller/Fuhrmann

CEng 477 Introduction to Computer Graphics Fall

Lecture 15: Shading-I. CITS3003 Graphics & Animation

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

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

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

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

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

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

Simple Lighting/Illumination Models

CS Illumination and Shading. Slide 1

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

Color and Light CSCI 4229/5229 Computer Graphics Fall 2016

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

CS770/870 Spring 2017 Color and Shading

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

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

CPSC / Illumination and Shading

Computer Graphics: 3-Local Illumination Models

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

CPSC 314 LIGHTING AND SHADING

ECS 175 COMPUTER GRAPHICS. Ken Joy.! Winter 2014

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

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

Lecture 17: Shading in OpenGL. CITS3003 Graphics & Animation

How do we draw a picture?

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

Virtual Reality for Human Computer Interaction

Computer Graphics. Illumination and Shading

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

Illumination and Shading

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

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

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

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

Objectives Shading in OpenGL. Front and Back Faces. OpenGL shading. Introduce the OpenGL shading methods. Discuss polygonal shading

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

Illumination and Shading

From Graphics to Visualization

Shading Intro. Shading & Lighting. Light and Matter. Light and Matter

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

Graphics for VEs. Ruth Aylett

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

CSE 681 Illumination and Phong Shading

Computer Graphics. Illumination and Shading

Reflection and Shading

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

CS 488. More Shading and Illumination. Luc RENAMBOT

Local Reflection Models

Three-Dimensional Graphics V. Guoying Zhao 1 / 55

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

Illumination. Illumination CMSC 435/634

Illumination and Shading

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

Illumination Models and Shading

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

Today s class. Simple shadows Shading Lighting in OpenGL. Informationsteknologi. Wednesday, November 21, 2007 Computer Graphics - Class 10 1

Illumination and Shading

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

Illumination and Shading

Illumination Models and Surface-Rendering Methods. Chapter 10

Graphics and Interaction Surface rendering and shading

Lecture outline Graphics and Interaction Surface rendering and shading. Shading techniques. Introduction. Surface rendering and shading

Pipeline Operations. CS 4620 Lecture 10

Illumination Model. The governing principles for computing the. Apply the lighting model at a set of points across the entire surface.

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

Lighting and Shading

CS3500 Computer Graphics Module: Lighting and Shading

Shading 1: basics Christian Miller CS Fall 2011

Phong Lighting & Materials. Some slides modified from: David Kabala Others from: Andries Van Damm, Brown Univ.

Shading Models. Simulate physical phenomena

TSBK 07! Computer Graphics! Ingemar Ragnemalm, ISY

CS 5625 Lec 2: Shading Models

Illumination & Shading: Part 1

Shading. Brian Curless CSE 457 Spring 2017

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

1.6 Rough Surface Scattering Applications Computer Graphic Shading and Rendering

Shading and Illumination

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

7: Rendering (1) COMP Computer Graphics and Image Processing. Local illumination model. Global illumination model. Direct Direct.

6. Illumination, Lighting

Lessons Learned from HW4. Shading. Objectives. Why we need shading. Shading. Scattering

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

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

Interactive Real-Time Raycasting

Lets assume each object has a defined colour. Hence our illumination model is looks unrealistic.

Shading Algorithms. Ron Goldman Department of Computer Science Rice University

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

Transcription:

University of Victoria CSC 305 Shading Brian Wyvill 2016

The illuminating Hemisphere Energy and Intensity Energy is the intensity integrated over the solid angle through which it acts. Intensity is not a function of distance from the light source. The energy: E I Integration over Φ = d 2 0 the hemisphere: 2π Idω Energy incident Φi on an optically smooth surface is reflected and transmitted in a coherent fashion, i.e. there are no other effects such as scattering: Φ i = Φ r + Φ t = Φ i (F r + F t ) Fresnel Equation F r + F t =1 r reflection, i incident, t transmission Φi, Φr,Φt act through same solid angle so I is proportional to energy

Incoherent ReFlection and Transmission Surfaces in practice are not optically smooth. Some of the energy is lost in incoherent reflection and transmission components. These do not necessarily act through the same solid angle so must be integrated to find intensity. Φ i = Φ r + Φ t = Φ i (F r + F t ) optically smooth surface Φi, Φr,Φt act through same solid angle so I is proportional to energy I = I d K d cosθ f(σ) roughness function for r and t Rbd and Tbd bi-direction reflection and transmission functions of the geometry describing the incoherent reflection and transmission

Empirical ModelS Gross approximations have been used to solve the intensity equation I = Ambient + Diffuse + Specular Ambient Illumination in all directions product of many multiple reflections from all surfaces. I = If I a K a Ia is the intensity assumed constant for all surfaces and Ka determines how much ambient light is reflected from an objects surface. I = I a K a 0<=I a <=1 is the incident ambient light.

Empirical ModelS Gross approximations have been used to solve the intensity equation I = Ambient + Diffuse + Specular Diffuse Lambertian reflection from matt surfaces. Brightness depends only on the angle between the light source and the surface. It can be seen that the amount of light energy depends on the area of the surfaces which in turn depends on cosɵ and the intensity of the point light source (for a simple model) I = I p K d cosθ 0<=I p <=1 is the incident light.

Empirical Models Diffuse reflection If n and L are normalized I = I p K d n L 0 Kd 1 coefficient of diffuse illumination is a constant of the surface. I p is the incident light Specular Observed on shiny surfaces. Depends on angle of viewer. Light is reflected unequally in different directions. Perfect reflector (e.g. mirror) will only reflect light in the R direction. The Phong Model assumes the specular is a maximum when α = 0 and falls off rapidly as cos n α. If R and V are normalized: I = I p K s R V 0<=I p <=1 is the incidentlight

Phong Model Effect of moving the eye vs. moving light source

Calculating Reflections Diffuse Component = Kd * Ip * N.L Specular Component = Ks * Ip * (R.V) n L = vn + vs R = vn - vs R+L = 2vn vn has magnitude L.N and direction n vn = (N.L)N R = 2vn - L = 2 (N.L)N - L

Calculating Reflections If the light source is at infinity then N.L is constant over a flat surface. If the viewer is at infinity then R.V is constant over a flat surface. Maximum highlights are in the direction of the halfway vector, H when it is aligned with N. Where H=(L+V)/ L+V the specular term can be expressed as (N.H) n. When light source and viewer are at infinity H is constant. The model is empirical and different results are produced using (N.H) n and (R.V) n since α β Spec Component = Ks * Ip * (N.H) n Spec Component = Ks * Ip * (R.V) n

Specular Power The model is empirical and not physically based. The results of cos(ɵ) n look convincing but the function cos(ɵ) n = cos(ɵ)/(n-n*cos(ɵ)+cos(ɵ)) are quite similar and less expensive to compute

Light Source Attenuation As noted it is energy that decrease as an inverse square with distance, not intensity. Empirical models again used to simulate light source at a finite distance for diffuse lighting I = Kd * fatt Ip * n.l Various functions have been tried including 1/d 2,. The problem is that a square law makes the light attenuate too much for close light sources and not enough for distance light sources. fatt = min(1/(c1+c2d+c3d 2 ), 1) clamp at 1 to make sure it always attenuates an keep c1 to keep the denomiator from becoming too small. (according to F&VD)

ColoUr This subject is complex due to the non-linear nature of the eyes response to color. A simple approach is to use red, green and blue components separately, which means that material constants for each color component reflection are required: e.g. the diffuse color is represented by three values CdR, CdG, CdB, similarly for the ambient an specular components. Writing I for the color we have: I λ = I aλ C aλ K a + f att I pλ [C dλ K d (N L)+ C sλ K s (R V) n ])

Implementation of C a, C p, C s small specular power no reflection white specular large specular power no reflection white specular large specular power low reflection white specular large specular power low reflection yellow specular large specular power high reflection yellow specular surface ebrass surface dbrass surface cbrass surface cbrass surface cbrass amb. 0.17 0.10 0.01 diff 0.45 0.29 0.04 spec 0.1 0.1 0.1 amb. 0.17 0.10 0.01 diff 0.45 0.29 0.04 spec 0.3 0.3 0.3 amb 0.17 0.10 0.01 diff 0.45 0.29 0.04 spec 0.9 0.9 0.9 amb 0.17 0.10 0.01 diff 0.45 0.29 0.04 spec 0.9 0.9 0.2 amb 0.17 0.10 0.01 diff 0.45 0.29 0.04 spec 0.9 0.9 0.2 specpow 2 reflect 0 specpow 10 reflect 0 specpow 35 reflect 0.1 specpow 35 reflect 0.1 specpow 35 reflect 0.4

Multiple Light Sources If there are m light sources the terms for each source are summed: I λ = I aλ C aλ K a + f att I pλ [C dλ K d (N L)+ C sλ K s (R V) n ]) This usually introduces a new problem that Iλ can exceed the maximum pixel value. Usually Iλ is normalized to 0 Iλ 1. One approach each Iλi could be clamped at 1/m An alternative to consider all the Iλ values for a pixel. I there is one that is too large and divide by the largest. This maintains hue and saturation at the expense of the value. Techniques such as this are fine for a single frame but present real problems in animation. Setting all the sources at the start of a sequence is similar to the problem of lighting a real scene that to be filmed.

Lighting Effects Highlights View dependent concentrations of light on a surface caused by non-diffuse reflectors Color Bleeding Diffuse reflection of light of on colored surface affecting the appearance of another surface Caustics View independent concentrations of light on a surface caused by non-diffuse reflectors Need multi-pass (hybrid) algorithms: Radiosity + Ray Tracing

Radiosity (courtesy Cornell University) This sculpture can be used to illustrate why modeling direct light reflections alone cannot replicate all nature light effects for computer graphics imagery A diagram drawn looking down on the sculpture shows that the colored surfaces face away from the viewer (who looks from the bottom of the diagram), but are bathed in light from a strong light source (at the top of the diagram). Only white surfaces face the viewer. A ray-traced version of the image shows only the light reaching the viewer by direct reflection - hence misses the color effects

Radiosity (courtesy Cornell University) This image, incorporating radiosity techniques for image generation, correctly models light reflections from diffuse surfaces, and captures the strong color effects that the sculptor intended. Ray Traced Version

Polygon Mesh Shading Mach Bands Mach bands refers to the exaggeration of the intensity change at any edge. At the border between two facets the lighter facet appears even lighter and the darker appears even darker. This is due to lateral inhibition of the human light receptors. The more light a receptor receives the more it inhibits the response of the adjacent receptors.

Gouraud Shading (intensity interpolation) Intensity interpolation along each scan line and along polygon edges I a = I 1 (I 1 I 2 )(Y 1 Y s ) / (Y 1 Y 2 ) I b = I 1 (I 1 I 3 )(Y 1 Y s ) / (Y 1 Y 3 ) I p = I b (I b I a )(X b X p ) / (X b X a ) Averaged Normal Nv is Ni/ Ni

Phong Shading (normal vector interpolation) Normal vector interpolation along each scan line and along polygon edges N a = N 1 (N 1 N 2 )(Y 1 Y s ) / (Y 1 Y 2 ) N b = N 1 (N 1 N 3 )(Y 1 Y s ) / (Y 1 Y 3 ) N p = N b (N b N a )(X b X p ) / (X b X a ) The normal vectors have been adjusted to give a highlight at tp0 but not at the other vertices. In the Gouraud interpolation scheme the highlight is lost, averaged out with the other vertex intensities. The Phong interpolation finds the correct highlight

More on Phong Shading Note that normal vectors should be normalized (normally) and more accurate normal vectors is better than more polygons. Phong Normal Vector Interpolation 792 polygons Normal Vectors Calculated directly from Implicit Surface 792 polygons Phong Normal Vector Interpolation 344 polygons Normal Vectors Calculated directly from Implicit Surface 344 polygons

PRoblems with Interpolation Methods Expensive since illumination calculation is repeated for every pixel. Also calculating and normalizing new normal. (Schlick equation and table look up methods). Shiluette edge Attempts have been made to modify normals to match a curve fitted to the edge (see Van Overveld and Wyvill) Perspective distortion Intensity interpolation is performed in screen space. The z has undergone a non-linear transformation

Problems with Interpolation Methods Orientation Dependence The results of an interpolation model are not independent of the projected polygon orientation. Results may differ when the polygon is rotated affecting animations. Problems at shared Vertices This problem is analaogous to the cracks problem in subdivided meshes. The undivided edge is interpolated differently to the two divided edges. Unrepresentative Vertex Normals Pathalogical cases where interpolated normals give poor results. Examples are staircase example and mobius strip.

Reducing the Expense of Phong Shading Expensive since illumination calculation is repeated for every pixel. Also calculating and normalizing new normal. If both viewer and light source at large distance then H is constant. To calculate highlights need angle between N and H. if this varies over the surface, then convincing highlights will be calculated Keep H constant and vary N.