Illumination and Shading

Slides:



Advertisements
Similar presentations
2IV60 Computer graphics set 8: Illumination Models and Surface-Rendering Methods Jack van Wijk TU/e.
Advertisements

Polygon Rendering Flat Rendering Goraud Rendering Uses Phong Reflectance Phong Rendering.
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 Computer Graphics By : Mohammed abu Lamdy ITGD3107 University of Palestine Supervision: Assistant Professor Dr. Sana’a Wafa Al-Sayegh.
1 MAE152 Computer Graphics for Scientists and Engineers Lighting in OpenGL.
Illumination and Shading
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.
Shading in OpenGL CS4395: Computer Graphics 1 Mohan Sridharan Based on slides created by Edward Angel.
Rendering (彩現 渲染).
IMGD 1001: Illumination by Mark Claypool
CS 4731: Computer Graphics Lecture 16: Illumination Models Part 2 Emmanuel Agu.
Shading in OpenGL Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico.
7M836 Animation & Rendering
1 CSC 830 Computer Graphics Lecture 5 Shading Course Note Credit: Some of slides are extracted from the course notes of prof. Mathieu Desburn (USC) and.
CS5500 Computer Graphics March 26, Shading Reference: Ed Angel’s book.
Illumination and Shading
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Shading I Ed Angel Professor of Computer Science, Electrical and Computer Engineering,
Illumination and Shading. Illumination (Lighting) Model the interaction of light with surface points to determine their final color and brightness OpenGL.
CS 480/680 Computer Graphics Shading I Dr. Frederick C Harris, Jr.
Computer Graphics Lighting.
1 Graphics CSCI 343, Fall 2013 Lecture 20 Lighting and Shading III.
Shading (introduction to rendering). Rendering  We know how to specify the geometry but how is the color calculated.
Illumination & Reflectance Dr. Amy Zhang. Outline 2  Illumination and Reflectance  The Phong Reflectance Model  Shading in OpenGL.
Shading in OpenGL.
19/17/ :25 UML Graphics: Conceptual Model Real Object Human Eye Display Device Graphics System Synthetic Model Synthetic Camera Real Light Synthetic.
Shading 03/19/2003. Lighting Principles Lighting based on how objects reflect light –Surface characteristics –Light color and direction –Global lighting.
Shading and Illumination. OpenGL Shading Without ShadingWith Shading.
Illumination and Shading
Computer Graphics I, Fall 2010 Shading in OpenGL.
Lecture 14 Shading models 1.Shading Constant Shading (to be implemented) Gouraud Shading Phong Shading 2.Light and shading with OpenGL 1.
08 |Lighting and Shading Eriq Muhammad Adams J |
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.
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Shading I Ed Angel Professor of Computer Science, Electrical and Computer Engineering,
Illumination and Shading
Shading in OpenGL Ed Angel Professor Emeritus of Computer Science University of New Mexico 1 E. Angel and D. Shreiner: Interactive Computer Graphics 6E.
Lecture Fall 2001 Illumination and Shading in OpenGL Light Sources Empirical Illumination Shading Transforming Normals Tong-Yee Lee.
Local Illumination and Shading
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.
Lighting Dave Shreiner. 2 Lighting Principles Lighting simulates how objects reflect light Lighting simulates how objects reflect light material composition.
Render methods. Contents Levels of rendering Wireframe Plain shadow Gouraud Phong Comparison Gouraud-Phong.
Illumination and Shading Sang Il Park Sejong University.
Shading NOTE: Some of these slides are from Ed Angel’s presentation at SIGGRAPH February 27, 2008.
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: Illumination
Illumination and Shading. Illumination (Lighting) Model the interaction of light with surface points to determine their final color and brightness OpenGL.
Illumination Models and Surface-Rendering Methods CEng 477 Introduction to Computer Graphics.
Illumination and Shading. Illumination (Lighting) Model the interaction of light with surface points to determine their final color and brightness OpenGL.
C O M P U T E R G R A P H I C S Guoying Zhao 1 / 55 C O M P U T E R G R A P H I C S Guoying Zhao 1 / 55 Computer Graphics Three-Dimensional Graphics V.
Graphics Graphics Korea University kucg.korea.ac.kr 1 Lights & Material 고려대학교 컴퓨터 그래픽스 연구실.
Shading To determine the correct shades of color on the surface of graphical objects.
Illumination and Shading
Chapter 14 Shading Models.
CSC461: Lecture 23 Shading Computation
Shading in OpenGL Ed Angel
Lighting and Materials
CS5500 Computer Graphics April 10, 2006.
Isaac Gang University of Mary Hardin-Baylor
ייצוג בעולם 3D ייצוג מצולעים (פוליגונים) צלע קודקוד צלעe0 : {v1,v2}
Last Time Liang-Barsky Details Weiler-Atherton clipping algorithm
Chapter 14 Shading Models.
Illumination Model 고려대학교 컴퓨터 그래픽스 연구실.
Illumination Model 고려대학교 컴퓨터 그래픽스 연구실.
Computer Graphics Shading in OpenGL
Shading in OpenGL Ed Angel Professor Emeritus of Computer Science
Presentation transcript:

Illumination and Shading Sang Il Park Sejong University

Review Illumination Model Shading Model

Review: Illumination Model An illumination model computes the lighting effects for a surface using the various optical properties Degree of transparency, color reflectance, surface texture The reflection (Phong illumination) model describes the way incident light reflects from an opaque surface Diffuse, ambient, specular reflections Simple approximation of actual physical models

Review: Diffuse Reflection Incident light is scattered with equal intensity in all directions Such surfaces are called ideal diffuse reflectors (also referred to as Lambertian reflectors)

Review: Diffuse Reflection : the intensity of the light source : diffuse reflection coefficient, : the surface normal (unit vector) : the direction of light source, (unit vector)

Review: Ambient Light Multiple reflection of nearby (light-reflecting) objects yields a uniform illumination A form of diffuse reflection independent of he viewing direction and the spatial orientation of a surface Ambient illumination is constant for an object : the incident ambient intensity : ambient reflection coefficient, the proportion reflected away from the surface

Review: Specular Reflection Perfect reflector (mirror) reflects all lights to the direction where angle of reflection is identical to the angle of incidence It accounts for the highlight Near total reflector reflects most of light over a range of positions close to the direction

Review: Specular Reflection Phong specular-reflection model Note that N, L, and R are coplanar, but V may not be coplanar to the others : intensity of the incident light : color-independent specular coefficient : the gloss of the surface

Review: Specular Reflection Specular-reflection coefficient ks is a material property For some material, ks varies depending on q ks =1 if q =90° Calcularing the reflection vector R

Polygon Rendering Methods We could use an illumination model to determine the surface intensity at every projected pixel position Or, we could apply the illumination model to a few selected points and approximate the intensity at the other surface positions Curved surfaces are often approximated by polygonal surfaces So, polygonal (piecewise planar) surfaces often need to be rendered as if they are smooth

Constant-Intensity Surface Rendering Constant (flat) shading Each polygon is one face of a polyhedron and is not a section of a curved-surface approximation mesh

Intensity-Interpolation Surface Rendering Gouraud shading Rendering a curved surface that is approximated with a polygon mesh Interpolate intensities at polygon vertices Procedure Determine the average unit normal vector at each vertex Apply an illumination model at each polygon vertex to obtain the light intensity at that position Linearly interpolate the vertex intensities over the projected area of the polygon

Intensity-Interpolation Surface Rendering Normal vectors at vertices Averaging the normal vectors for each polygon sharing that vertex 4 3 2 1 ) ( N v + =

Intensity-Interpolation Surface Rendering

Normal-Vector Interpolation Surface Rendering Phong shading Interpolate normal vectors at polygon vertices Procedure Determine the average unit normal vector at each vertex Linearly interpolate the vertex normals over the projected area of the polygon Apply an illumination model at positions along scan lines to calculate pixel intensities n1 n2 n3

Gouraud versus Phong Shading Gouraud shading is faster than Phong shading OpenGL supports Gouraud shading Phong shading is more accurate

코딩 연습 Phone Illumination Model을 직접 구현해 본다 (GL_LIGHTING 을 끈 상태로 직접 색을 계산하여 그려본다) 조명을 설정한다. (위치(lx,ly,lz) 및 Intensity) 도형의 색을 설정 (ka, kd, ks) 카메라의 위치 설정 (vx, vy, vz) 그리고 있는 삼각형의 Normal Vector 계산 Phong Model의 각각의 성분 계산 (ambient, diffuse, specular) 계산

OpenGL Lighting Functions Using Illumination/Shading Model: Turn on/off Lights glEnable (GL_LIGHTING); glEnable (GL_LIGHT0); glEnable (GL_LIGHT1); … glEnable (GL_LIGHT7); glDisable (GL_LIGHT0); glDisable (GL_LIGHT1); … glDisable (GL_LIGHT7);

OpenGL Lighting Functions glLight * (lightName,lightProperty, propertyValue) lightName: GL_LIGHT0, GL_LIGHT1, GL_LIGHT2, …., GL_LIGHT7

OpenGL Lighting Functions Point Light Source: GLfloat light1pos [] = {2.0, 0.0, 3.0, 1.0}; GLfloat light2pos [] = {0.0, 1.0, 0.0, 0.0}; glLightfv (GL_LIGHT0, GL_POSITION, light1pos); glEnable (GL_LIGHT0); glLightfv (GL_LIGHT1, GL_POSITION, light2pos); glEnable (GL_LIGHT1); Default value: GLfloat light0pos [] = {0.0, 0.0, 1.0, 0.0};

OpenGL Lighting Functions Point Light Source Colors: GLfloat ambientColor={0.0,0.0,0.0,1.0}; GLfloat diffuseColor={1.0,1.0,1.0,1.0}; GLfloat specularColor={1.0,1.0,1.0,1.0}; glLightfv (GL_LIGHT0, GL_AMBIENT, ambientColor); glLightfv (GL_LIGHT0, GL_DIFFUSE, diffuseColor); glLightfv (GL_LIGHT0, GL_SPECULAR, specularColor);

OpenGL Lighting Functions Point Light Source Attenuation: glLightf (GL_LIGHT0, GL_CONSTANT_ATTENUATION, 1.5); glLightf (GL_LIGHT0, GL_LINEAR_ATTENUATION, 0.75); glLightf (GL_LIGHT0, GL_QUADRATIC_ATTENUATION, 0.4);

OpenGL Lighting Functions Spot Light Source: Glfloat dirVector [] = {1.0, 0.0, 0.0}; glLightfv (GL_LIGHT0, GL_SPOT_DIRECTION, dirVector); glLightfv (GL_LIGHT0, GL_SPOT_CUTOFF, 3.0); glLightfv (GL_LIGHT0, GL_SPOT_EXPONENT, 2.5);

OpenGL Material Functions glMaterial * (surface, sufProperty, propertyValue) diffuseCoeff [] = {0.2,0.4,0.9,1.0}; specularCoeff [] ={1.0,1.0,1.0,1.0}; glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, diffuseCoeff}; glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, specularCoeff}; glMaterialf (GL_FRONT_AND_BACK, GL_SHININESS, 25.0};

Atmospheric Effects A hazy atmosphere makes colors fade and objects appear dimmer Hazy-atmosphere effect is often simulated with an exponential attenuation function such as Higher values for r produce a denser atmosphere