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

Similar documents
Lighting and Shading. Slides: Tamar Shinar, Victor Zordon

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

Shading I Computer Graphics I, Fall 2008

Lighting. Figure 10.1

Lecture 15: Shading-I. CITS3003 Graphics & Animation

Comp 410/510 Computer Graphics. Spring Shading

Illumination & Shading

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

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

Virtual Reality for Human Computer Interaction

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: Lecture #7: Color and Shading. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2011

Introduction to Computer Graphics 7. Shading

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

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

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

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

CSE 681 Illumination and Phong Shading

CMSC427 Shading Intro. Credit: slides from Dr. Zwicker

ECS 175 COMPUTER GRAPHICS. Ken Joy.! Winter 2014

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

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

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

CS452/552; EE465/505. Intro to Lighting

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

Illumination Models & Shading

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

Why we need shading?

w Foley, Section16.1 Reading

Shading. Brian Curless CSE 557 Autumn 2017

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

CS5620 Intro to Computer Graphics

Illumination in Computer Graphics

CS 4600 Fall Utah School of Computing

CS 5625 Lec 2: Shading Models

Color and Light CSCI 4229/5229 Computer Graphics Fall 2016

Computer Graphics. Illumination and Shading

Visualisatie BMT. Rendering. Arjan Kok

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

Illumination & Shading: Part 1

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

Module 5: Video Modeling Lecture 28: Illumination model. The Lecture Contains: Diffuse and Specular Reflection. Objectives_template

Raytracing CS148 AS3. Due :59pm PDT

Raytracing. COSC 4328/5327 Scott A. King

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

Interactive Real-Time Raycasting

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

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

Lighting affects appearance

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

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

TSBK 07! Computer Graphics! Ingemar Ragnemalm, ISY

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

Turn on the Lights: Reflectance

Sung-Eui Yoon ( 윤성의 )

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

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

Illumination and Shading

Simple Lighting/Illumination Models

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

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

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

Lighting affects appearance

Reflection and Shading

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

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

CPSC 314 LIGHTING AND SHADING

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

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

CPSC / Illumination and Shading

CENG 477 Introduction to Computer Graphics. Ray Tracing: Shading

Computer Graphics. Illumination and Shading

Shading 1: basics Christian Miller CS Fall 2011

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

CS 325 Computer Graphics

Supplement to Lecture 16

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

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

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

Complex Shading Algorithms

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

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

OpenGL Lighting Computer Graphics Spring Frank Palermo

Introduction to Visualization and Computer Graphics

03 RENDERING PART TWO

Lighting Models. CS116B Chris Pollett Mar 21, 2004.

CEng 477 Introduction to Computer Graphics Fall

Lighting and Shading

Shading. Brian Curless CSE 457 Spring 2017

Lights and Lighting. Lecture overview. Light 2/3/2013. Digital Lighting and Rendering CGT 340

Shading II. CITS3003 Graphics & Animation

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

CS 488. More Shading and Illumination. Luc RENAMBOT

Lighting. To do. Course Outline. This Lecture. Continue to work on ray programming assignment Start thinking about final project

Light Transport Baoquan Chen 2017

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

A Little Background. Motivation. Motivation

Transcription:

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

Why we need shading Suppose we build a model of a sphere using many polygons and color each the same color. We get something like But we want 2 The more realistically lit sphere has gradations in its color that give us a sense of its three-dimensionality

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 (normal) 3 We are going to develop a local lighting model by which we can shade a point independently of the other surfaces in the scene our goal is to add this to a fast graphics pipeline architecture

General rendering The most general approach is based on physics - using principles such as conservation of energy a surface either emits light (e.g., light bulb) or reflects light for other illumination sources, or both [Angel and Shreiner] light interaction with materials is recursive the rendering equation is an integral equation describing the limit of this recursive process http://en.wikipedia.org/wiki/rendering_equation

Fast local shading models the rendering equation can t be solved analytically numerical methods aren t fast enough for real-time for our fast graphics rendering pipeline, we ll use a local model where shade at a point is independent of other surfaces use Phong reflection model shading based on local light-material interactions some approximations to the rendering equation include radiosity and ray tracing, but they are still not as fast as the local model in the pipeline architecture

Local shading model direct light [Angel and Shreiner] reflected light direct light is the color of the light source reflected light is the color of the light reflected from the object surface for rendering, color of light source and reflected light determines the colors of pixels in the frame buffer only need to consider the rays that leave the source and reach the viewer s eye

Global Effects shadow [Angel and Shreiner] translucent surface multiple reflection 7

Light-material interactions at a surface, light is absorbed, reflected, or transmitted specular diffuse translucent [Angel and Shreiner] specular: shiny, smooth surface. light scattered in narrow range close to angle of reflection e.g., mirror is perfectly specular diffuse: matte, rough surface. light scattered in all directions translucent: allows some light to pass through object. refraction: e.g., glass or water

General light source Illumination function: [Angel and Shreiner] integrate contributions from all sources to shade the point \vec{x} = (x,y,z) \vec{omega} = theta, phi

Idealized light sources Ambient light Point light Spotlight distant (directional) light [Angel and Shreiner] luminance: source will be described through three component intensity or luminance decompose into red, green, blue channels e.g., use the red component of source to calculate red component of image use a single scalar equations - each equation applied independently to each channel

Ambient light source achieve a uniform light level no black shadows ambient light intensity at each point in the scene use scalar I_a to denote any component of \vec{i}_a ambient light is the same everywhere but different surfaces will reflect it differently

Point light source illumination intensity at p: [Angel and Shreiner] - use scalar I(\vec{p}_0) to denote any of three components - points sources alone aren t too realistic looking -- tend to be high contrast - most real-world scenes have large light sources - add ambient light to mitigate high contrast

Point light source Most real-world scenes have large light sources Point light sources alone aren t too realistic - add ambient light to mitigate high contrast [Angel and Shreiner] penumbra umbra - umbra is fully in shadow, penumbra is partially in shadow

Point light source Most real-world scenes have large light sources Point light sources alone aren t too realistic - drop off intensity more slowly [Angel and Shreiner] In practice, we also replace the 1/d^2 term by something that falls off more slowly

Spotlights [Angel and Shreiner]

Spotlights [Angel and Shreiner] add an exponent for greater control final result is like point light but modified by this cone

Distant light source characterized by direction [Angel and Shreiner] most shading calculations require direction from the surface point to the light source position if the light source is very far, the direction vectors don t change e.g., sun characterized by direction rather than position

Lambertian Reflection Model http://www.andreafisherpottery.com/cgi-bin/artistlnk.cgi?jody_folwell The Lambertian reflection model is good for diffuse surfaces (those with a rough surface). The bottom part of the vase could be rendered with the Lambertian reflection model, since it is matte in appearance. The top part of the vase is reflective and has specular highlights.

Lambertian Reflection Model Lambert s cosine law direct: maximum light intensity indirect: reduced light intensity color intensity Lambert s cosine law says that the col or intensity should be proportional to the cosine of the angle between l and n. The light with length d has a certain amount of light energy associated with it. If the light is tilted relative to the surface, the same amount of light energy shines on more surface area. Therefore, the intensity of the light is less per unit surface area.

Lambertian Reflection Model Lambert s cosine law direct: maximum light intensity indirect: reduced light intensity color intensity cos theta = n. l

Lambertian Reflection Model Lambert s cosine law direct: maximum light intensity indirect: reduced light intensity color intensity reflectance the color intensity is also going to be proportional to the reflectance of the object in that color channel

Lambertian Reflection Model Lambert s cosine law illumination direct: maximum light intensity indirect: reduced light intensity color intensity reflectance and it will be proportional to the light intensity

Lambertian Reflection Model the cosine is negative if the angle is more than 90 degrees. In this case, the face points away from the light. If we don t modify the formula we ll get a negative intensity. We can put in the max to ensure that if the face points away, it won t be lit by the light.

Lambertian Reflection Model two-sided lighting An alternative is to take the absolute value. This is equivalent to having another light on the other side of the object exactly opposite the first.

Ambient Reflection Surfaces facing away from the light will be totally black Problem: surfaces facing away from the light will be totally black.

Ambient Reflection All surfaces get same amount of ambient light Problem: surfaces facing away from the light will be totally black - ambient light mitigates this by adding some light everywhere

Phong Reflection Model http://www.andreafisherpottery.com/cgi-bin/artistlnk.cgi?jody_folwell The Phong reflection model combines the Ambient and Lambertian reflections with a specular reflection to capture highlights such as the white highlight seen on the shiny part of the vase The highlight is a reflection of the light and it is the color of the light.

Phong Reflection Model [Brad Smith, Wikimedia Commons] efficient, reasonably realistic 3 components 4 vectors - l to light source - n surface normal - v to viewer - r perfect reflector (function of n and l)

Phong Reflection Model [Brad Smith, Wikimedia Commons] color intensity reflectance illumination This formula will be applied for each of the three color channels independently.

Ambient reflection different ambient coefficients for different colors ambient reflection coefficient e.g., white light shining on the object will be reflected differently in red, green, blue channels e.g., more red and blue reflection here

Diffuse reflection e.g., paper, unfinished wood, unpolished stone The diffuse component of the Phong reflectance model is the same as the Lambertian reflectance model

Diffuse reflection Lambert s cosine law diffuse reflection coefficient direct: maximum light intensity indirect: reduced light intensity - the light is reduced by cos of angle - this is because same amount of light is spread over larger area when light comes in at an angle

Specular reflection Ideal reflector angle of incidence angle of reflection r is the mirror reflection direction The new thing in the Phong reflection model is the specular component

Specular reflection Specular surface specular highlight specular reflection is strongest in mirror reflection direction area of specular highlight depends on how smooth the surface is

Specular reflection specular reflection coefficient Phong exponent specular reflection drops off with increasing angle Phong proposed this model

Specular reflection plastic metal Phong exponent Phong proposed this model clamp to 0 -- avoid negative values the fuzzy highlight was too big without an exponent

Phong Reflection Model [Brad Smith, Wikimedia Commons] Ambient Diffuse Specular

Alternative: Blinn-Phong Model h [Brad Smith, Wikimedia Commons] halfway vector Ambient Diffuse Specular replace v.r with h.n this way we don t have to recompute r, which depends on n h does not depend on n saves a lot especially for directional lights and constant viewing direction

10: eggshell 100: shiny 1000: glossy 10000: mirror-like