Last Time Liang-Barsky Details Weiler-Atherton clipping algorithm

Slides:



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

2 COEN Computer Graphics I Evening’s Goals n Discuss the fundamentals of lighting in computer graphics n Analyze OpenGL’s lighting model n Show.
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.
Based on slides created by Edward Angel
1 Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009 Shading I.
Computer Graphics - Class 10
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.
CS5500 Computer Graphics March 26, Shading Reference: Ed Angel’s book.
Illumination and Shading
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.
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.
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.
CS 481 Preview, Some Lighting Details Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Wednesday, November 19, 2003.
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.
Rendering Overview CSE 3541 Matt Boggus. Rendering Algorithmically generating a 2D image from 3D models Raster graphics.
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Shading I Ed Angel Professor of Computer Science, Electrical and Computer Engineering,
CSE 381 – Advanced Game Programming GLSL Lighting.
Lighting Review & Example Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Monday, November 17, 2003.
Computer Graphics: Programming, Problem Solving, and Visual Communication Steve Cunningham California State University Stanislaus and Grinnell College.
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.
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.
Lecture Fall 2001 Illumination and Shading in OpenGL Light Sources Empirical Illumination Shading Transforming Normals Tong-Yee Lee.
11/5/2002 (c) University of Wisconsin, CS 559 Last Time Local Shading –Diffuse term –Specular term –All together –OpenGL brief overview.
Illumination and Shading Prof. Lizhuang Ma Shanghai Jiao Tong University.
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.
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 Ken-Yi Lee National Taiwan University (the slides are adapted from Bing-Yi Chen and Yung-Yu Chuang)
03/19/2002(c) University of Wisconsin, CS 559 Last Time BSP Tree rendering and exact visibility in mazes Local Shading –Diffuse term –Specular term.
Recap Last lecture we looked at local shading models –Diffuse and Phong specular terms –Flat and smooth shading Some things were glossed over –Light source.
Illumination Models and Surface-Rendering Methods CEng 477 Introduction to Computer Graphics.
Illumination and Shading Prof. Lizhuang Ma Shanghai Jiao Tong University.
Chapter 5. Lighting Computer Graphics (spring, 2009) School of Computer Science University of Seoul.
Computer Graphics (fall,2010) School of Computer Science University of Seoul Minho Kim.
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.
Graphics Graphics Korea University kucg.korea.ac.kr 1 Lights & Material 고려대학교 컴퓨터 그래픽스 연구실.
© University of Wisconsin, CS559 Spring 2004
Shading To determine the correct shades of color on the surface of graphical objects.
© University of Wisconsin, CS559 Spring 2004
School of Computer Science
Vectors, Normals, & Shading
Shading in OpenGL Ed Angel
Lighting Phong's Lighting Model normals
Illumination and Shading
Lighting and Materials
Lighting – Light Sources
CS5500 Computer Graphics April 10, 2006.
Computer Graphics 4Practical Lesson
Illumination and Shading
Computer Graphics 5Practical Lesson
ייצוג בעולם 3D ייצוג מצולעים (פוליגונים) צלע קודקוד צלעe0 : {v1,v2}
Computer Graphics (Fall 2003)
CS 480/680 Computer Graphics Shading.
Computer Graphics Shading in OpenGL
Shading in OpenGL Ed Angel Professor Emeritus of Computer Science
Presentation transcript:

Last Time Liang-Barsky Details Weiler-Atherton clipping algorithm Visibility Z-Buffer and transparency A-buffer Area subdivision BSP Trees Exact Cell-Portal Local Lighting model Diffuse illumination Specular illumination Ambient illumination 10/27/09 © NTUST

This Week Midterm Light sources Shading Interpolation Point Directional Spotlights Shading Interpolation Mapping Techniques Project 2 is posted and due at Nov 18 10/27/09 © NTUST

Distant Light Approximation Assume L is constant for all x Good approximation if light is distant, such as sun Generally called a directional light source What aspects of surface appearance are affected by this approximation? Diffuse? Specular? 10/27/09 © NTUST

Local Viewer Approximation Specularities require the viewing direction: V(x) = ||c-x|| Slightly expensive to compute Local viewer approximation uses a global V Independent of which point is being lit Use the view plane normal vector Error depends on the nature of the scene Is the diffuse component affected? 10/27/09 © NTUST

Describing Surfaces The various parameters in the lighting equation describe the appearance of a surface (kd,r,kd,g,kd,b): The diffuse color, which most closely maps to what you would consider the “color” of a surface Also called diffuse reflectance coefficients (ks,r,ks,g,ks,b): The specular color, which controls the color of specularities The same as the diffuse color for metals, white for plastics Some systems do not let you specify this color separately (ka,r,ka,g,ka,b): The ambient color, which controls how the surface looks when not directly lit Normally the same as the diffuse color 10/27/09 © NTUST

OpenGL Model Allows emission, E: Light being emitted by surface Allows separate light intensity for diffuse and specular Ambient light can be associated with light sources Allows spotlights that have intensity that depends on outgoing light direction Allows attenuation of light intensity with distance Can specify coefficients in multiple ways Too many variables and commands to present in class The OpenGL programming guide goes through it all (the red book) 10/27/09 © NTUST

OpenGL Commands (1) glMaterial{if}(face, parameter, value) Changes one of the coefficients for the front or back side of a face (or both sides) glLight{if}(light, property, value) Changes one of the properties of a light (intensities, positions, directions, etc) There are 8 lights: GL_LIGHT0, GL_LIGHT1, … glLightModel{if}(property, value) Changes one of the global light model properties (global ambient light, for instance) glEnable(GL_LIGHT0) enables GL_LIGHT0 You must enable lights before they contribute to the image You can enable and disable lights at any time 10/27/09 © NTUST

OpenGL Commands (2) glColorMaterial(face, mode) Causes a material property, such as diffuse color, to track the current glColor() Speeds things up, and makes coding easier glEnable(GL_LIGHTING) turns on lighting You must enable lighting explicitly – it is off by default Don’t use specular intensity if you don’t have to It’s expensive - turn it off by giving 0,0,0 as specular color of the lights Don’t forget normals If you use scaling transformations, must enable GL_NORMALIZE to keep normal vectors of unit length Many other things to control appearance 10/27/09 © NTUST

Light Sources Two aspects of light sources are important for a local shading model: Where is the light coming from (the L vector)? How much light is coming (the I values)? Various light source types give different answers to the above questions: Point light source: Light from a specific point Directional: Light from a specific direction Spotlight: Light from a specific point with intensity that depends on the direction Area light: Light from a continuum of points (later in the course) 10/27/09 © NTUST

Point and Directional Sources Point light: The L vector depends on where the surface point is located Must be normalized - slightly expensive To specify an OpenGL light at 1,1,1: Directional light: L(x) = Llight The L vector does not change over points in the world OpenGL light traveling in direction 1,1,1 (L is in opposite direction): Glfloat light_position[] = { 1.0, 1.0, 1.0, 1.0 }; glLightfv(GL_LIGHT0, GL_POSITION, light_position); Glfloat light_position[] = { 1.0, 1.0, 1.0, 0.0 }; glLightfv(GL_LIGHT0, GL_POSITION, light_position); 10/27/09 © NTUST

Spotlights Point source, but intensity depends on L: cut-off Point source, but intensity depends on L: Requires a position: the location of the source Requires a direction: the center axis of the light Requires a cut-off: how broad the beam is Requires and exponent: how the light tapers off at the edges of the cone Intensity scaled by (L·D)n direction glLightfv(GL_LIGHT0, GL_POSITION, light_posn); glLightfv(GL_LIGHT0, GL_SPOT_DIRECTION, light_dir); glLightfv(GL_LIGHT0, GL_SPOT_CUTOFF, 45.0); glLightfv(GL_LIGHT0, GL_SPOT_EXPONENT, 1.0); 10/27/09 © NTUST

Shading so Far So far, we have discussed illuminating a single point We have assumed that we know: The point The surface normal The viewer location (or direction) The light location (or direction) But commonly, normal vectors are only given at the vertices It is also expensive to compute lighting for every point 10/27/09 © NTUST

Shading Interpolation Take information specified or computed at the vertices, and somehow propagate it across the polygon (triangle) Several options: Flat shading Gouraud interpolation Phong interpolation 10/27/09 © NTUST