Shading (introduction to rendering). Rendering  We know how to specify the geometry but how is the color calculated.

Slides:



Advertisements
Similar presentations
1 Graphics CSCI 343, Fall 2013 Lecture 18 Lighting and Shading.
Advertisements

CSPC 352: Computer Graphics
Virtual Realism LIGHTING AND SHADING. Lighting & Shading Approximate physical reality Ray tracing: Follow light rays through a scene Accurate, but expensive.
1. What is Lighting? 2 Example 1. Find the cubic polynomial or that passes through the four points and satisfies 1.As a photon Metal Insulator.
Based on slides created by Edward Angel
1 Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009 Shading I.
University of New Mexico
Computer Graphics - Class 10
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2008 Tamara Munzner Lighting/Shading III Week.
Rendering (彩現 渲染).
IMGD 1001: Illumination by Mark Claypool
Computer Graphics (Fall 2005) COMS 4160, Lecture 16: Illumination and Shading 1
Lighting and Shading Wen-Chieh (Steve) Lin
1 CSCE 641: Computer Graphics Lighting Jinxiang Chai.
7M836 Animation & Rendering
Objectives Learn to shade objects so their images appear three- dimensional Learn to shade objects so their images appear three- dimensional Introduce.
6.1 Vis_04 Data Visualization Lecture 6 - A Rough Guide to Rendering.
CS5500 Computer Graphics March 26, Shading Reference: Ed Angel’s book.
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Shading I Ed Angel Professor of Computer Science, Electrical and Computer Engineering,
Lighting & Shading.
LIGHTING Part One - Theory based on Chapter 6. Lights in the real world Lights bounce off surfaces and reflect colors, scattering light in many directions.
CS 480/680 Computer Graphics Shading I Dr. Frederick C Harris, Jr.
SET09115 Intro Graphics Programming
Fundamentals of Computer Graphics Part 6 Shading prof.ing.Václav Skala, CSc. University of West Bohemia Plzeň, Czech Republic ©2002 Prepared with Angel,E.:
CS 445 / 645: Introductory Computer Graphics
Computer Graphics Lighting.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
COMPUTER GRAPHICS CS 482 – FALL 2014 AUGUST 27, 2014 FIXED-FUNCTION 3D GRAPHICS MESH SPECIFICATION LIGHTING SPECIFICATION REFLECTION SHADING HIERARCHICAL.
19/17/ :25 UML Graphics: Conceptual Model Real Object Human Eye Display Device Graphics System Synthetic Model Synthetic Camera Real Light Synthetic.
Steve Sterley. Real World Lighting Physical objects tend to interact with light in three ways: Absorption (black body) Reflection (mirror) Transmission.
University of Texas at Austin CS 378 – Game Technology Don Fussell CS 378: Computer Game Technology Basic Rendering Pipeline and Shading Spring 2012.
Illumination and Shading How to shade surfaces based on the position,orientation,characteristics of the surfaces and the light sources illuminating them.
CSE 381 – Advanced Game Programming GLSL Lighting.
Illumination.
Computer Graphics: Programming, Problem Solving, and Visual Communication Steve Cunningham California State University Stanislaus and Grinnell College.
Illumination and Shading
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
Shading in OpenGL Ed Angel Professor Emeritus of Computer Science University of New Mexico 1 E. Angel and D. Shreiner: Interactive Computer Graphics 6E.
RENDERING Introduction to Shading models – Flat and Smooth shading – Adding texture to faces – Adding shadows of objects – Building a camera in a program.
RENDERING Introduction to Shading models – Flat and Smooth shading – Adding texture to faces – Adding shadows of objects – Building a camera in a program.
Lecture Fall 2001 Illumination and Shading in OpenGL Light Sources Empirical Illumination Shading Transforming Normals Tong-Yee Lee.
Visual Appearance Chapter 4 Tomas Akenine-Möller Department of Computer Engineering Chalmers University of Technology.
Specular Reflection Lecture 27 Mon, Nov 10, 2003.
Local Illumination and Shading
Cornell CS465 Spring 2004 Lecture 4© 2004 Steve Marschner 1 Shading CS 465 Lecture 4.
1 CSCE 441: Computer Graphics Lighting Jinxiang Chai.
OpenGL Shading. 2 Objectives Learn to shade objects so their images appear three-dimensional Introduce the types of light-material interactions Build.
Lighting and Reflection Angel Angel: Interactive Computer Graphics5E © Addison-Wesley
1 CSCE 441: Computer Graphics Lighting Jinxiang Chai.
David Luebke3/16/2016 CS 551 / 645: Introductory Computer Graphics David Luebke
Computer Graphics Lecture 25 Fasih ur Rehman. Last Class Shading.
Illumination Models. Introduction 1 Illumination model: Given a point on a surface, what is the perceived color and intensity? Known as Lighting Model,
Computer Graphics Lecture 30 Mathematics of Lighting and Shading - IV Taqdees A. Siddiqi
1 CSCE 441: Computer Graphics Lighting Jinxiang Chai.
Computer Graphics Ken-Yi Lee National Taiwan University (the slides are adapted from Bing-Yi Chen and Yung-Yu Chuang)
Computer Graphics: Illumination
Computer Graphics (Fall 2006) COMS 4160, Lecture 16: Illumination and Shading 1
Illumination and Shading. Illumination (Lighting) Model the interaction of light with surface points to determine their final color and brightness OpenGL.
Shading CS 465 Lecture 4 © 2004 Steve Marschner • 1.
Visual Appearance Chapter 4
CSC461: Lecture 23 Shading Computation
CSE 470 Introduction to Computer Graphics Arizona State University
Isaac Gang University of Mary Hardin-Baylor
Illumination and Shading
Computer Graphics Material Colours and Lighting
Computer Graphics (Fall 2003)
CS 480/680 Computer Graphics Shading.
Computer Graphics Shading in OpenGL
Lighting Calculations
Presentation transcript:

Shading (introduction to rendering)

Rendering  We know how to specify the geometry but how is the color calculated

Rendering  We know how to specify the geometry but how is the color calculated

Rendering  We know how to specify the geometry but how is the color calculated

Rendering: simulation of light transport  What makes up the final color of an object?

Rendering: simulation of light transport  Diffuse scattering o matt surfaces  Specular reflection o shiny surfaces o highlight  Transparency o glass, water o penetrate the surface

Rendering: simulation of light transport  How do we represent these observations in a mathematical framework

Rendering: simulation of light transport  Real time rendering is generally not concerned with using a "correct" lighting equation, just a series of hacks to make things look right with as little computational effort as possible

Illumination Models  Local o Direct illumination of surfaces by light sources  Global o all light/surface interactions for entire environment

Global illumination

Local illumination  Input: o a 3D object o Material and color of the object o Position and structure of the light source o “Intensity” of the light source  Output: o Color and intensity of points of the given object A (modest) example of shading

Representing 3D Objects  Collection of triangles or mesh

Dealing with color  Three component intensity (red, green, blue)  Luminance (intensity) of the source o Red component of source red component of image o Green component of source green component of image o Blue component of source blue component of image  Three similar but independent calculations  We focus on one scalar value only

Diffuse reflection  A perfect diffuse reflector (Lambertian surface) scatters the light equally in all directions  Same appearance to all viewers  Depends on o Material of the surface o The position of the light

Normals o What direction is the surface facing?

CrossProduct o n.x = a.y * b.z - a.z * b.y o n.y = a.z * b.x - a.x * b.z o n.z = a.x * b.y - a.y * b.x

Normals o A = V2 – V1 o B = V0 – V1 o N = A x B

Normals o For each triangle we can define a normal for the face o For each vertex we an define a normal by interpolating normals of attached faces

Diffuse: Two important vectors  To compute the intensity at P, we need o The unit normal vector N, o The unit vector L, from P to the light L N P θ

Diffuse: Two important vectors  To compute the intensity at P, we need o The unit normal vector N, o The unit vector L, from P to the light L N P θ What is the diffuse color at P?

Lambert’s cosine law  I : diffuse reflection at P   I d : intensity of the light from source  coefficient of diffuse reflection

Coefficient of diffuse reflection  k d is usually determined by a trial and error approach  Examples: Component Gold Black plastic Silver Red Green Blue k d =0.05 k d =0.25 k d =0.5 k d =0.75 k d =1

Specular reflection  Diffusive reflection: no highlights, rough surface  Specular reflection: highlights, shiny and smooth surfaces  View dependent reflection

Three important vectors  To compute the intensity at P, we need o The unit normal vector N, o The unit vector L, from P to the light o The unit vector V, from P to the viewer L N V P

Three important vectors  To compute the intensity at P, we need o The unit normal vector N, o The unit vector L, from P to the light o The unit vector V, from P to the viewer L N V P What is the specular illumination at P?

The shininess coefficient 0 90 o -90 o increasing n

 I : specular reflection at P   I d : intensity of the light from source  coefficient of specular reflection  n: controls shininess The Phong model for specular reflection P N L R P N L R V

Ambient light  “Physical rules” are too simplified  No indirect or global interaction of light  A hack to overcome the problem: use “ambient light”

Ambient light specification  Not situated at any particular point  Spreads uniformly in all directions   I a : intensity of ambient light in the environment  I : ambient light at a given point  : coefficient of ambient light reflection k a =0 k a =0.5 k a =1

A combined model (The Phong local illumination model)  The final model = diffuse + specular + ambient 

How does it work in OpenGL

Flat Shading  Individual faces are visualized  Same color for any point in the face

Smooth Shading  Visualize the underlying surface  Each point on the face has its own color  Two techniques Gouraud and Phong shading

Shading GouraudPhongFlat Normal Per VertexInterpolated normal for each point across face Normal per face Color per vertex, interpolated across face Color calculated per pixel Color calculated per face Faster then phong Bad specular Costly (not really any more) Fast, good for distant objects N

Clarification  Phong reflection model or phong lighting refers to  Phong Shading refers to filling a triangle by interpolating the normal and calculating the color at each point

Gouraud Shading  Specular highlight quality tied to detail of mesh  Specular highlights can even be missed

Incorporating a distance term a,b,c are control parameters Empirical formula:

Multiple light sources  The total reflection at p is the sum of all contributed intensities from all sources  OpenGL allows us to define several light sources

OpenGL 2.0 (programmable) pipeline

More advanced rendering

Questions?