Computer Graphics MTAT Raimond Tunnel

Similar documents
Visualisatie BMT. Rendering. Arjan Kok

CS770/870 Spring 2017 Color and Shading

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

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

CS5620 Intro to Computer Graphics

ECS 175 COMPUTER GRAPHICS. Ken Joy.! Winter 2014

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

Color and Light CSCI 4229/5229 Computer Graphics Fall 2016

Illumination Models & Shading

Illumination & Shading

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

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

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

w Foley, Section16.1 Reading

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

Comp 410/510 Computer Graphics. Spring Shading

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

Illumination and Shading

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

Shading I Computer Graphics I, Fall 2008

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

Light Transport Baoquan Chen 2017

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

CPSC 314 LIGHTING AND SHADING

Topics and things to know about them:

CS 130 Final. Fall 2015

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

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

CEng 477 Introduction to Computer Graphics Fall

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

CMSC427 Shading Intro. Credit: slides from Dr. Zwicker

Shading. Slides by Ulf Assarsson and Tomas Akenine-Möller Department of Computer Engineering Chalmers University of Technology

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

Computer Graphics. Illumination and Shading

Shading 1: basics Christian Miller CS Fall 2011

Pipeline Operations. CS 4620 Lecture 10

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

Illumination and Shading

INF3320 Computer Graphics and Discrete Geometry

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

Lighting and Materials

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

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

Lecture 15: Shading-I. CITS3003 Graphics & Animation

Introduction to Computer Graphics 7. Shading

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

The Rasterization Pipeline

Reflection and Shading

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

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

Illumination in Computer Graphics

TSBK 07! Computer Graphics! Ingemar Ragnemalm, ISY

CS 325 Computer Graphics

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

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

Specular Reflection. Lecture 19. Robb T. Koether. Hampden-Sydney College. Wed, Oct 4, 2017

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

Deferred Rendering Due: Wednesday November 15 at 10pm

Introduction to Visualization and Computer Graphics

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

CENG 477 Introduction to Computer Graphics. Ray Tracing: Shading

Illumination and Shading

Illumination & Shading: Part 1

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

Simple Lighting/Illumination Models

Shading. Slides by Ulf Assarsson and Tomas Akenine-Möller Department of Computer Engineering Chalmers University of Technology

CS Illumination and Shading. Slide 1

Virtual Reality for Human Computer Interaction

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

Property of: Entrada Interactive. PBR Workflow. Working within a PBR-based environment

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

Computer Graphics: 3-Local Illumination Models

The Rasterizer Stage. Texturing, Lighting, Testing and Blending

CS 4600 Fall Utah School of Computing

Three-Dimensional Graphics V. Guoying Zhao 1 / 55

Computer Graphics. Illumination and Shading

From Graphics to Visualization

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

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

Complex Shading Algorithms

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

Lighting and Shading. Slides: Tamar Shinar, Victor Zordon

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

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

University of Victoria CSC 305 Shading. Brian Wyvill 2016

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

Virtual Reality for Human Computer Interaction

CS 130 Exam I. Fall 2015

Game Technology. Lecture Physically Based Rendering. Dipl-Inform. Robert Konrad Polona Caserman, M.Sc.

Graphics and Visualization

Interpolation using scanline algorithm

Homework #2. Shading, Projections, Texture Mapping, Ray Tracing, and Bezier Curves

Graphics Hardware and Display Devices

Why we need shading?

Shading and Texturing Due: Friday, Feb 17 at 6:00pm

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

Photorealism: Ray Tracing

LIGHTING AND SHADING

CS5670: Computer Vision

Transcription:

Computer Graphics MTAT.03.015 Raimond Tunnel

The Road So Far... Last week This week

Color What is color?

Color We represent color values with 3 channels: Red Green Blue

Color We represent color values with 3 channels: Red Green Blue The 4th (alpha-channel) is used for semitransparent color values.

Color We represent color values with 3 channels: Red Green Blue The 4th (alpha-channel) is used for semitransparent color values. Values usually in ranges: [0, 1] [0, 255] [0, FF]

Color

Alpha Channel Do you believe that these are all red triangles?

RGB

RGB Subset of the visible color space

RGB Subset of the visible color space Humans see wavelengths roughly from 390 700 nm.

RGB Subset of the visible color space Humans see wavelengths roughly from 390 700 nm. They see them using 3 types of cones with varying response rates in the eye.

RGB Subset of the visible color space Humans see wavelengths roughly from 390 700 nm. They see them using 3 types of cones with varying response rates in the eye. Infinite amount of different colors.

RGB There are actually many ways to specify colors in the computer (HSV, YCbCr, CMYK).

RGB There are actually many ways to specify a color space in the computer (HSV, YCbCr, CMYK). Also many different RGB color spaces (srgb, Adobe RGB, Apple RGB, CIE RGB).

RGB There are actually many ways to specify a color space in the computer (HSV, YCbCr, CMYK). Also many different RGB color spaces (srgb, Adobe RGB, Apple RGB, CIE RGB). Mostly we use the srgb (standard) color space in graphics.

RGB There are actually many ways to specify a color space in the computer (HSV, YCbCr, CMYK). Also many different RGB color spaces (srgb, Adobe RGB, Apple RGB, CIE RGB). Mostly we use the srgb (standard) color space in graphics. But there is a catch...

Gamma Correction Do these seem of the same shade of gray? Vertical black-and-white bars compared to srgb color (128, 128, 128)

Gamma Correction The colors that the monitor outputs have your values passed through a function: γ outputrgb=srgb, γ=2.2

Gamma Correction The colors that the monitor outputs have your values passed through a function: γ outputrgb=srgb, γ=2.2 This is because the old CRT monitors had a non-linear response rate (the function above).

Gamma Correction The colors that the monitor outputs have your values passed through a function: γ outputrgb=srgb, γ=2.2 This is because the old CRT monitors had a non-linear response rate (the function above). Thus a correction for this function was encoded in all media and has persisted to this day.

Gamma Correction The colors that the monitor outputs have your values passed through a function: γ outputrgb=srgb, γ=2.2 This is because the old CRT monitors had a non-linear response rate (the function above). Thus a correction for this function was encoded in all media and has persisted to this day. Also it allows more different darker grays to be represented in srgb.

Gamma Correction srgb (128, 128, 128) gray is not exactly halfway between white and black when displayed. Imagine a fully red cube (255, 0, 0). If it is lit by a white light so that only 25% reflects off, what is the response we see?

Gamma Correction and srgb Questions about srgb, alpha channel, gamma correction? See if your monitor is calibrated correctly: http://www.lagom.nl/lcd-test/gamma_calibration.php More about gamma correction: http://http.developer.nvidia.com/gpugems3/gpugems 3_ch24.html About srgb: http://dpanswers.com/content/tech_colmgmnt01.php

Lighting Models There are different types of light reflection, because there are different types of materials.

Lighting Models There are different types of light reflection, because there are different types of materials. In computer graphics, basic lighting models include 3 distinct reflections / terms: Ambient Diffuse (Lambertian) Specular (Phong, Blinn-Phong)

Lighting Models There are different types of light reflection, because there are different types of materials. In computer graphics, basic lighting models include 3 distinct reflections / terms: Ambient Diffuse (Lambertian) Specular (Phong, Blinn-Phong) These describe a very basic lighting model. There exist more physically accurate ones.

Diffuse Reflection (Lambertian) We assume that light hitting a surface scatters in all directions equally.

Diffuse Reflection (Lambertian) So the amount of light reaching a viewer is independant of the viewer's position.

Diffuse Reflection (Lambertian) So the amount of light reaching a viewer is independant of the viewer's position. What about the light's direction?

Diffuse Reflection (Lambertian) What about the light's direction? Looking closer...

Diffuse Reflection (Lambertian) What about the light's direction? Looking closer... Which surface looks more brighter for the viewer?

Diffuse Reflection (Lambertian) How much light reaches one surface unit?

Diffuse Reflection (Lambertian) How much light reaches one surface unit?

Diffuse Reflection (Lambertian) Sine is difficult, can we calculate it with a cosine? n i s ) α (

Diffuse Reflection (Lambertian) Sine is difficult, can we calculate it with a cosine? n i s ) α ( sin (α)=cos(90 α)=cos(β)

Diffuse Reflection (Lambertian) How to calculate cos(β) knowing l and n? n surface normal l direction vector towards the light source

Diffuse Reflection (Lambertian) This is the diffuse reflection term. I =n l

Diffuse Reflection (Lambertian) This is the diffuse reflection term. For a colored surface, we multiply it with coefficients M [0, 1] for each color channel. I = M n l

Diffuse Reflection (Lambertian) That is the diffuse reflection term. For a colored surface, we multiply it with coefficients M [0, 1] for each color channel. For a colored light source we multiply it with coefficients L [0, 1] for each color channel. I = M L n l

Diffuse Reflection (Lambertian) I =M L n l

Diffuse Reflection (Lambertian) I =M L n l How much light reaches the surface n surface normal l direction vector towards the light source

Diffuse Reflection (Lambertian) I =M L n l How intense is that light in RGB channels M [0, 1]

Diffuse Reflection (Lambertian) I =M L n l How much the material reflects light in RGB channels L [0, 1]

Ambient Light Describe these cubes...

Ambient Light Ambient light is almost always bouncing around. We add some small value of ambient light. I = M ambient Lambient + M diffuse Ldiffuse n l

Specular Reflection Is there something missing?

Specular Reflection Some surfaces seem more shiny That is because they will reflect some light directly, not scatter it in all directions

Specular Reflection (Phong) So, the surface should seem more brighter, if the light is reflecting directly into viewer's eye.

Specular Reflection (Phong) We can take the cosine of the angle between the viewer direction v and the reflected light r. v r

Specular Reflection (Phong) We can take the cosine of the angle between the viewer direction v and the reflected light r. Because that gives a too wide highlight, we also rise it to a power of shininess. shininess (v r )

Specular Reflection (Phong) We can take the cosine of the angle between the viewer direction v and the reflected light r. Because that gives a too wide highlight, we also rise it to a power of shininess. Multiply also with the M and L. shininess M spec L spec (v r) Check out CGLearn examples

Specular Reflection (Phong) shininess = 30 shininess = 300 shininess = 0 shininess = 90

Phong's Lighting Model Tuong Phong, 1975. I = M amb L amb + M dif L dif n l + M spec L spec (v r) shininess

Phong's Lighting Model Tuong Phong, 1975. I = M amb L amb + M dif L dif n l + M spec L spec (v r) The ambient term Describes the indirect light all around the scene. shininess

Phong's Lighting Model Tuong Phong, 1975. I = M amb L amb + M dif L dif n l + M spec L spec (v r) The diffuse term Describes the direct light that is diffusely scattered shininess

Phong's Lighting Model Tuong Phong, 1975. I = M amb L amb + M dif L dif n l + M spec L spec (v r) shininess The specular term Describes the direct light that is specularly reflected

Phong's Lighting Model Tuong Phong, 1975. I = M amb L amb + M dif L dif n l + M spec L spec (v r) Material's color is usually the same for both ambient and diffuse shininess

Phong's Lighting Model Tuong Phong, 1975. I = M amb L amb + M dif L dif n l + M spec L spec (v r) shininess Material's specular color (tint) is usually white

Phong's Lighting Model Tuong Phong, 1975. I = M amb L amb + M dif L dif n l + M spec L spec (v r) shininess Light's color is usually the same for diffuse and specular

Phong's Lighting Model Tuong Phong, 1975. I = M amb L amb + M dif L dif n l + M spec L spec (v r) Ambient light's color depends on the scene. Eg lot of red objects in the scene produce a red ambient light shininess

Phong's Lighting Model Questions about ambient, diffuse, specular light? I = M amb L amb + M dif L dif n l + M spec L spec (v r) shininess

Shading Where to apply the light calculation? What points do we have in our geometry?

Shading Flat apply it per polygon Gouraud apply it per vertex, interpolate Phong apply it per fragment No specular reflection Cube has duplicate vertices Diffiuse lighting with flat, Gouraud and Phong shading models.

What was awesome today? What more would you like to know? Next time Textures and Sampling