Osvetljevanje in senčenje (lighting - shading)

Slides:



Advertisements
Similar presentations
Polygon Rendering Flat Rendering Goraud Rendering Uses Phong Reflectance Phong Rendering.
Advertisements

1 Graphics CSCI 343, Fall 2013 Lecture 18 Lighting and Shading.
Virtual Realism LIGHTING AND SHADING. Lighting & Shading Approximate physical reality Ray tracing: Follow light rays through a scene Accurate, but expensive.
Lighting and Illumination Lighting is the major problem in computer graphics, for either realism or real-time compositions- harder than modeling Consider.
Illumination and Shading
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.
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
(conventional Cartesian reference system)
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.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2005 Tamara Munzner Lighting and Shading Week.
6.1 Vis_04 Data Visualization Lecture 6 - A Rough Guide to Rendering.
©Larry F. Hodges (modified by Amos Johnson) 1 Shading Models.
University of British Columbia CPSC 414 Computer Graphics © Tamara Munzner 1 Shading Week 5, Wed 1 Oct 2003 recap: lighting shading.
Illumination and Shading
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Shading I Ed Angel Professor of Computer Science, Electrical and Computer Engineering,
Aaron Bloomfield CS 445: Introduction to Graphics Fall 2006
CS 480/680 Computer Graphics Shading I Dr. Frederick C Harris, Jr.
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.
CS 445 / 645 Introduction to Computer Graphics Lecture 18 Shading Shading.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
Shading (introduction to rendering). Rendering  We know how to specify the geometry but how is the color calculated.
COMPUTER GRAPHICS CS 482 – FALL 2014 AUGUST 27, 2014 FIXED-FUNCTION 3D GRAPHICS MESH SPECIFICATION LIGHTING SPECIFICATION REFLECTION SHADING HIERARCHICAL.
CSC418 Computer Graphics n Illumination n Lights n Lightinging models.
David Luebke 1 10/26/2015 Lighting CS 445/645 Introduction to Computer Graphics David Luebke, Spring 2003.
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.
Computer Graphics: Programming, Problem Solving, and Visual Communication Steve Cunningham California State University Stanislaus and Grinnell College.
Komputer Grafik 2 (AK045206) Shading 1/17 Realisme : Shading.
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.
CS 325 Introduction to Computer Graphics 03 / 29 / 2010 Instructor: Michael Eckmann.
CS 445 / 645 Introduction to Computer Graphics Lecture 15 Shading Shading.
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.
Local Illumination and Shading
Where We Stand So far we know how to: –Transform between spaces –Rasterize –Decide what’s in front Next –Deciding its intensity and color.
1 CSCE 441: Computer Graphics Lighting Jinxiang Chai.
In the name of God Computer Graphics. Where We Stand So far we know how to: –Transform between spaces –Draw polygons Next –Deciding a pixel’s intensity.
Render methods. Contents Levels of rendering Wireframe Plain shadow Gouraud Phong Comparison Gouraud-Phong.
Illumination and Shading Sang Il Park Sejong University.
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
Illumination Models. Introduction 1 Illumination model: Given a point on a surface, what is the perceived color and intensity? Known as Lighting Model,
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.
Chapter 14 Shading Models.
CSE 470 Introduction to Computer Graphics Arizona State University
Chapter IX Lighting.
Illumination and Shading
Computer Graphics (Fall 2003)
Chapter 14 Shading Models.
Presentation transcript:

Osvetljevanje in senčenje (lighting - shading)

“Osvetljevanje” Two components: Lighting Model or Shading Model - how we calculate the intensity at a point on the surface Surface Rendering Method - How we calculate the intensity at each pixel

Lastnosti snovi Ambient color Diffuse color Specular color Shininess Color of emitted light

Modeli osvetljevanja Ambient Lambert/Diffuse Phong/Specular Normals don’t matter Lambert/Diffuse Angle between surface normal and light Phong/Specular Surface normal, light, and viewpoint Rendering Equation (Kajiya)

Svetloba okolja (ambient color) Affects the overall color of the object Is most noticeable where an object receives no direct light Total ambient reflectance is affected by global ambient light and ambient light from all light sources

Svetloba okolja (ambient color) It represents the approximate contribution of the light to the general scene, regardless of location of light and object Indirect reflections that are too complex to completely and accurately compute Iambient = color

Difuzni odboj Plays an important role in the color you perceive for an object Is affected by the color of the incident diffuse light and the angle of the incident light relative to the normal direction Viewer position doesn’t affect diffuse reflection

Osvetlitev površine – svetlost predmeta

Difuzni odboj Contribution that a light has on the surface, regardless of viewing direction. Diffuse surfaces, on a microscopic level, are very rough. This means that a ray of light coming in has an equal chance of being reflected in any direction.

Model difuzne svetlobe Lambert’s Law The intensity of the light reflected from a perfect diffuser, Id, is proportional to the cosine of the angle between the light source direction and the normal to the surface. m v and s  pd : diffuse reflection coefficient P

Lambertov kosinusni zakon Diffuse surfaces follow Lambert’s Cosine Law Lambert’s Cosine Law - reflected energy from a small surface area in a particular direction is proportional to the cosine of the angle between that direction and the surface normal. Think about surface area and # of rays

Zrcalni odboj Specular contribution can be thought of as the “shiny highlight” of a plastic object. N R V  L  

Bleščeči in motni predmeti

Phongov Model Ispecular = ksIlight (cos )shininess An approximation is sets the intensity of specular reflection proportional to (cos )shininess Ispecular = ksIlight (cos )shininess = ksIlight (V.R)shininess

Phongov model senčenja

Phongov model The amount of light reflected is greatest in the direction of perfect mirror reflection. At nearby angle, the amount of reflected light, Isp, varies according to cos f() . and r m v   s  P ps : specular reflection coefficient

Kombinacija svetlobe Light seen by the viewer = Ambient light + Diffuse light + Specular light OpenGL allows you to specify different intensities for ambient, difuse and specular light sources Isa, Isd, Isp : set for each light in the environment pa, pd, ps : set for each material in the environment

Ambientna + difuzna + zrcalna

Žarenje (emission ) Make an object appear to give off light Examples: lamps, street lights, etc.

Slabljenje (attenuation) One factor we have yet to take into account is that a light source contributes a higher incident intensity to closer surfaces. The energy from a point light source falls off proportional to 1/d2.

RGB vrednosti za luči in snov RGB values for lights indicate light intensity RGB values for materials indicate reflected proportions of those colors

Dodajanje barve

Senčenje (shading) Shading is how we “color” a triangle.

Senčenje (shading) Flat shading Accentuates the individual polygons Smooth shading Smooths the edges between polygons Phong shading Gourand shading

Modeli senčenja (direktna svetloba) Flat Shading Compute Phong lighting once for entire polygon Gouraud Shading Compute Phong lighting at the vertices and interpolate lighting values across polygon Phong Shading Compute averaged vertex normals Interpolate normals across polygon and perform Phong lighting across polygon

Plosko, konstantno senčenje Constant Intensity or Flat Shading One color for the entire triangle. Color is computed for one vertex and assigned to entire polygon Fast Good for some objects What happens if triangles are small? Sudden intensity changes at borders Specular highlights are rendered poorly

Mehko senčenje (Gouraud) Color is linearly interpolated from vertex points Specular highlights appear interpolated

Gouraudovo senčenje Intensity Interpolation Shading Calculate lighting at the vertices. Then interpolate the colors as you scan convert Relatively fast, only do three calculations

Gouraudovo senčenje

Slabo povprečenje verteksov

Mehko senčenje (Phong) Interpolate normal vectors for each point on the face of an object Better realism but more computationally expensive

Phongovo senčenje Phong shading is not the same as Phong lighting, though they are sometimes mixed up Phong lighting: the empirical model we’ve been discussing to calculate illumination at a point on a surface Phong shading: linearly interpolating the surface normal across the facet, applying the Phong lighting model at every pixel Same input as Gouraud shading Usually very smooth-looking results: But, considerably more expensive

Phongovo senčenje Interpolate the normal, since that is the information that represents the “curvature” Linearly interpolate the vertex normals. For each pixel, as you scan convert, calculate the lighting per pixel. True “per pixel” lighting

Primerjava Gouraud:Phong

Senčniki (Shaders) Local illumination quite complex Reflectance models Procedural texture Solid texture Bump maps Displacement maps Environment maps Need ability to collect into a single shading description called a shader Shaders also describe lights, e.g. spotlights atmosphere, e.g. fog

Senčenje v realnem času Moore’s law: CPU power doubles every 18 months Advances in materials Advances in methods Advances in marketing Graphics version: GPU power doubles every 6 months Supports more sophisticated shading, though in unexpected ways (e.g. strange uses of the texture maps)

Peercy, Olano, Airey , Ungar, "Interactive Multi-Pass Programmable Shading", SIGGRAPH 2000