RENDERING Introduction to Shading models – Flat and Smooth shading – Adding texture to faces – Adding shadows of objects – Building a camera in a program.

Slides:



Advertisements
Similar presentations
Rendering Faces for Visual Realism Department of nskinfo i-education
Advertisements

1 Graphics CSCI 343, Fall 2013 Lecture 18 Lighting and Shading.
CS 480/680 Computer Graphics Shading 2 Dr. Frederick C Harris, Jr.
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 Chapter 9 Rendering. [9]-2RM Rendering Three dimensional object rendering is the set of collective processes which make the object.
1 MAE152 Computer Graphics for Scientists and Engineers Lighting in OpenGL.
Based on slides created by Edward Angel
1 Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009 Shading I.
University of New Mexico
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.
1 CSCE 641: Computer Graphics Lighting Jinxiang Chai.
Objectives Learn to shade objects so their images appear three- dimensional Learn to shade objects so their images appear three- dimensional Introduce.
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);
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.
Illumination.
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,
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.
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.
Chi-Cheng Lin, Winona State University CS430 Computer Graphics Lighting and Shading.
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,
Illumination and Shading How to shade surfaces based on the position,orientation,characteristics of the surfaces and the light sources illuminating them.
CSE 381 – Advanced Game Programming GLSL Lighting.
Chi-Cheng Lin, Winona State University CS430 Computer Graphics Lighting and Shading Part II.
Illumination.
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.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
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.
Specular Reflection Lecture 27 Mon, Nov 10, 2003.
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.
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.
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.
1 CSCE 441: Computer Graphics Lighting Jinxiang Chai.
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 고려대학교 컴퓨터 그래픽스 연구실.
Shading To determine the correct shades of color on the surface of graphical objects.
Computer Graphics Chapter 9 Rendering.
Open GL: Colors and Lighting
Shading in OpenGL Ed Angel
Lighting Phong's Lighting Model normals
Lighting and Materials
CS5500 Computer Graphics April 10, 2006.
Last Time Liang-Barsky Details Weiler-Atherton clipping algorithm
Presentation transcript:

RENDERING Introduction to Shading models – Flat and Smooth shading – Adding texture to faces – Adding shadows of objects – Building a camera in a program Creating shaded objects – Rendering texture – Drawing Shadows.

Introduction to Shading models Mechanism of light reflection – based on many factor geometric & characteristics of the surface Shading model : dictates how light is scattered or reflected from a surface –Focuses on achromatic light –brightness and no color (Gray) –single value its intensity

DEMO

ACHROMATIC LIGHT

Two types of light source point light sources Ambient Light

POINT LIGHT SOURCES

AMBIENT LIGHT

LIGHT INTERACTS WITH THE SURFACE Three different ways Some is absorbed by the surface and is converted to heat. Some is reflected from the surface Some is transmitted into the interior of the object

If all incident light is absorbed the object appears black and is known as a black body. If all of the incident light is transmitted the object is visible only through the effects of reflection. Some amount of the reflected light travels in the right direction to reach the eye causing the object to be seen.

The amount of light that reaches the eye depends on the orientation of the surface, light and the observer.

REFLECTION OF INCIDENT LIGHT Diffuse scattering Specular reflections

GEOMETRIC INGREDIENTS FOR FINDING REFLECTED LIGHT To compute the diffuse and specular components. –To find three components vectors ( s, m and v) –To find the amount of light that reaches the eye from a point P Important directions in computing the reflected light 1. The normal vector, m, to the surface at P. 2. The vector v from P to the viewer ‟ s eye. 3. The vector s from P to the light source.

How to Compute the Diffuse Component omnidirectional scattering Lambert’s law.

Specular Reflection Phong model plasticlike appearance shinny plastic or glass.

The Role of Ambient Light and Exploiting Human Perception To overcome the problem of totally dark shadows we imagine that a uniform background glow called ambient light exists in the environment. The ambient light source spreads in all directions uniformly. Too little ambient light makes shadows appear too deep and harsh., too much makes the picture look washed out and bland.

HOW TO COMBINE LIGHT CONTRIBUTIONS I = ambient + diffuse + specular I= I a ρ a + I d ρ d × lambert + I sp ρ s × phong f

TO ADD COLOR Colored light can be constructed by adding certain amounts of red, green and blue light. I r = I ar ρ ar + I dr ρ dr × lambert + I spr ρ sr × phong f I g = I ag ρ ag + I dg ρ dg × lambert + I spg ρ sg × phong f I b = I ab ρ ab + I db ρ db × lambert + I spb ρ sb × phong f

SHADING AND THE GRAPHICS PIPELINE

TO USE LIGHT SOURCES IN OPENGL Create a Light Source –eight sources : GL_LIGHT0, GL_LIGHT1… GLfloat myLightPosition[]={3.0, 6.0,5.0,1.0 }; glLightfv(GL_LIGHT0, GL-POSITION, myLightPosition); glEnable(GL_LIGHTING); //enable lighting in general glEnable(GL_LIGHT0); //enable source GL_LIGHT0

hold the colors emitted by light sources GLfloat amb0[]={ 0.2, 0.4, 0.6, 1.0 }; // define some colors GLfloat diff0[]= { 0.8,0.9, 0.5,1.0 }; GLfloat spec0[]= { 1.0, 0.8, 1.0, 1.0 }; glLightfv(GL_LIGHT0, GL_AMBIENT, amb0); //attach them to LIGHT0 glLightfv(GL_LIGHT0, GL_DIFFUSE, diff0); glLightfv(GL_LIGHT0, GL_SPECULAR, spec0); Colors are specified in RGBA format meaning red, green, blue and alpha. The alpha value is sometimes used for blending two colors on the screen.

SPOTLIGHTS glLightf(GL_LIGHT0, GL_SPOT_CUTOFF,45.0); //a cutoff angle 45degree glLightf(GL_LIGHT0, GL_SPOT_EXPONENT,4.0); //ε=4.0 GLfloat dir[]={2.0, 1.0, -4.0}; // the spotlight ‟ s direction glLightfv(GL_LIGHT0, GL_SPOT_DIRECTION,dir);

THE COLOR OF GLOBAL AMBIENT LIGHT GLfloat amb[]={ 0.2, 0.3, 0.1, 1.0}; glLightModelfv(GL_LIGHT_MODEL_AMBIENT,amb); Is the Viewpoint local or remote? glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, GL_TRUE); Are both sides of a Polygon Shaded Properly? glLightModeli (GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE);

Moving Light Sources Lights can be repositioned by suitable uses of glRotated() and glTranslated(). The array position, specified by using glLightfv(GL_LIGHT0,GL_POSITION,position) Sample

Working With Material Properties In OpenGL Shading of Scenes specified by SDL