ECS 175 COMPUTER GRAPHICS. Ken Joy.! Winter 2014

Similar documents
Illumination Models & Shading

CS5620 Intro to Computer Graphics

Virtual Reality for Human Computer Interaction

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

Comp 410/510 Computer Graphics. Spring Shading

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

Illumination and Shading

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

Introduction to Computer Graphics 7. Shading

Illumination & Shading: Part 1

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

Shading I Computer Graphics I, Fall 2008

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

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

Three-Dimensional Graphics V. Guoying Zhao 1 / 55

Lighting and Shading. Slides: Tamar Shinar, Victor Zordon

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

Shading 1: basics Christian Miller CS Fall 2011

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

w Foley, Section16.1 Reading

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

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

Illumination and Shading

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

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

Color and Light CSCI 4229/5229 Computer Graphics Fall 2016

Computer Graphics. Illumination and 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.

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

Computer Graphics. Illumination and Shading

Reflection and Shading

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

Illumination & Shading

Lighting. Figure 10.1

Pipeline Operations. CS 4620 Lecture 10

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

CPSC 314 LIGHTING AND SHADING

Pipeline Operations. CS 4620 Lecture 14

CPSC / Illumination and Shading

Why we need shading?

Lecture 17: Shading in OpenGL. CITS3003 Graphics & Animation

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

Introduction to Visualization and Computer Graphics

CS452/552; EE465/505. Intro to Lighting

The Rasterization Pipeline

CSE 681 Illumination and Phong Shading

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

Objectives. Introduce the OpenGL shading Methods 1) Light and material functions on MV.js 2) per vertex vs per fragment shading 3) Where to carry out

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

TSBK 07! Computer Graphics! Ingemar Ragnemalm, ISY

CS 4600 Fall Utah School of Computing

Lecture 15: Shading-I. CITS3003 Graphics & Animation

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

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

Visualisatie BMT. Rendering. Arjan Kok

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

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

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

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

Illumination & Shading I

CEng 477 Introduction to Computer Graphics Fall

Sung-Eui Yoon ( 윤성의 )

Simple Lighting/Illumination Models

Shading. Brian Curless CSE 457 Spring 2017

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

Light Sources. Spotlight model

CS 418: Interactive Computer Graphics. Basic Shading in WebGL. Eric Shaffer

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

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

Ambient reflection. Jacobs University Visualization and Computer Graphics Lab : Graphics and Visualization 407

Lighting and Materials

CMSC427 Shading Intro. Credit: slides from Dr. Zwicker

Virtual Reality for Human Computer Interaction

CS Illumination and Shading. Slide 1

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

Interpolation using scanline algorithm

Shading. Brian Curless CSE 557 Autumn 2017

Shading and Illumination

Illumination in Computer Graphics

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

Deferred Rendering Due: Wednesday November 15 at 10pm

Computer Graphics MTAT Raimond Tunnel

Complex Shading Algorithms

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

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

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

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

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

CSE 167: Lecture #8: GLSL. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2012

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

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

OpenGL Lighting Computer Graphics Spring Frank Palermo

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

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

9. Illumination and Shading

Shading. Brian Curless CSE 457 Spring 2015

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

Shading. CSE 457 Winter 2015

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

Transcription:

ECS 175 COMPUTER GRAPHICS Ken Joy Winter 2014

Shading To be able to model shading, we simplify Uniform Media no scattering of light Opaque Objects No Interreflection Point Light Sources RGB Color (eliminating wavelength) ECS 175 2

Shading And we get ECS 175 3

Shading And we get ECS 175 4

Shading And we get ECS 175 5

Shading And we get ECS 175 6

Shading And we get ECS 175 7

Shading And we get ECS 175 8

Adding Light to the Scene 3D objects look flat if all of their sides are colored the same. In reality, we see shades of colors on 3D objects, even if they consist of a single homogeneous material. The reason for this is lighting. In graphics, algorithms that compute shades of color based on lighting are often referred to as object shading techniques. 9

Local and Global Lighting Local lighting techniques compute shades based on Local surface geometry (normal, etc.) Material properties (reflectance, color, etc ) Light properties (position, color, etc ) Optional: Viewing direction or position Global lighting techniques additionally take other objects/ surfaces of the scene into consideration 10

Local and Global Lighting Local lighting only Approximation of global lighting (here: ambient occlusion) Better: Raytracing Radiosity 11

Local and Global Lighting Local lighting only Approximation of global lighting (here: ambient occlusion) Later in the quarter: Raytracing Radiosity 12

Local Lighting We focus on local lighting Implemented in fixed function pipeline Shaded color can be computed for individual vertices or pixels in isolation (fragment shader) Materials interact with light Specular surfaces (mirror, shiny metals, ) Diffuse surfaces (painted walls, ) Translucent surfaces (water, glass, ) 13

Types of Lights Lights have a color (RGB intensities) Ambient lights are designed to scatter light across a scene uniformly. Approximated by global ambient intensities (RGB) avoids completely dark surfaces. Lights have geometric properties: Point light (light emitted from a position) Spotlight (emitted intensity depends on angle) Directional light (point light at infinity direction instead of position) 14

Shading ambient a constant throughout the scene ECS 175 15

Shading diffuse comes from Lambert s cosine law ECS 175 16

Shading diffuse comes from Lambert s cosine law ECS 175 17

Shading specular comes from reflection Specular Diffuse ECS 175 18

Shading specular comes from reflection ECS 175 19

Shading Put them all together ECS 175 20

Shading Put them all together ECS 175 21

Shading Put them all together ECS 175 22

The Phong Lighting Model Phong lighting model uses 4 vectors Efficient approximation of lighting r = direction of ideal reflection 23

The Phong Lighting Model Phong lighting model uses ambient, diffuse, and specular interactions Light source has RGB components for each 24

The Phong Lighting Model Surfaces reflect these contributions differently based on material properties, direction of normal, etc. What we see from a surface is a combination of light intensities and reflection terms (red intensity, one light): 25

Ambient Reflection Ambient light intensity is the same everywhere on a surface Surface defines a an ambient reflection coefficient 26

Diffuse Reflection Diffuse reflection is considered to be the same in all directions. But: amount of light per area matters. Lambert s Law 27

Diffuse Reflection Cosines of angles can be computed with the dot product l,n are unit length light and normal vectors reflection coefficient distance attenuation 28

Specular Reflection Specular reflection produces highlights on shiny objects Highlights depend on current viewing direction 29

Specular Reflection During specular reflection, light is concentrated around the direction of perfect reflection glossiness (shininess) coefficient 30

Specular Reflection Shininess coefficient controls how concentrated specular highlight appears 31

The Phong Model Intensity is sum of individual reflected intensities distance attenuation specular reflection diffuse reflection ambient reflection 32

The Blinn-Phong Model Phong-Model requires recalculation of The Blinn-Phong model replaces this calculation by Where is the vector half way in between l and v If v lies in the same plane as l,n,r then the angle between n and h is simply half of the angle between r and v 33

The Blinn-Phong Model The Blinn-Phong model is standard in OpenGL s fixed function pipeline Programmable fragment shaders allow us to perform more accurate shading computations in real time 34

Shading of Polygonal Geometry Object normals are typically precomputed for efficiency Normals are unit length vectors Normals are orthogonal to the local surface tangent Cross product allows direct computation of triangle normals 35

Shading of Polygonal Geometry For polygonal geometry we can distinguish three types of shading: Flat shading Gouraud Shading (smooth shading) Phong Shading Flat shading and smooth shading compute shades pervertex and interpolate the result across the triangle to obtain per-fragment colors Shaders allow us to perform per-fragment shading 36

Three Types of Shading 37

Flat Shading For a fixed light n,l,r are constant per triangle Assuming that the viewer is far away from the scene, v is constant over the triangle Shading needs to be computed only once per triangle 38

Gouraud/Smooth Shading For smooth shading, normals cannot stay constant over a triangle Triangles can have three different normals (one at each vertex) We compute normals for vertices as: 39

Gouraud/Smooth Shading Shading colors are computed per-vertex. Resulting colors are interpolated across triangles looks better, but still not optimal for low resolution meshes 40

Phong Shading With shaders, we can compute per-fragment shading Like all vertex attributes, normals are interpolated across triangles Now we can use an individual normal for every fragment per-fragment shading with specular highlight 41

Shading It is a tough problem We have approximated everything to give an efficient method for shading Ambient Diffuse Reflective 42