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

Similar documents
CS5620 Intro to Computer Graphics

Illumination Models & Shading

Illumination and Shading

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

Shading I Computer Graphics I, Fall 2008

Computer Graphics. Illumination and Shading

Lecture 17: Shading in OpenGL. CITS3003 Graphics & Animation

CPSC / Illumination and Shading

Comp 410/510 Computer Graphics. Spring Shading

Introduction to Computer Graphics 7. Shading

Lecture 15: Shading-I. CITS3003 Graphics & Animation

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

Visualisatie BMT. Rendering. Arjan Kok

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

ECS 175 COMPUTER GRAPHICS. Ken Joy.! Winter 2014

CEng 477 Introduction to Computer Graphics Fall

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

Shading , Fall 2004 Nancy Pollard Mark Tomczak

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

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

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

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

Illumination & Shading

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

Lighting and Shading. Slides: Tamar Shinar, Victor Zordon

9. Illumination and Shading

CS Illumination and Shading. Slide 1

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

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

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

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

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

Shading and Illumination

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

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

Reflection and Shading

Virtual Reality for Human Computer Interaction

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

Illumination and Shading

Illumination & Shading: Part 1

Illumination and Shading

Illumination & Shading I

Shading Models. Simulate physical phenomena

CS Computer Graphics: Illumination and Shading I

CS Computer Graphics: Illumination and Shading I

How do we draw a picture?

Illumination and Shading

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

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

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

CPSC 314 LIGHTING AND SHADING

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

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

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

Three-Dimensional Graphics V. Guoying Zhao 1 / 55

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

Pipeline Operations. CS 4620 Lecture 10

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

CS 4600 Fall Utah School of Computing

Light Transport Baoquan Chen 2017

INF3320 Computer Graphics and Discrete Geometry

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

Sung-Eui Yoon ( 윤성의 )

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

CS 325 Computer Graphics

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

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

w Foley, Section16.1 Reading

CS 130 Final. Fall 2015

Lighting. Figure 10.1

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 14

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 in Computer Graphics

CS 4731: Computer Graphics Lecture 16: Phong Illumination and Shading. Emmanuel Agu

CS452/552; EE465/505. Intro to Lighting

Computer Graphics (CS 543) Lecture 8a: Per-Vertex lighting, Shading and Per-Fragment lighting

Computer Graphics: 3-Local Illumination Models

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

Mach band effect. The Mach band effect increases the visual unpleasant representation of curved surface using flat shading.

Graphics and Visualization

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

CSE 681 Illumination and Phong Shading

SEOUL NATIONAL UNIVERSITY

The Rasterization Pipeline

Lighting/Shading III. Week 7, Wed Mar 3

Shading, Advanced Rendering. Week 7, Wed Feb 28

Why we need shading?

CS452/552; EE465/505. Lighting & Shading

Computer Graphics. Illumination and Shading

Color and Light CSCI 4229/5229 Computer Graphics Fall 2016

TSBK 07! Computer Graphics! Ingemar Ragnemalm, ISY

5.2 Shading in OpenGL

Shading in OpenGL. Outline. Defining and Maintaining Normals. Normalization. Enabling Lighting and Lights. Outline

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

CMSC427 Shading Intro. Credit: slides from Dr. Zwicker

CS770/870 Spring 2017 Color and Shading

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

Computer Graphics I Lecture 11

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

Transcription:

llumination Model Wireframe rendering simple, ambiguous Color filling flat without any 3D information Requires modeling interaction of light with the object/surface to have a different color (shade in 3D

llumination Model Light on a surface is Absorbed Reflected Transmitted The amount reflected determines the color and brightness of the object light material (surface interaction

llumination Model The reflected light is scattered depending upon the surface properties and incident light Ambient light comes from all directions, is scattered in all directions Diffuse light comes from one direction and is scattered in all directions Specular light comes from one direction and is scattered in preferred direction

llumination Model Diffuse Reflection Lambert s Law L θ N d d. cos = kdl cos = k ( L N diffuse d l L: Light vector N: Normal θ: Angle between L and n k d diffuse reflection coefficient

llumination Model Diffuse Reflection

llumination Model Diffuse Reflection

llumination Model Diffuse Reflection Amount of light reflected depends on the direction to the light source and not on the direction to the viewer Viewer independent Distance from light source q can also be incorporated d = kdl ( L N kd = a + bq + cq ( L N 2 l

llumination Model Specular Reflection Highlights / Shininess Viewing Direction

llumination Model Specular Reflection N L θ θ α R V L: Light vector N: Normal θ: Angle between L and N α: Angle between R and V s s n = ksl cos. k n s specular reflection coefficient = ksl ( R V n specular reflection exponent

llumination Model Specular Reflection n=1 5 10 large n: metals small n: paper

llumination Model Specular Reflection Example

llumination Model Ambient Reflection Light from distributed light sources (and surroundings Also approximates effects of diffusely reflected light from outer bodies / objects. = k ambient a a k a ambient reflection coefficient a ambient incident light

llumination Model Phong llumination Model = + + = + + = + + = + + = m i n i i s i i d a a n l s l d a a n l s l d a a total V R k N L k k V R k N L k k. k k k reflection specular diffeuse reflection reflection ambient 1 ( ( ( ( cos cos

llumination Model Phong llumination Model Local computation for obtaining color (intensity at a point of the surface Basic inputs are light(s, material properties

llumination Model Reflection Vector N L θ i N θ r R L R 2 (L N N -L R = 2( L N N L

llumination Model Half Way Vector L N H V R nstead of L + V H = L + V R V can use N H

llumination Model Normal Vector Plane ax + by + cz + d = 0 p n n ( p p 0 = n = [ a b c] Normalize 0 p 0

llumination Model Normal Vector Plane v 3 n = ( v3 v1 ( v2 v1 Normalize v 1 v 2

llumination Model Normal Vector Sphere mplicit Equation = = + + = z f y f x f n z y x z y x f,, 0 1,, ( 2 2 2

llumination Model Normal Vector Parametric Surface, (, (, (, (, (,,,, v u b v v u b u v u b v v u b u v u n n m n m n m n m = u v n

llumination Model Light Sources Point light source Given by a point Light emitted in all directions Direction light source Given by a vector Spotlight light Given by a cone

llumination Model Phong llumination Model = + + = + + = + + = + + = m i n i i s i i d a a n l s l d a a n l s l d a a total V R k N L k k V R k N L k k. k k k reflection specular diffeuse reflection reflection ambient 1 ( ( ( ( cos cos

Polygon Shading Shading Process of applying illumination model to surface points Approaches Polygon (approximates the 3D shape/surface Flat Shading Gouraud Shading Phong Shading

Polygon Shading Flat Shading One intensity for the whole polygon constant shading For each face/polygon n p P y Select a point P on the face y Find normal to the face n p y Find intensity at P y Fill the polygon with Not smooth

Polygon Shading Flat Shading Example

Polygon Shading Flat Shading Computationally fast Not smooth Mach Band effect

Polygon Shading Gouraud Shading Smooth shading Compute intensity at vertices of a polygon ÖNeeds vertex normal Fill the interior with shade (intensity using interpolation

Polygon Shading Gouraud Shading Vertex Normal N 2 N v N 4 Normal at the vertex is average of normals of the faces incident at the vertex N 1 N 3 N v = P i = 1 n n i i

Polygon Shading Gouraud Shading Vertex Normal

Polygon Shading Gouraud Shading nterpolation (x 1, y 1 1 Scan line a s b 4 (x 2, y 2 (x 4, y 4 Scan conversion! 2 (x 3, y 3 3

Gouraud Shading nterpolation a b 2 3 4 s Scan line Polygon Shading 1 (x 1, y 1 (x 2, y 2 (x 3, y 3 (x 4, y 4 ] ( ( [ 1 ] ( ( [ 1 ] ( ( [ 1 1 4 4 1 4 1 1 2 2 1 2 1 a s b s b a a b s s s b s s a x x x x x x y y y y y y y y y y y y + = + = + = (x a, y s (x b, y s (x s, y s

Polygon Shading Gouraud Shading Example

Polygon Shading Gouraud Shading Handling Specular Reflections- Highlights Not Right

Polygon Shading Phong Shading nterpolate normals and then compute intensity Not to confuse with Phong llumination Model

Polygon Shading Phong Shading (x 1, y 1 N 1 llumination using N s Scan line N a N s N b N 4 N s s (x 2, y 2 (x 4, y 4 N 2 (x 3, y 3 N 3

Polygon Shading Phong Shading More accurate specular component Reduced Mach band effect Better shape approximation N 1 N 2 Original surface Computationally more intensive

Polygon Shading Phong Shading Example

Polygon Shading Phong Shading Example

Polygon Shading Problems Polygon Silhouette nterpolated shading

Polygon Shading Problems nterpolated shading nterpolation naccuracy (screen space vs world space Linear nterpolation Perspective nterpolation

Polygon Shading Problems Animation nterpolated shading V 1 Rotate V P 4 V 1 V 2 P V 2 V 3 V 3 V 4

Polygon Shading Problems nterpolated shading Vertex Normal Vertex Normals Face Normals

Polygon Shading Graphics Pipeline Order llumination computation is done early after modeling transformation Shading is done towards the end with rasterization (scan conversion

Polygon Shading Transparency Simple Model Non refractive = k + ( 1 k reflected transmitted k is the opacity factor (coefficient

Polygon Shading mplementation OpenGL Enable light sources JO(QDEOH*/B/,*+7 Light properties {r g b a} Glfloat light_diffuse[] = {1.0, 1.0, 1.0, 1.0} JO/LJKWY*/B/,*+7*/B',86(OLJKWBGLXVH Light position {x y z w} Glfloat light_position[] = {-1.0, 1.0, -1.0, 1.0} JO/LJKWY*/B/,*+7*/B326,7,21OLJKWBSRVLWLRQ

Polygon Shading mplementation OpenGL Material properties {r g b a} Glfloat mat_d[] = {0.1, 0.2, 0.8, 1.0} JO0DWHULDOY*/B5217*/B',86(PDWBG Normal vector JO1RUPDOQ[Q\Q] JO9HUWH[Q[Q\Q]