Lecture 15: Shading-I. CITS3003 Graphics & Animation

Similar documents
Shading I Computer Graphics I, Fall 2008

Comp 410/510 Computer Graphics. Spring Shading

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

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

Illumination & Shading

Introduction to Computer Graphics 7. Shading

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

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

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

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

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

Lighting and Shading. Slides: Tamar Shinar, Victor Zordon

CS452/552; EE465/505. Intro to Lighting

Virtual Reality for Human Computer Interaction

Lighting. Figure 10.1

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

Why we need shading?

Three-Dimensional Graphics V. Guoying Zhao 1 / 55

CS 4600 Fall Utah School of Computing

Shading II. CITS3003 Graphics & Animation

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

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

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

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

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

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

Lecture 17: Shading in OpenGL. 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

CS5620 Intro to Computer Graphics

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

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

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

Computer Graphics. Illumination and Shading

Illumination Models & Shading

Shading. Brian Curless CSE 557 Autumn 2017

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

w Foley, Section16.1 Reading

Supplement to Lecture 16

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

CPSC / Illumination and Shading

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

Illumination in Computer Graphics

Visualisatie BMT. Rendering. Arjan Kok

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

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

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

Illumination & Shading: Part 1

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

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

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

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

Computer Graphics. Illumination and Shading

CENG 477 Introduction to Computer Graphics. Ray Tracing: Shading

Shading. Shading = find color values at pixels of screen (when rendering a virtual 3D scene).

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

ECS 175 COMPUTER GRAPHICS. Ken Joy.! Winter 2014

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

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

CMSC427 Shading Intro. Credit: slides from Dr. Zwicker

Shading. Brian Curless CSE 457 Spring 2017

CSE 681 Illumination and Phong Shading

Reflection and Shading

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

CPSC 314 LIGHTING AND SHADING

Assignment #2. (Due date: 11/6/2012)

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

Illumination and Shading

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

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

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

CS452/552; EE465/505. Lighting & Shading

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

Shading 1: basics Christian Miller CS Fall 2011

Turn on the Lights: Reflectance

Simple Lighting/Illumination Models

Color and Light CSCI 4229/5229 Computer Graphics Fall 2016

CEng 477 Introduction to Computer Graphics Fall

Introduction to Computer Graphics with WebGL

Interactive Real-Time Raycasting

Raytracing CS148 AS3. Due :59pm PDT

Illumination & Shading I

Illumination and Shading

TSBK 07! Computer Graphics! Ingemar Ragnemalm, ISY

Local Reflection Models

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

OpenGL Lighting Computer Graphics Spring Frank Palermo

Illumination and Shading

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

Raytracing. COSC 4328/5327 Scott A. King

CS6670: Computer Vision

6. Illumination, Lighting

Illumination. Michael Kazhdan ( /657) HB Ch. 14.1, 14.2 FvDFH 16.1, 16.2

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

University of Victoria CSC 305 Shading. Brian Wyvill 2016

CS6670: Computer Vision

Illumination Models and Shading

Lighting and Shading

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

Graphics and Visualization

Transcription:

Lecture 15: Shading-I CITS3003 Graphics & Animation E. Angel and D. Shreiner: Interactive Computer Graphics 6E Addison-Wesley 2012

Objectives Learn that with appropriate shading so objects appear as threedimensional in the rendered image. Introduce the types of light-material interactions global vs local. Understand some light sources and how to represent them. Introduce the Phong shading model that can be used with real time graphics hardware. Understand different surface types. 2

3D Perception How do we perceive objects as 3D? Stereo vision is one reason but we can still perceive 3D even we look with one eye. Hidden surface removal gives us depth perception. Shading is another way how we perceive 3D objects. 3

What is Shading? Light reflection from 3D objects is a function of material properties (colour) as well as the shape of the object. We will study how objects and light interacts that results in a shaded image of the object We will then study how shading is achieved in a graphics pipeline in a way that is - Efficient - Suits the pipeline architecture 4

Why we need shading? Suppose we build a model of a sphere using many polygons and color it with glcolor. We get something like But we want 5

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 6

Scattering Light strikes object A - Some scattered. - Some absorbed. Some of scattered light strikes object B - Some scattered. - Some absorbed. Some of this scattered light strikes A and so on. 7

Rendering Equation The infinite scattering and absorption of light can be described by the rendering equation - Which cannot be solved in general - Ray tracing is a special case for perfectly reflecting surfaces Rendering equation is global and includes - Shadows - Multiple scatterings from object to object 8

Global Effects shadow translucent surface multiple reflection 9

Local vs Global Rendering Correct shading requires a global calculation involving all objects and light sources - This is incompatible with pipeline architecture which shades each polygon independently (i.e., local rendering) In computer graphics, especially real time graphics, we are happy if things look right - There exist many techniques for approximating global effects 10

Light-Material Interaction Light that strikes an object is partially absorbed and partially scattered (reflected) The amount reflected determines the colour 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 11

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

Finite Light Source & Shadows Real light sources have a finite size Parts that do not see the light source at all will be the darkest (inner shadow circle) Parts that see the full light sources will be the brightest (outside the two circles) Parts that see the light source partially will have brightness values in between the two extremes depending on how much of the light source is visible (outer circle excluding the inner circle) umbra penumbra

Simple Light Sources A point source - Is the simplest light source. - Is modelled with a position p 0 = (x, y, z, 1) T and an illumination intensity I = I r, I g, I b. - Illuminates equally in all directions. A distance term can be incorporated to attenuate I. A spotlight - Is modelled with a cone whose apex is at p 0, a direction l s, the cone angle θ, and a intensity I = I r, I g, I b. - Is a point source whose emitted light is restricted to a narrow range of angles. - If θ = 180, the spotlight becomes a point source. A distance term can be incorporated to attenuate I. A point source illuminating a surface. 14

Light Attenuation with Distance For point light sources, light intensity decreases with the square of the distance i.e. multiply the intensity by 1 d2 (where d is the distance from light source) Point sources are easy to model but they result in harsh (unrealistic) rendering with very sharp drop in brightness and crisp shadows. Hence, the light attenuation is generally modelled by a quadratic 1 term 2 (where a, b, c are user defined parameters) a+bd+cd

Simple Light Sources (cont.) A directional light source - Is also known as a distance light source. - Illuminates objects with parallel rays of light. - Is modelled with a direction d = (x, y, z, 0) T and a and intensity I = I r, I g, I b. A distance light source Ambient light - Models the same amount of light everywhere in the scene. The ambient illumination I a = I r, I g, I b is therefore characterized by an intensity that is identical at every point in the scene. - Can also be used to model the integration of multiple sources on a reflecting surface in the scene. 16

The Phong Reflection Model The Phong Model: Is a simple model that can be computed rapidly Has three terms - Diffuse term - Specular term - Ambient term Uses the four vectors below to calculate a colour for an arbitrary point p on a surface: - Vector l (to light source) - Vector v (to viewer or camera) - Vector n (Normal vector at p) - Vector r (Perfect reflector of l with respect to n) 17

Surface Types For smooth surfaces, the reflected light concentrates more in the direction that is a perfect mirror reflection of the incident light. For rough surfaces, the reflected light scatters in all directions smooth surface rough surface 18

Lambertian Surface Perfectly diffuse reflector Light scattered equally in all directions Amount of light reflected is proportional to the vertical component of incoming light - i.e., reflected light ~cos θ i - where cos θ i = l n when vectors l and n are normalized to unit vectors. - There are also three coefficients, k r, k g, k b that show how much of each color component is reflected (these coefficients are specific to the surface, i.e., different types of surfaces have different values). 19

Specular Surfaces Whereas a diffuse surface is rough, a specular surface is smooth. Smooth surfaces show specular highlights due to incoming light being reflected in directions concentrated close to the direction of a perfect reflection. Specular highlight shows colour of the light source (rather than of the object) 20

Modeling Specular Relections Phong proposed using a term cos α φ that drops off as the angle between the viewer and the ideal reflection increased Each of these terms has a red, green, and blue component. This formula repeats 3 times, one for each component. ~ means proportional to. I ref ~ k s I cos α φ reflected Intensity specular reflectivity coefficient of surface shininess coefficient of material incoming intensity f 21

The Shininess Coefficient α Values between 100 and 200 correspond to metals. Values between 5 and 10 give surfaces that look like plastic. The cos α φ function with φ varying from -90 to 90 degrees for different α values. -90 0 90 φ 22

Ambient Light Ambient light is the result of multiple interactions between (large) light sources and the objects in the environment Amount and color depend on both the colour of the light(s) and the material properties of the object Add k a I a to diffuse and specular terms reflection coef of surface (the subscript a is short for ambient ) intensity of ambient light 23

Further Reading Interactive Computer Graphics A Top-Down Approach with Shader-Based OpenGL by Edward Angel and Dave Shreiner, 6 th Ed, 2012 Sec. 5.1. Light and Matter Sec. 5.2. Light Sources Sec. 5.3. The Phong Reflection Model 24