Comp 410/510 Computer Graphics. Spring Shading

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

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

Illumination & Shading

Shading I Computer Graphics I, Fall 2008

Introduction to Computer Graphics 7. Shading

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

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

Three-Dimensional Graphics V. Guoying Zhao 1 / 55

Why we need shading?

Objectives. Continue discussion of shading Introduce modified Phong model Consider computation of required vectors

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

Lecture 15: Shading-I. CITS3003 Graphics & Animation

Objectives. Shading II. Distance Terms. The Phong Reflection Model

Shading II. Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico

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

Shading II. CITS3003 Graphics & Animation

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

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)

CS 4600 Fall Utah School of Computing

CS452/552; EE465/505. Intro to Lighting

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

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

Illumination in Computer Graphics

Virtual Reality for Human Computer Interaction

Lighting. Figure 10.1

Lighting and Shading II. Angel and Shreiner: Interactive Computer Graphics 7E Addison-Wesley 2015

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

Lighting and Shading. Slides: Tamar Shinar, Victor Zordon

Illumination Models & Shading

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

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

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

Introduction to Computer Graphics with WebGL

CS452/552; EE465/505. Lighting & Shading

w Foley, Section16.1 Reading

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

CSE 681 Illumination and Phong Shading

Simple Lighting/Illumination Models

ECS 175 COMPUTER GRAPHICS. Ken Joy.! Winter 2014

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

Reflection and Shading

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

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

CS5620 Intro to Computer Graphics

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

CS Illumination and Shading. Slide 1

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

Graphics and Visualization

Illumination & Shading I

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

Illumination & Shading: Part 1

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

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

CMSC427 Shading Intro. Credit: slides from Dr. Zwicker

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

Graphics for VEs. Ruth Aylett

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

CENG 477 Introduction to Computer Graphics. Ray Tracing: Shading

Shading. Brian Curless CSE 557 Autumn 2017

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

Illumination and Shading

Color and Light CSCI 4229/5229 Computer Graphics Fall 2016

CHAPTER5. We have learned to build three-dimensional graphical models and to LIGHTING AND SHADING

Computer Graphics. Illumination and Shading

Graphics for VEs. Ruth Aylett

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

CS Computer Graphics: Illumination and Shading I

CS Computer Graphics: Illumination and Shading I

Raytracing. COSC 4328/5327 Scott A. King

Shading. Brian Curless CSE 457 Spring 2017

University of Victoria CSC 305 Shading. Brian Wyvill 2016

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

Supplement to Lecture 16

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

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

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

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

Illumination and Shading

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

Turn on the Lights: Reflectance

CPSC 314 LIGHTING AND SHADING

Local Reflection Models

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

Display Issues Week 5

CS 5625 Lec 2: Shading Models

Lecture 17: Shading in OpenGL. CITS3003 Graphics & Animation

TSBK 07! Computer Graphics! Ingemar Ragnemalm, ISY

CEng 477 Introduction to Computer Graphics Fall

Virtual Reality for Human Computer Interaction

Global Rendering. Ingela Nyström 1. Effects needed for realism. The Rendering Equation. Local vs global rendering. Light-material interaction

Computer Graphics. Illumination and Shading

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

Sung-Eui Yoon ( 윤성의 )

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

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

OpenGL Lighting Computer Graphics Spring Frank Palermo

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

Transcription:

Comp 410/510 Computer Graphics Spring 2017 Shading

Why we need shading Suppose we build a model of a sphere using many polygons and then color it using a fixed color. We get something like But we rather want

Shading Why does the image of a real sphere look like? Light-material interactions cause each point to have a different color or shade. Need to consider Light sources Material properties Location of viewer Surface orientation

Shading

Light-Material Interaction Light that strikes an object is partially absorbed and partially scattered (reflected) The amount reflected determines the color and brightness of the object A surface appears red under white light because the red component of the light is reflected and the rest is absorbed The reflected light is scattered in a manner that depends on the smoothness and orientation of the surface

Scattering Light strikes A Some scattered Some absorbed Some of scattered light strikes B Some scattered Some absorbed Some of this scattered light strikes again A and so on

Global Effects shadow multiple reflection translucent surface (refraction)

Rendering Equation The infinite scattering and absorption of light can be described by the rendering equation (see Chapter 11.4 from textbook) Rendering equation is global and includes Shadows Multiple scattering from object to object Refractions Too complex for a practical solution Ray tracing is a special case for perfectly reflecting surfaces, and radiosity technique for perfectly diffuse surfaces.

Local vs Global Rendering Correct shading requires a global calculation involving all objects and light sources (rendering equation) Incompatible with pipeline model which shades each polygon independently (local rendering) However, in computer graphics, especially real time graphics, we are content if things look right There exist many techniques for approximating global effects

Local illumination So we need a local illumination model that will work with the pipeline approach: Need to consider Light sources Material properties Location of viewer Surface orientation

Light Sources General light sources are difficult to work with because we must integrate light coming from all points on the source

Simple Light Sources Point source Model with position and color Distant source = infinite distance away (parallel) Spotlight Restrict light from ideal point source Ambient light Same amount of light everywhere in the scene Can model contribution of many sources and scattering

Surface Types The smoother a surface, the more reflected light is concentrated in the direction that a perfect mirror would reflect the light A very rough surface scatters light in all directions smooth surface rough surface

Two extremes Perfectly diffuse (Lambertian) surfaces Light scattered equally in all directions Amount of light reflected is proportional to the vertical component of incoming light Perfectly specular surfaces Ideal reflectors (mirror-like) Angle of incidence = Angle of reflection perfectly diffuse perfectly specular

Real Surfaces Most surfaces are neither ideal diffusers nor perfectly specular (ideal reflectors) Smooth surfaces show specular highlights due to incoming light being reflected in directions concentrated close to the direction of a perfect reflection specular highlight

Phong Model A simple model that can be computed rapidly Has three components Diffuse Specular Ambient Uses four vectors To source To viewer Normal Perfect reflector

Perfectly Diffuse Surfaces Perfectly diffuse reflectors Light scattered equally in all directions Amount of light reflected is proportional to the vertical component of incoming light reflected light ~ cosθ i - cosθ i = l n if vectors are normalized There are also three coefficients, k rd, k bd, k gd,that show how much of each color component is reflected I d = k d L d l n (0 k d 1)

Perfectly Specular Surfaces Ideal reflectors Normal vector is determined by local orientation Angle of incidence = Angle of reflection The three vectors must be coplanar: r = 2 (l n ) n l (see page 275 from textbook for derivation)

Modeling Specular Reflections Phong proposed using a term that drops off as the angle between the viewer and the ideal reflection increases I s = k s L s cos α φ reflected intensity shininess coef incoming intensity reflection coef φ

The Shininess Coefficient Values of α between 100 and 200 correspond to metals Values between 5 and 10 give surfaces that look like plastic cos α φ -90 φ 90

Ambient Light Ambient light is the result of multiple interactions between light sources and the objects in the environment. Amount and color depend on both color of the light(s) and material properties of the object. Add k a L a to diffuse and specular terms. reflection coef intensity of ambient light

Distance Terms The light from a point source that reaches a surface is inversely proportional to the square of the distance between them. We can add a factor of the form 1/(a + bd +cd 2 ) to the diffuse and specular terms. The constant and linear terms soften the effect of the point source.

Light Sources In the Phong Model, we add the results from each light source. Each light source has separate diffuse, specular, and ambient terms to allow for maximum flexibility, even though this form does not have a physical justification. Separate red, green and blue components. Hence, 9 coefficients for each point light source - L dr, L dg, L db, L sr, L sg, L sb, L ar, L ag, L ab

Material Properties Material properties match light source properties Nine reflection coefficients k dr, k dg, k db, k sr, k sg, k sb, k ar, k ag, k ab Shininess coefficient α

Adding up the Components For each light source and each color component, the Phong model can then be written as I = 1 a + bd + cd 2 ( k d L d l n + k s L s (v r ) α )+ k a L a For each color component we add contributions from all sources.

Computation of Vectors l and v are specified by the application Can compute r from l and n But how to compute n? OpenGL leaves computation of n to application All vectors to be unit length r = 2(l n)n l 2 6

Computation of Normal for Triangles n Plane equation: n (p p 0 ) = 0 Normal: n = (p 1 p 0 ) (p 2 p 0 ) Normalize by n n / n p 2 p p 1 p 0 Note that right-hand rule determines outward face

Modified Phong Model The specular term in the Phong model is problematic because it requires for each vertex the calculation of a new reflection vector r (as well as a view vector v) Blinn suggested an approximation using the halfway vector that is more efficient

The Halfway Vector h is normalized vector halfway between l and v h = (l + v) / l + v

Using the halfway vector Replace (v r ) α by (n h ) β β is chosen to match shineness Note that halfway angle is half of angle between r and v if vectors are coplanar Resulting model is known as the modified Phong or Blinn lighting model

Differences in these teapots are only due to the parameters in the modified Phong model Example