CS 480/680 Computer Graphics Shading.

Slides:



Advertisements
Similar presentations
Computer Graphics - Shading -
Advertisements

OpenGL Course Notes Chapter 5: Lighting Jim Mims, Spring 2009.
1 Graphics CSCI 343, Fall 2013 Lecture 18 Lighting and Shading.
CAP 4703 Computer Graphic Methods Prof. Roy Levow Chapter 6.
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. 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.
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
IMGD 1001: Illumination by Mark Claypool
Lighting and Shading Wen-Chieh (Steve) Lin
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.
CS5500 Computer Graphics March 26, Shading Reference: Ed Angel’s book.
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Shading I Ed Angel Professor of Computer Science, Electrical and Computer Engineering,
Course Website: Computer Graphics 16: Illumination.
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.
Shading Surface can either (both) 1.Emit light. E.g. light bult 2.Reflect light. E.g. Mirror.
CS 480/680 Computer Graphics Shading I Dr. Frederick C Harris, Jr.
Illumination.
Fundamentals of Computer Graphics Part 6 Shading prof.ing.Václav Skala, CSc. University of West Bohemia Plzeň, Czech Republic ©2002 Prepared with Angel,E.:
CS 445 / 645: Introductory Computer Graphics
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
1 Shading I Shandong University Software College Instructor: Zhou Yuanfeng
Shading (introduction to rendering). Rendering  We know how to specify the geometry but how is the color calculated.
19/17/ :25 UML Graphics: Conceptual Model Real Object Human Eye Display Device Graphics System Synthetic Model Synthetic Camera Real Light Synthetic.
CSC418 Computer Graphics n Illumination n Lights n Lightinging models.
CS447/ Realistic Rendering -- Radiosity Methods-- Introduction to 2D and 3D Computer Graphics.
David Luebke 1 10/26/2015 Lighting CS 445/645 Introduction to Computer Graphics David Luebke, Spring 2003.
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.
Shading Chapter 6. CS 480/680 2Chapter 6 -- Shading Introduction: Introduction: We have learned to build three-dimensional models and to display them.
Illumination.
Computer Graphics: Programming, Problem Solving, and Visual Communication Steve Cunningham California State University Stanislaus and Grinnell College.
Illumination and Shading
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
Lecture Fall 2001 Illumination and Shading in OpenGL Light Sources Empirical Illumination Shading Transforming Normals Tong-Yee Lee.
Cornell CS465 Spring 2004 Lecture 4© 2004 Steve Marschner 1 Shading CS 465 Lecture 4.
1 CSCE 441: Computer Graphics Lighting Jinxiang Chai.
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.
Computer Graphics Lecture 25 Fasih ur Rehman. Last Class Shading.
CS552: Computer Graphics Lecture 33: Illumination and Shading.
1 CSCE 441: Computer Graphics Lighting Jinxiang Chai.
Computer Graphics Ken-Yi Lee National Taiwan University (the slides are adapted from Bing-Yi Chen and Yung-Yu Chuang)
Computer Graphics: Illumination
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.
Illumination : Hearn & Baker Ch. 10
7. Illumination Phong Illumination Diffuse, Specular and Ambient
Shading CS 465 Lecture 4 © 2004 Steve Marschner • 1.
© University of Wisconsin, CS559 Spring 2004
Shading To determine the correct shades of color on the surface of graphical objects.
CS 480/680 Computer Graphics Shading.
Unit-7 Lighting and Shading
CSC461: Lecture 23 Shading Computation
CSE 470 Introduction to Computer Graphics Arizona State University
Fundamentals of Computer Graphics Part 6 Shading
CS5500 Computer Graphics April 10, 2006.
Isaac Gang University of Mary Hardin-Baylor
CS5500 Computer Graphics May 29, 2006
Illumination and Shading
Advanced Computer Graphics
Lighting and Shading (I)
Illumination Model 고려대학교 컴퓨터 그래픽스 연구실.
CS 480/680 Computer Graphics Shading.
Lighting Calculations
Presentation transcript:

CS 480/680 Computer Graphics Shading

Introduction We have learned to build three-dimensional models and to display them. However, if you render one of our models, you might be disappointed to see images that look flat. This appearance is a consequence of our unnatural assumption that each surface is lit such that it appears to the viewer in a single color. We have left out the interaction between light and the surfaces in our models So, we will begin by developing models of light sources and the most common light-material interactions.

Introduction We then will investigate how we can apply shading to a polygonal model. We then discuss how light and material properties are specified in OpenGL and can be added to our sphere approximating program.

Why we need shading Suppose we build a model of a sphere using many polygons and color it with glColor. We get something like But we want

Shading Why does the image of a real sphere look like Light-material interactions cause each point to have a different color or shade Need to consider Light sources Material properties Location of viewer Surface orientation

Light and Matter From a physical perspective, a surface can either emit light by self-emission (as a light bulb does) or reflect light from other surfaces that illuminate it.

Scattering Light strikes A Some of scattered light strikes B Some scattered Some absorbed Some of scattered light strikes B Some of this scattered light strikes A and so on

Light and Matter The equation for solving this shading (infinite scattering and absorption of light) is called the rendering equation. This cannot be solved in general, so we use approximations. Radiosity and ray-tracing are approximations to this. Rendering equation is global and includes Shadows Multiple scattering from object to object

Light and Matter Unfortunately these approximations cannot yet be used to render scenes at the rate we can pass polygons through the modeling-projection pipeline. Therefore, we will focus on a simpler rendering model This model is based upon the Phong reflection model

Light and Matter To get an overview of the process, we can start following rays of light from a point-light-source

Global Effects shadow multiple reflection translucent surface

Local vs Global Rendering Correct shading requires a global calculation involving all objects and light sources Incompatible with pipeline model which shades each polygon independently (local rendering) However, in computer graphics, especially real time graphics, we are happy if things “look right” Exist many techniques for approximating global effects

Light-Material Interaction Light that strikes an object is partially absorbed and partially scattered (reflected) The amount reflected determines the color and brightness of the object A surface appears red under white light because the red component of the light is reflected and the rest is absorbed The reflected light is scattered in a manner that depends on the smoothness and orientation of the surface

Light and Matter In terms of Computer graphics, we replace the viewer with the projection plane Note that most rays leaving a source do not contribute to the image and are thus of no interest to us.

Light Sources General light sources are difficult to work with because we must integrate light coming from all points on the source

Simple Light Sources Point source Spotlight Ambient light Model with position and color Distant source = infinite distance away (parallel) Spotlight Restrict light from ideal point source Ambient light Same amount of light everywhere in scene Can model contribution of many sources and reflecting surfaces

Light and Matter The interaction between light and materials can be classified into three groups (a) specular (b) diffuse (c) translucent

Light and Matter Specular Surfaces Diffuse Surfaces appear shiny because most of the light that is reflected is reflected in a narrow range of angles close to the angle of reflection. Angle of Incidence is equal to the angle of reflection. Diffuse Surfaces reflected light is scattered in all directions. Translucent Surfaces allow some light to penetrate the surface and to emerge from another location on the object. Refraction

Color Sources Not only do light sources emit different amounts of light at different frequencies, but also their directional properties can very with frequency. Consequently, a physically correct model can be complex. However, since we our visual system is based upon three colors, for most applications, we can use each of the three colors to obtain what the human observer sees.

Ambient Light In some rooms, such as certain classrooms or kitchens, the lights have been designed and positioned to provide uniform illumination throughout the room. Often this is achieved with light sources that have diffusers whose purpose is to scatter light in all directions. Florescent lights have covers designed to do this.

Ambient Light Making such a model and rendering the scene with it would be a daunting task for a graphics system. Alternatively, we can look at the desired effect: to achieve a uniform light level in the room This uniform lighting is called Ambient Light.

Point Sources An ideal point source emits light equally in all directions. We can characterize a point light source by a three-component color matrix. The intensity of illumination received from a point source is proportional to the inverse square of the distance from the source to the surface.

Point Sources Scenes rendered with only point sources tend to have high contrast (objects appear either bright or dark) In the real world, it is the large size of most light sources that contributes to softer scenes. Umbra Penumbra

Spotlights spotlights are characterized by a narrow range of angles through which light is emitted. We can construct a spotlight from a point source by limiting the angles. For example, we can use a cone

More realistic spotlights are characterized by the distribution of light in the cone. Usually most of the light is concentrated at the center of the cone. The intensity is a function of the angle f As we will see throughout lighting, cosines are convenient functions for lighting calculations.

Distant Light Sources Most shading calculations require the direction from the point on the surface to the light source As we move across a surface, calculating the intensity at each point, we should recompute this vector repeatedly. This is very expensive and is a significant part of the shading calculation. However, if the light source is far from the surface, the vector does not change much

Distant Light Sources In this case, we are effectively replacing a point light source with a source that illuminates objects with parallel rays of light. Graphics systems can carry out rendering calculations more efficiently for distant light sources than for near ones. OpenGL allows both

The Phong Reflection Model Although we could approach light-material interactions through physical models, we have chosen to use a model that leads to efficient computations and to be a close enough approximation to physical reality to produce good renderings under a variety of lighting conditions and material properties.

Phong Model A simple model that can be computed rapidly Has three components Diffuse Specular Ambient Uses four vectors To source To viewer Normal Perfect reflector This is determined by n and l

Ideal Reflector Normal is determined by local orientation Angle of incidence = angle of relection The three vectors must be coplanar r = 2 (l · n ) n - l

Lambertian Surface Perfectly diffuse reflector Light scattered equally in all directions Amount of light reflected is proportional to the vertical component of incoming light reflected light ~cos qi cos qi = l · n if vectors normalized There are also three coefficients, kr, kb, kg that show how much of each color component is reflected

Specular Surfaces Most surfaces are neither ideal diffusers nor perfectly specular (ideal reflectors) Smooth surfaces show specular highlights due to incoming light being reflected in directions concentrated close to the direction of a perfect reflection specular highlight

Modeling Specular Relections Phong proposed using a term that dropped off as the angle between the viewer and the ideal reflection increased the angle f is the angle between r and the reflector v Ir ~ ks I cosaf shininess coef reflected intensity incoming intensity absorption coef

The Shininess Coefficient Values of a between 100 and 200 correspond to metals Values between 5 and 10 give surface that look like plastic cosa f -90 f 90