Lighting – Material Properties

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.
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 MAE152 Computer Graphics for Scientists and Engineers Lighting in OpenGL.
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.
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.
CS 4731: Computer Graphics Lecture 16: Illumination Models Part 2 Emmanuel Agu.
Foundations of Computer Graphics (Spring 2010) CS 184, Lecture 11: OpenGL 3
Shading in OpenGL Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico.
1 Lecture 10 Lighting in OpenGL. 2 Sources of light GLfloat myLightPosition[] = {3.0, 6.0, 5.0, 1.0}; GLLightfv(GL_LIGHT0, GL_POSITION, myLightPosition);
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.
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.
Color in OpenGL (Chapter 4) Presented by: Stacy C. Lovell.
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.
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.
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.
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.
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);
Project 5 Lamp Shader Fri, Nov 7, 2003 Due Mon, Nov 17, 2003.
RENDERING Introduction to Shading models – Flat and Smooth shading – Adding texture to faces – Adding shadows of objects – Building a camera in a program.
Specular Reflection Lecture 27 Mon, Nov 10, 2003.
Lighting and Shading Part 2. Global Ambient Light There are at least 8 OpenGL lights and 1 Global Ambient Setting the Global Ambient globalAmbient[] =
Lighting and Reflection Angel Angel: Interactive Computer Graphics5E © Addison-Wesley
Shading NOTE: Some of these slides are from Ed Angel’s presentation at SIGGRAPH February 27, 2008.
Computer Graphics Lecture 25 Fasih ur Rehman. Last Class Shading.
Illumination CSE 410. Basic steps of lighting Enable smooth shading Set global ambient light glShadeModel(GL_SMOOTH); glEnable(GL_NORMALIZE); GLfloat.
CS559: Computer Graphics Lecture 16: Shading and OpenGL Li Zhang Spring 2008.
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.
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.
Graphics Graphics Korea University kucg.korea.ac.kr 1 Lights & Material 고려대학교 컴퓨터 그래픽스 연구실.
CSC Graphics Programming
Shading To determine the correct shades of color on the surface of graphical objects.
Lecture 16: Shading and OpenGL Li Zhang Spring 2008
Illumination and Shading
@ 2017 by Jim X. Chen George Mason University
Shading in OpenGL Ed Angel
CSC461: Lecture 24 Lighting and Shading in OpenGL
Lighting Phong's Lighting Model normals
o عَلَّمَهُ الْبَيَانَ
Lighting and Materials
Lighting – Light Sources
CS5500 Computer Graphics April 10, 2006.
Color and Shading Lecture 9 Mon, Sep 26, 2005.
Computer Graphics 5Practical Lesson
ייצוג בעולם 3D ייצוג מצולעים (פוליגונים) צלע קודקוד צלעe0 : {v1,v2}
Lighting Calculations
Presentation transcript:

Lighting – Material Properties Lecture 13 Mon, Sep 24, 2007

Material Properties The surface “interacts” with the light as determined by the material properties: Reflection: ambient, diffuse, specular, shininess. Color: red, green, blue. Use the function glMaterial*() to specify the amount of red, green, and blue reflection of each type.

Example // A shiny red object float mat_ambient[] = {1.0, 0.0, 0.0, 1.0}; float mat_diffuse[] = {1.0, 0.0, 0.0, 1.0}; float mat_specular[] = {1.0, 1.0, 1.0, 1.0}; float mat_shininess = 64.0; glMaterialfv(GL_FRONT, GL_AMBIENT, mat_ambient); glMaterialfv(GL_FRONT, GL_DIFFUSE, mat_diffuse); glMaterialfv(GL_FRONT, GL_SPECULAR, mat_specular); glMaterialf(GL_FRONT, GL_SHININESS, mat_shininess);

Material Properties Usually we use The ambient and diffuse material properties to determine the color and brightness of the object. The specular material properties to determine the shininess of the object.

glEnable(GL_COLOR_MATERIAL) Material Properties OpenGL allows the programmer to make an automatic connection between the glColor() function and the material color. glEnable(GL_COLOR_MATERIAL) The default sets the material ambient and diffuse reflections to the values given in glColor().

Material Properties Use glColorMaterial() to specify which material property will track the current color. GL_AMBIENT GL_DIFFUSE GL_SPECULAR GL_AMBIENT_AND_DIFFUSE (default) Only one mode is active at a time.

Material Properties Typically, we want only ambient and diffuse properties to track the current color. Specular material properties are usually set to (1.0, 1.0, 1.0) regardless of the surface color.

Material Properties Read Run

Material Emissive Light In a similar way, we can set the amount of emissive light emitted by an object. The following code will make an object glow a bit reddish. float mat_emissive[] = {0.5, 0.0, 0.0, 1.0}; glMaterialfv(GL_FRONT, GL_EMISSION, mat_emissive);

Material Emissive Red Light Read Run

Viewer Location The viewer can be either local or at infinity. The default is at infinity. This setting can be changed by using glLightModel*(). glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, GL_TRUE);

Infinite Viewer Read Run

Local Viewer Read Run

A Metallic Effect Read Run

Calculating the Lighting Effect The light contributions for each color (red, green, and blue) are summed over All light sources (LIGHT0, …, LIGHT8) All types of light (ambient, diffuse, specular, emissive). Each total is clamped to 1.0. These color levels determine the shading of the vertex.

Lighting and Meshes The lighting effects are calculated only at the vertices, then interpolated across the polygon. Suppose the brightest point of reflection should be in the center of a square. The center will have an interpolated shading derived from the corners; the center will be no brighter than the corners.

Lighting and Meshes Rather than use one large rectangle, with only 4 vertices, it is better to use a mesh of smaller rectangles, with many vertices. The lighting will be calculated at each vertex and interpolated across a small rectangle.

Lighting and Meshes Read Run