Graphics Graphics Korea University kucg.korea.ac.kr 1 Lights & Material 고려대학교 컴퓨터 그래픽스 연구실.

Slides:



Advertisements
Similar presentations
Polygon Rendering Flat Rendering Goraud Rendering Uses Phong Reflectance Phong Rendering.
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.
Graphics Graphics Korea University cgvr.korea.ac.kr Illumination Model 고려대학교 컴퓨터 그래픽스 연구실.
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.
Shading in OpenGL Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico.
Normals Specifying the normal –void glNormal3d( GLdouble nx, GLdouble ny, GLdouble nz ); When using lighting effects, normals must be defined for each.
Now Playing: Multiply Jamie Lidell from Multiply Released June 13, 2005.
CS5500 Computer Graphics March 26, Shading Reference: Ed Angel’s book.
Computer Graphics (Spring 2008) COMS 4160, Lecture 14: OpenGL 3
CS425 OpenGL Materials. What Color Is It? green & blue absorbed white light Looks red.
Illumination and Shading
Lighting & Material. Example 1/5 #include ” glut.h ” void display(); void reshape(int, int); void lighting(); int main(int argc, char** argv) { glutInit(&argc,
Illumination and Shading. Illumination (Lighting) Model the interaction of light with surface points to determine their final color and brightness OpenGL.
Computer Graphics Lighting.
1 Graphics CSCI 343, Fall 2013 Lecture 20 Lighting and Shading III.
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Chapter 6: Shading Ed Angel Professor of Computer Science, Electrical and Computer Engineering,
Illumination & Reflectance Dr. Amy Zhang. Outline 2  Illumination and Reflectance  The Phong Reflectance Model  Shading in OpenGL.
Shading in OpenGL.
1 Chapter 6 Shading. 2 Objectives Learn to shade objects so their images appear three-dimensional Introduce the types of light-material interactions Build.
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.
CSC418 Computer Graphics n Illumination n Lights n Lightinging models.
Computer Graphics I, Fall 2010 Shading in OpenGL.
Lecture 9: Lighting and Shading 1  Principles of Interactive Graphics  CMSCD2012  Dr David England, Room 718,  ex 2271
Lecture 14 Shading models 1.Shading Constant Shading (to be implemented) Gouraud Shading Phong Shading 2.Light and shading with OpenGL 1.
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Shading I Ed Angel Professor of Computer Science, Electrical and Computer Engineering,
Chi-Cheng Lin, Winona State University CS430 Computer Graphics Lighting and Shading Part II.
OpenGL Color and Lighting 2003 Spring Keng Shih-Ling.
Lighting Review & Example Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Monday, November 17, 2003.
OpenGL Lighting Jian-Liang Lin 2002 Hidden-Surface Removal -1 Original Code: while (1) { get_viewing_point_from_mouse_position(); glClear(GL_COLOR_BUFFER_BIT);
11/04/04© University of Wisconsin, CS559 Fall 2004 Last Time Visibility –Z-Buffer and transparency –A-buffer –Area subdivision –BSP Trees –Exact Cell-Portal.
COMPUTER GRAPHICS Hochiminh city University of Technology Faculty of Computer Science and Engineering CHAPTER 6: Lighting and 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.
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.
Lighting Dave Shreiner. 2 Lighting Principles Lighting simulates how objects reflect light Lighting simulates how objects reflect light material composition.
Shading NOTE: Some of these slides are from Ed Angel’s presentation at SIGGRAPH February 27, 2008.
Illumination CSE 410. Basic steps of lighting Enable smooth shading Set global ambient light glShadeModel(GL_SMOOTH); glEnable(GL_NORMALIZE); GLfloat.
CS552: Computer Graphics Lecture 33: Illumination and Shading.
1 CSCE 441: Computer Graphics Lighting Jinxiang Chai.
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.
1 Dr. Scott Schaefer Lighting. 2/49 Lighting/Illumination Color is a function of how light reflects from surfaces to the eye Global illumination accounts.
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.
CSC Graphics Programming
© University of Wisconsin, CS559 Spring 2004
Shading To determine the correct shades of color on the surface of graphical objects.
Illumination and Shading
@ 2017 by Jim X. Chen George Mason University
Open GL: Colors and Lighting
Shading in OpenGL Ed Angel
CSC461: Lecture 24 Lighting and Shading in OpenGL
Lighting Phong's Lighting Model normals
Illumination and Shading
Lighting and Materials
Lighting – Light Sources
CS5500 Computer Graphics April 10, 2006.
Lighting – Material Properties
3D Graphics with OpenGL CSCE 458 Fall 2004
Last Time Liang-Barsky Details Weiler-Atherton clipping algorithm
Presentation transcript:

Graphics Graphics Korea University kucg.korea.ac.kr 1 Lights & Material 고려대학교 컴퓨터 그래픽스 연구실

KUCG Graphics Korea University kucg.korea.ac.kr 2 Contents Phone reflection model Diffuse, specular, and ambient reflections OpenGL lighting Specifying a light source Point, distant, and spot lights Specifying a material Exercise

KUCG Graphics Korea University kucg.korea.ac.kr 3 DrawScene( ) – WireTeapot

KUCG Graphics Korea University kucg.korea.ac.kr 4 Wired Utah Teapot

KUCG Graphics Korea University kucg.korea.ac.kr 5 Phong Reflection Model Simple analytic model: Diffuse reflection + Specular reflection + Emission + “Ambient”

KUCG Graphics Korea University kucg.korea.ac.kr 6 Diffuse Reflection (1/3) Assume surface reflects equally in all directions Examples: chalk, clay

KUCG Graphics Korea University kucg.korea.ac.kr 7 Diffuse Reflection (2/3) How much light is reflected? Depends on angle of incident light dL  dA  cos 

KUCG Graphics Korea University kucg.korea.ac.kr 8 Diffuse Reflection (3/3) Lambertian model Cosine law (dot product)

KUCG Graphics Korea University kucg.korea.ac.kr 9 Specular Reflection (1/3) Reflection is strongest near mirror angle Examples: mirrors, metals

KUCG Graphics Korea University kucg.korea.ac.kr 10 Specular Reflection (2/3) How much light is seen? Depends on angle of incident light and angle to viewer

KUCG Graphics Korea University kucg.korea.ac.kr 11 Specular Reflection (3/3) Phong model {cos(  )} n

KUCG Graphics Korea University kucg.korea.ac.kr 12 Emission Represents light emitting directly from polygon Emission ≠ 0

KUCG Graphics Korea University kucg.korea.ac.kr 13 Ambient Term Represents reflection of all indirect illumination This is a total hack (avoids complexity of global illumination)!

KUCG Graphics Korea University kucg.korea.ac.kr 14 OpenGL Lighting Must enable “lighting calculation” and each “light source” All colors will be assigned based on light sources and material properties not by glColor*( ) glEnable(GL_LIGHTING); glEnable(GL_LIGHT0); glEnable(GL_LIGHTING); glEnable(GL_LIGHT0);

KUCG Graphics Korea University kucg.korea.ac.kr 15 DrawScene( ) – SolidTeapot

KUCG Graphics Korea University kucg.korea.ac.kr 16 Solid Utah Teapot

KUCG Graphics Korea University kucg.korea.ac.kr 17 Enable Lighting (1/3)

KUCG Graphics Korea University kucg.korea.ac.kr 18 Enable Lighting (2/3)

KUCG Graphics Korea University kucg.korea.ac.kr 19 Specifying a Light Source (1/2) Defaults for “glEnable(GL_LIGHT0)” No ambient light Diffuse and specular component – white (1.0, 1.0, 1.0, 1.0) Cf) Other lights – black (0.0, 0.0, 0.0, 1.0) Position – (0.0, 0.0, 1.0, 0.0)  distant light

KUCG Graphics Korea University kucg.korea.ac.kr 20 Specifying a Light Source (2/2) Create a light source light GL_LIGHT0, GL_LIGHT1, … param GL_POSITION, GL_DIFFUSE, GL_SPECLAR, GL_AMBIENT glLight{if}(GLenum light, GLenum param, TYPE value); glLight{if}v(GLenum light, GLenum param, TYPE *value); glLight{if}(GLenum light, GLenum param, TYPE value); glLight{if}v(GLenum light, GLenum param, TYPE *value);

KUCG Graphics Korea University kucg.korea.ac.kr 21 Light Sources Distant light GL_POSITION, GL_DIFFUSE, GL_SPECULAR, GL_AMBIENT Point light GL_CONSTANT_ATTENUATION, GL_LINEAR_ATTENUATION, GL_QUADRATIC_ATTENUATION Spot light GL_SPOT_DIRECTION, GL_SPOT_CUTOFF, GL_SPOT_EXPONENT

KUCG Graphics Korea University kucg.korea.ac.kr 22 Point Light Source (1/2)

KUCG Graphics Korea University kucg.korea.ac.kr 23 Point Light Source (2/2)

KUCG Graphics Korea University kucg.korea.ac.kr 24 Control of Light Position (1/4)

KUCG Graphics Korea University kucg.korea.ac.kr 25 Control of Light Position (2/4)

KUCG Graphics Korea University kucg.korea.ac.kr 26 Control of Light Position (3/4)

KUCG Graphics Korea University kucg.korea.ac.kr 27 Control of Light Position (4/4)

KUCG Graphics Korea University kucg.korea.ac.kr 28 Specifying All Terms (1/2)

KUCG Graphics Korea University kucg.korea.ac.kr 29 Specifying All Terms (2/2)

KUCG Graphics Korea University kucg.korea.ac.kr 30 Point Light – Attenuation (1/2)

KUCG Graphics Korea University kucg.korea.ac.kr 31 Point Light – Attenuation (2/2)

KUCG Graphics Korea University kucg.korea.ac.kr 32 Spot Light (1/4)

KUCG Graphics Korea University kucg.korea.ac.kr 33 Spot Light (2/4)

KUCG Graphics Korea University kucg.korea.ac.kr 34 Spot Light (3/4)

KUCG Graphics Korea University kucg.korea.ac.kr 35 Spot Light (4/4)

KUCG Graphics Korea University kucg.korea.ac.kr 36 Multiple Lights (1/2)

KUCG Graphics Korea University kucg.korea.ac.kr 37 Multiple Lights (2/2)

KUCG Graphics Korea University kucg.korea.ac.kr 38 Specifying a Material (1/5) Reflectivity properties of a material face GL_FRONT, GL_BACK, GL_FRONT_AND_BACK name GL_DIFFUSE, GL_SPECLAR, GL_AMBIENT, GL_AMBIENT_AND_DIFFUSE, GL_EMISSION, GL_SHININESS glMaterial{if}(GLenum face, GLenum name, TYPE value); glMaterial{if}v(GLenum face, GLenum name, TYPE *value); glMaterial{if}(GLenum face, GLenum name, TYPE value); glMaterial{if}v(GLenum face, GLenum name, TYPE *value);

KUCG Graphics Korea University kucg.korea.ac.kr 39 Specifying a Material (2/5)

KUCG Graphics Korea University kucg.korea.ac.kr 40 Specifying a Material (3/5)

KUCG Graphics Korea University kucg.korea.ac.kr 41 Specifying a Material (4/5)

KUCG Graphics Korea University kucg.korea.ac.kr 42 Specifying a Material (5/5)

KUCG Graphics Korea University kucg.korea.ac.kr 43 White Shiny Material (1/2)

KUCG Graphics Korea University kucg.korea.ac.kr 44 White Shiny Material (2/2)

KUCG Graphics Korea University kucg.korea.ac.kr 45 Brass Material (1/2)

KUCG Graphics Korea University kucg.korea.ac.kr 46 Brass Material (2/2)

KUCG Graphics Korea University kucg.korea.ac.kr 47 Red Plastic Material (1/2)

KUCG Graphics Korea University kucg.korea.ac.kr 48 Red Plastic Material (2/2)

KUCG Graphics Korea University kucg.korea.ac.kr 49 Multiple Objects (1/2)

KUCG Graphics Korea University kucg.korea.ac.kr 50 Multiple Objects (2/2)

KUCG Graphics Korea University kucg.korea.ac.kr 51 Exercise Create yours!! color plate 25