Illumination and Shading ECE 567

Size: px
Start display at page:

Download "Illumination and Shading ECE 567"

Transcription

1 Illumination and Shading ECE 567

2 Overview Lighting Models Ambient light Diffuse light Specular light Shading Models Flat shading Gouraud shading Phong shading OpenGL 2

3 Introduction To add realism to drawings of 3D scenes need to simulate the lighting of the surfaces in the scene To examine ways to determine how light reflects or scatters from object surfaces surfaces are shaded based on the position, orientation, and characteristics of the surfaces Position and orientation of the light sources 3

4 How to shade surfaces Illumination models express the factors determining a surface s color at given point. consists of equation for light reflected from all points on object Shading model attempts to model how light that emanates from light sources would interact with objects in a scene some shading models invoke an illumination model for every pixel in the image others invoke an illumination model for only some pixels and shade the remaining pixels by interpolation. 4

5 How to shade surfaces cont. When light sources shine on various surfaces of the objects, and the incident light interacts with the surface in three different ways: 1. Some is absorbed by the surface and is converted to heat 2. Some is reflected from the surface 3. Some is transmitted into the interior of the object, as in the case of a piece of glass 5

6 Definition Illumination the transport luminous flux (energy) from light sources between points via direct and indirect paths Lighting the process of computing the luminous intensity reflected from a specified 3-D 3 D point Shading the process of assigning a colors to a pixels 6

7 Illumination Models Empirical simple formulations that approximate observed phenomenon a model that looks good enough for application and can be calculated efficiently with the resources that are available Physically-based models based on the actual physics of light's interactions with matter takes a long time to compute illumination 7

8 Components of Illumination Light Sources Emittance Spectrum color of the light Geometry position and direction Directional Attenuation Surface Properties Reflectance Spectrum color of the surface Geometry position, orientation, and micro-structure Absorption 8

9 Simplifications Most computer graphics systems apply simplifications Only the direct illumination from the emitters to the reflectors of the scene Ignore the geometry of light emitters, and consider only the geometry of reflectors 9

10 Light Sources Point Light Sources Light bulb Directional Light Sources Sun 10

11 Point Light Sources rays emitted from a point light radially diverge from the source. rays emit uniformly in all direction. A point light source for a scene defined by giving its position and the color of the emitted light A point light source is a fair approximation to a local light source such as a light bulb. p 11

12 Point Light Sources Cont. The direction of the light to each point on a surface changes when a point light source is used. p l The object s brightness varies from one part to another depends on the direction of and distance to the light sources a normalized vector to the light emitter is computed for each point that is illuminated d = Intensity attenuates in proportion to distance from source p l p l 12

13 Directional Light Sources All of the rays from a directional light source have a common direction no point of origin. Directional light source has parallel rays the light source was infinitely far away from the surface that it is illuminating. Sunlight is an example of an infinite light source. 13

14 Directional Light Sources Cont. The direction from a surface to a light source is important for computing the light reflected from the surface. Attenuation proportional to cosine of angle between normal and light direction No attenuation based on distance from source since energy does not spread out. With a directional light source this direction is a constant for every surface. A directional light source can be colored. 14

15 Other Light Sources Spotlights Point source whose intensity falls off away from a given direction Requires a color, a point, a direction, parameters that control the rate of fall off Area Light Sources Light source occupies a 2-D 2 D area (usually a polygon or disk) Generates soft shadows Example: fluorescent light panels Extended Light Sources Spherical Light Source Generates soft shadows 15

16 Lighting Models The light incident on a surface and exiting from a surface is measured in specific terms Ambient Lambert/Diffuse Angle between surface normal and light Phong/Specular Surface normal, light, and viewpoint 16

17 Ambient Light Even though an object in a scene is not directly lit it will still be visible. because light is reflected indirectly from nearby objects. ambient light source is commonly used to model this indirect illumination. ambient light has no spatial or directional characteristics (independent of the object's position or orientation) the amount of ambient light incident on each object is a constant for all surfaces in the scene. ambient light can have a color. 17

18 Ambient Light Cont. Ambient light is model as following: reflected is the resulting intensity ambient is the intensity of the ambient light assume to be constant for all objects ambient is the ambient-reflection coefficient ranges from 0 to 1 k ambient is a material property characterizing the material from which the surface is made (surface property) I reflected I ambient k ambient I = k reflected ambient I ambient 18

19 Ambient Light Cont. Exists in most environments Some light hits surface from all directions An approximation of indirect light/global illumination A scene with an ambient light source: 19

20 Point Light Sources Cont. Using an ambient and a point light source: 20

21 Directional Light Sources Cont. The same scene with a directional and an ambient light source 21

22 Types of reflection Two types of reflection of incident light: Diffuse reflections some of the incident light penetrates the surface slightly re-radiated radiated uniformly in all directions Specular reflections incident light does not penetrate the object reflected directly from its outer surface highly directional More mirror like 22

23 Types of reflection Cont. Most surfaces produce some combination of the two types of reflection depends on the characteristics of the surfaces roughness type of material from which the surface is made. 23

24 Diffuse Reflection Object s brightness only depends on: direction of light source distance from light source when light falls from a point source onto one side of a facet (a small piece of a surface). a fraction of light is reradiated diffusely in all directions from that side. the surfaces appear equally bright from all viewing angles the surfaces reflect light with equal intensity in all directions incident intensity proportional to cosine of incident angle 24

25 Diffuse Reflection Cont. Ideal diffuse reflection An ideal diffuse surface at the microscopic level a very rough surface. Chalk is a good approximation to an ideal diffuse surface. Because the microscopic variations in the surface, an incoming ray of light is equally likely to be reflected in any direction over the hemisphere. A surface that is oriented nearly perpendicular to the illumination ion direction receives more light from the source than a surface that t is tilted at an oblique angle to the direction of the of incoming lightl 25

26 Lambert's Cosine law Lambert's law states that the reflected energy from a small surface area in a particular direction is proportional to cosine of the angle between that direction and the surface normal. 26

27 Lambert's Cosine law cont. Ideal diffuse reflectors (Lambertian( reflectors) reflect light according to Lambert's cosine law Lambert's law determines how much of the incoming light energy is reflected. the amount energy that is reflected in any one direction is constant in this model. the reflected intensity is independent of the viewing direction. the intensity depends on the light source's orientation relative to the surface 27

28 Lambert's Cosine law cont. The angle between the surface normal and the incoming light ray is called the angle of incidence an intensity of the light can be expressed in terms of this angle In practice, vector analysis was used to compute cosine term indirectly. the normal vector and the incoming light vector are normalized (unit length) diffuse shading can be computed as follows: r r I = k I ( n l ) diffuse d light 28

29 Lambert's Cosine law cont. The I light represents the intensity of the incoming light at the particular wavelength the wavelength determines the light's color The k d represents the diffuse reflectivity of the surface at that wavelength. Diffuse-reflection coefficient To determines the fraction of the incident light that is to be scattered as diffuse reflections A constant value between 0 and 1 A highly reflective surface has a value near 1 To simulate a surface that absorbs most of the incident light, k d is set to a value near 0 Varies from on material to another wood has a higher k d 29

30 Diffuse Lighting Examples A Lambertian sphere seen at several different lighting angles: These spheres illustrate the diffuse-reflection model as I light =1.0 and k d = 0.4,0.55,0.7,0.85,1.0 30

31 Ambient and Diffuse Lighting These spheres illustrate the ambient and diffuse-reflection model as I ambient = I light =1.0 and k d = 0.4, k a = 0.0, 0.15, 0.3, 0.45,

32 Distance Attenuation If two surfaces with the same optical parameters project to overlapping positions, they would be indistinguishable from one another N N 32

33 Distance Attenuation Cont. As radiant energy from a light source travels outwards through space, its amplitude at any distance d light from the source is attenuated: 1 f = att 2 d light d light, is the distance the light travels from the point light source to the surface Meaning A surface close to the light source receives a higher incident light intensity from that source that a more distant surface 33

34 Distance Attenuation Cont. To produce realistic lighting effects, the intensity attenuation need take into account. f att models distance from light I diffuse = f att k d I light ( n l) 34

35 Distance Attenuation Cont. Simplification f att 1 = min( 2 c + c d + c d 1 2 light 2 light c 1, c 2 and c 3 are user-defined constants associated with the light source c 1 prevents blowup due to very close light sources c 2 models linear falloff due to large area light sources c 3 models quadratic falloff due to small, bright sources min prevents f att (d light ) from becoming greater than 1,1) 35

36 Specular Reflection A second surface type is called a specular reflector. Specular reflection can be observed on any shiny surface Light reflected unequally in different directions Example: highlight on an apple Specular reflection is view dependent. Real objects do not scatter light uniformly in all directions By looking at a shiny surface (polished metal or a glossy car finish) a highlight, or bright spot can be seen bright spot appears on the surface is a function of where the surface is seen from. 36

37 Specular Reflection Cont. At the microscopic level a specular reflecting surface is very smooth these microscopic surface elements are oriented in the same direction as the surface itself. Specular reflection is merely the mirror reflection of the light source in a surface. it is viewer dependent if you stood in front of a mirror and placed your finger over the reflection of a light, you would expect that you could reposition your head to look around your finger and see the light again. An ideal mirror is a purely specular reflector. 37

38 Specular Reflection Cont. This model is NOT physically-based does Not attempt to accurately calculate global illumination It does attempt to simulate some of the most important observable effects of common light interactions It can be computed quickly and efficiently still in use today in graphics software and especially in hardware renders N^ ^ L^ R θ θ V ^ φ 38

39 Snell's Law In order to model specular reflection we need to understand the physics of reflection. Reflection behaves according to Snell's laws which state: The incoming ray, the surface normal, and the reflected ray all lie in a common plane. The angle that the reflected ray forms with the surface normal is i determined by the angle that the incoming ray forms with the surface normal, the relative speeds of light of the mediums in which the incident and reflected rays propagate according to the following expression. n l sin θ = l n r sinθ r 39

40 Non-ideal Reflectors Specular Reflection is a very special case of Snell's Law incident light's medium and the reflected rays medium is the same. simplify the expression θ = θ l r Snell's law applies only to ideal mirror reflectors. Real materials, other than mirrors and chrome tend to deviate significantly from ideal reflectors. For example: apple is a nonperfect reflectors 40

41 Non-ideal Reflectors Cont. An empirical model (a crude approximation) is introduced most of the reflected light to travel in the direction of the ideal ray. some of the light to be reflected just slightly offset from the ideal reflected ray (microscopic surface variations) as move farther and farther, in the angular sense, from the reflected ected ray, it expects to see less light reflected. 41

42 Phong Illumination One function that approximates this fall off is called the Phong Illumination model. this model has no physical basis one of the most commonly used illumination models in computer graphics. I = k I (cosφ) specular s light n shiney the cos φ term maximum when the surface is viewed from the mirror direction falls off to 0 when viewed at 90 degrees away from it. the n shiny controls the rate of this fall off. For shiny surface has large n shiny than a dull surface k s is the material s specular-reflection reflection coefficient Ranges between 0 and 1 42

43 Effect of n shiney The diagram below shows the how the Phong reflectance drops off based on the viewers angle from the reflected ray for various values of n shiny. As n shiny increases, highlight is more concentrated, surface appears glossier. 43

44 Computing Phong Illumination Cont. The cos φ term of Phong's specular illumination using the following relationship. I = k I ( Vˆ Rˆ ) specular s The V vector is the unit vector in the direction of the viewer the R vector is the mirror reflectance direction. The vector R can be computed from the incoming light direction and the surface normal as below light n shiny Rˆ = (2( Nˆ Lˆ)) Nˆ Lˆ 44

45 Computing Phong Illumination Cont. The following figure illustrates this relationship. Rˆ + Lˆ = (2( Nˆ Lˆ)) Nˆ L^ ^ R + L^ L^ ^N ^R ^N L^ 45

46 Blinn & Torrance Variation Jim Blinn introduced another approach for computing Phong-like illumination based on the work of Ken Torrance. His illumination function uses the following equation: I = k I ( Nˆ Hˆ ) specular s light n shiney In this equation the angle of specular dispersion is computed by how far the surface's normal is from a vector bisecting the incoming light direction and the viewing direction. 46

47 Blinn & Torrance Variation Cont. The halfway vector Ĥ is given by Hˆ = Lˆ + Vˆ Lˆ + Vˆ L^ N^ ^ H φ ^R V ^ 47

48 Phong Examples These spheres illustrate the Phong model as L(direction of light source) and n shiny are varied: 48

49 Phong Lighting Model Intensity from a single light reflected by a single surface element I total = k ambient I ambient + I( k d ( Nˆ Lˆ) + k s ( Vˆ Rˆ) n shiney ) For multiple point lights, simply sum contributions I total = k ambient I ambient + lights i= 1 I i ( k d ( Nˆ Lˆ) + k s ( Vˆ Rˆ) n shiney ) Reflectance coefficients, k a, k d,and k s may or may not vary with the color component 49

50 Phong Lighting: Intensity Plots 50

51 Phong Lighting Model(color) Light sources have three types of color Ambient reflection coefficients k ar, k ag, k ab Diffuse reflection coefficients k dr, k dg, k db Specular reflection coefficients k sr, k sg, k sb I I I r g b = = = k k k ar ag ab I I I ar ag ab I I r I b ( k g ( k ( k dr db ( Nˆ dg ( Nˆ ( Nˆ Lˆ) + Lˆ) + Lˆ) + k k sr k sb ( Vˆ sg ( Vˆ ( Vˆ Rˆ) n Rˆ) Rˆ) shiney n n shiney ) shiney ) ) 51

52 Shading Models Shading a surface Using normal at each surface point, calculate illumination at that point. Need to render each point! Shade polygons using their normals and illumination model Three types of shading models is used to simplify the process Flat Shading Gouraud Shading intensity interpolated across polygon Phong Shading normal vector interpolated across polygon 52

53 Flat Shading The simplest shading method applies only one illumination calculation for each primitive. This approach applies an illumination model once to determine a single intensity value that is then used to shade an entire polygon (primitive) This approach is valid if several assumptions are true: 1. The light source is at infinity 2. The viewer is infinity 3. The polygon represents the actual surface being modeled and is not an approximation to a curved surface Issues: For point light sources the direction to the light source varies over the facet For specular reflections the direction to the eye varies over the facet 53

54 Facet Shading Even when the illumination equation is applied at each point of the faceted nature of the polygonal nature is still apparent. To overcome this limitation, normals are introduced at each vertex. Usually different than the polygon normal Used only for shading (not backface culling or other geometric computations) Better approximates the "real" surface Assumes the polygons were a piecewise approximation of the real surface (C 0 ) Normals provide information about the tangent plane at each point (C 1 ) 54

55 Vertex Normals If vertex normals are not provided they can often be approximated by averaging the normals of the facets which share the vertex. This only works if the polygons reasonably approximate the underlying surface. A better approximation can be found using a clustering analysis of the normals on the unit sphere. 55

56 Gouraud Shading The Gouraud Shading shading method applies the illumination model on a subset of surface points and interpolates the intensity of the remaining points on the surface. Gouraud shading also called intensity interpolation shading or color interpolation shading, eliminates intensity discontinuities. In the case of a polygonal mesh the illumination model is usually applied at each vertex and the colors in the triangles interior are linearly interpolated from these vertex values. 56

57 Gouraud Shading Cont. The linear interpolation can be accomplished using the plane equation method. To compute the intensity at a vertex shared by more than one polygon ˆN 1 Nˆ v Nˆ v = Nˆ Nˆ i i ˆN 4 ˆN 2 ˆN 3 57

58 58 Gouraud Shading Cont. Once the intensities at the vertices are obtained, linear Once the intensities at the vertices are obtained, linear interpolation of vertex intensities provides the shade of interpolation of vertex intensities provides the shade of each polygon each polygon y A D B C x scan line I 1 I 2 I p ) ( ) )( ( ) ( ) )( ( ) ( ) )( ( I x x x x I I I I y y y y I I I I y y y y I I I p p D C D S D D C A B A S A A B + = + = + = y A y S y B

59 Phong Shading Phong shading, also known as normal-vector interpolation shading, interpolates the surface normal vector, rather than the intensity. In Phong shading (not to be confused with Phong's illumination model), the surface normal is linearly interpolated across polygonal facets, and the Illumination model is applied at every point. The surface normal at each vertex find firstly Then blends this normal over the face of the polygon. It next compares the normal with light vector at each point, computing a new shade for each pixel location. 59

60 Phong Shading Cont. A Phong shader assumes the same input as a Gouraud shader,, which means that it expects a normal for every vertex. Phong shading will usually result in a very smooth appearance 60

61 Phong Shading Cont. Interpolation across edges first Normals then interpolated across each scan line Illumination model computed for each point in scan line B C Interpolated normal along xy Interpolated normal along CD y Average normal at each vertex of polygon D x A 61

62 Comparison of different Shading 62

63 OpenGL OpenGL approximates light and lighting as if light can be broken into red, green, and blue components. The color of light sources is characterized the amount of red, green, and blue light they emit, The material of surfaces is characterized the percentage of the incoming red, green, and blue components that are reflected in various directions. The OpenGL lighting equations are just an approximation works fairly well computes relatively quickly. 63

64 Defining a light source OpenGL lighting model divides the lighting into four independent components Emitted it originates from an object and is unaffected by any light sources Ambient Comes from all directions strikes a surface, it's scattered equally in all directions. Diffuse comes from one direction scattered equally in all directions specular comes from a particular direction bounce off the surface in a preferred direction All four components are computed independently, and then added together. t 64

65 Defining Light Sources Up to 8 different lights can be specified GL_LIGHT0, GL_LIGHT1, etc Each source has various properties Such as color, position, and direction gllight*() is used to specify all properties of lights General form: gllightfv(glenum light, GLenum pname,, TYPE *param) gllight(glenum light, GLenum pname,, TYPE param) pname defines characteristic of the light 65

66 Default Values for pname Parameter of gllight*() Parameter Name GL_AMBIENT GL_DIFFUSE GL_SPECULAR GL_POSITION GL_SPOT_DIRECTION GL_SPOT_EXPONENT GL_SPOT_CUTOFF GL_CONSTANT_ATTENUATION GL_LINEAR_ATTENUATION GL_QUADRATIC_ATTENUATION Default Value (0.0, 0.0, 0.0, 1.0) (1.0, 1.0, 1.0, 1.0) (1.0, 1.0, 1.0, 1.0) (0.0, 0.0, 1.0, 0.0) (0.0, 0.0, -1.0) Meaning ambient RGBA intensity of light diffuse RGBA intensity of light specular RGBA intensity of light (x, y, z, w) position of light (x, y, z) direction of spotlight spotlight exponent spotlight cutoff angle constant attenuation factor linear attenuation factor quadratic attenuation factor 66

67 Pname Syntax Parameters to be defined for each source 1. Ambient intensity (r,g,b,a) 2. Diffuse intensity (r,g,b,a) 3. Specular color (r,g,b,a) 4. Position (x,y,z,w) 5. Spotlights: spot direction, exponent & cutoff 67

68 Creating Light Sources Enable lighting glenable(gl_lighting); glenable(gl_light0); // enable this particular light Disable lighting If lighting isn't enabled, the current color is simply mapped onto the current vertex no calculations concerning normals,, light sources, the lighting model, and material properties are performed. gldisable(gl_lighting) 68

69 Different color-related parameters Ambient component: GLfloat global_ambient[]={.1,.1,.1,1.0} GLfloat ambient[]={1.0,0.0,0.0,1.0} gllightfv(gl_light0,gl_ambient,ambient) gllightfv(gl_light_model_ambient,global_ambient) Diffuse component GLfloat diffuse[]={0.0,1.0,0.0,1.0} gllightfv(gl_light0,gl_diffuse,diffuse) Specular component GLfloat specular[] = { 0.0,1.0,1.0,1.0} gllightfv(gl_light0,gl_specular, (GL_LIGHT0,GL_SPECULAR,specular) 69

70 Position And Attenuation Position positional light source: w=1.0 directional light source: w=0.0 GLfloat light_pos[]={1.0,2.0,3.0,1.0} gllightfv(gl_light0,gl_position,light_pos) Attenuation The intensity of light decreases as distance from the light increases. a directional light is infinitely far away, attenuation is disabled for a directional light. a positional light OpenGL attenuates a light source by multiplying the contribution of that source by an attenuation factor: 70

71 Position And Attenuation Cont. By default, k c is 1.0 and both k l and k q are zero gllightf(gl_light0, GL_CONSTANT_ATTENUATION, 2.0) gllightf(gl_light0, GL_LINEAR_ATTENUATION, 1.0) gllightf(gl_light0, GL_QUADRATIC_ATTENUATION, 0.5) attenuation factor = k d k k k c l q c + k l 1 d + k = distance between the light's position and the vertex = GL_CONSTANT_ATTENUATION = GL_LINEAR_ATTENUATION = GL_QUADRATIC_ATTENUATION q d 2 71

72 Spotlights positional light source can act as a spotlight by restricting the shape of the light it emits to a cone light's intensity is highest in the center of the cone. attenuated toward the edges of the cone by the cosine of the angle between the direction of the light and the direction from the light to the vertex being lighted, raised to the power of the spot exponent. higher spot exponents result in a more focused light source. 72

73 Spotlights Cont. Spotlight parameters: GL_SPOT_DIRECTION,GL_SPOT_EXPONENT,GL_SPOT_CUTOFF sets the cutoff parameter to 45 degrees gllightf(gl_light0, GL_SPOT_CUTOFF, 45.0) specify a spotlight's direction, which determines the axis of the e cone of light GLfloat spot_direction[] = { -1.0, -1.0, 0.0 } gllightfv(gl_light0, GL_SPOT_DIRECTION, spot_direction) control the intensity distribution of the light within the cone set the attenuation factor set the GL_SPOT_EXPONENT parameter control how concentrated the light is 73

74 Multiple Lights two lights, one directional and one spotlight GLfloat light_position[] = { 1.0, 1.0, 1.0, 0.0 }; GLfloat light1_ambient[] = { 0.2, 0.2, 0.2, 1.0 }; GLfloat light1_diffuse[] = { 1.0, 1.0, 1.0, 1.0 }; GLfloat light1_specular[] = { 1.0, 1.0, 1.0, 1.0 }; GLfloat light1_position[] = { -2.0, 2.0, 1.0, 1.0 }; GLfloat spot_direction[] = { -1.0, -1.0, 0.0 }; gllightfv(gl_light0, GL_POSITION, light_position); gllightfv(gl_light0, GL_SPOT_DIRECTION, spot_direction); gllightfv(gl_light1, GL_AMBIENT, light1_ambient); gllightfv(gl_light1, GL_DIFFUSE, light1_diffuse); gllightfv(gl_light1, GL_SPECULAR, light1_specular); gllightfv(gl_light1, GL_POSITION, light1_position); gllightf(gl_light1, GL_CONSTANT_ATTENUATION, 1.5); gllightf(gl_light1, GL_LINEAR_ATTENUATION, 0.5); gllightf(gl_light1, GL_QUADRATIC_ATTENUATION, 0.2); gllightf(gl_light1, GL_SPOT_CUTOFF, 45.0); gllightf(gl_light1, GL_SPOT_EXPONENT, 2.0); glenable(gl_light0); glenable(gl_light1); 74

75 Materials Colors OpenGL lighting model makes the approximation that a material's color depends on the percentages of the incoming red, green, and blue light it reflects Example a perfectly red ball reflects all the incoming red light and absorbs all the green and blue light that strikes it. If the ball is viewed in white light (composed of equal amounts of red, green, and blue light), all the red is reflected, a red ball is saw. If the ball is viewed in pure red light, it appears to be red. If the ball is viewed in pure green light, it appears black all the green is absorbed, and there's no incoming red, so 75 no light is reflected

76 Materials Colors Cont. Materials have different ambient, diffuse, and specular colors, which determine the ambient, diffuse, and specular reflectances of the material. A material's ambient reflectance is combined with the ambient component of each incoming light source Diffuse reflectance with the light's diffuse component Specular reflectance with the light's specular component. 76

77 Materials Colors Cont. Ambient and diffuse reflectances define the color of the material and are typically similar Specular reflectance is usually white or gray specular highlights end up being the color of the light source's specular intensity. Example: a white light shining on a shiny red plastic sphere, most of the sphere appears red, but the shiny highlight is white. 77

78 Materials in OpenGL Specify materials for front and back surfaces separately General form: glmaterialfv(glenum face, GLenum pname,, TYPE *param* param); glmaterialf(glenum face, GLenum pname,, TYPE param); face parameter GL_FRONT set the reflection coefficient for font faces GL_BACK set the reflection coefficient for back faces GL_FRONT_AND_BACK set the reflection coefficient for both front and back faces 78

79 Materials in OpenGL Cont. Default Values for pname Parameter of glmaterial*() Parameter Name GL_AMBIENT GL_DIFFUSE GL_AMBIENT_AND_DIFFUSE GL_SPECULAR GL_SHININESS GL_EMISSION GL_COLOR_INDEXES Default Value (0.2, 0.2, 0.2, 1.0) (0.8, 0.8, 0.8, 1.0) (0.0, 0.0, 0.0, 1.0) 0.0 (0.0, 0.0, 0.0, 1.0) (0,1,1) Meaning ambient color of material diffuse color of material ambient and diffuse color of material specular color of material specular exponent emissive color of material ambient, diffuse, and specular color indices 79

80 Materials in OpenGL Cont. Ambient component GLfloat ambient[] ={.2,.2,.2,1.0} glmaterialfv(gl_front_and_back,gl_ambient, ambient) Diffuse component GLfloat diffuse[]={1.0,0.8,0.0,1.0} glmaterialfv(gl_front,gl_diffuse,diffuse) Specular component control the size and brightness of the highlight (with GL_SHININESS) Glfloat specular[]={0.0,0.0,1.0,1.0} glmaterialfv(gl_front,gl_specular, (GL_FRONT,GL_SPECULAR,specular) 80

81 Materials in OpenGL Cont. Shininess the higher the value, the smaller and brighter (more focused) the highlight glmaterialf(gl_front,gl_shininess,80.0) Emission: make an object appear to be giving off light of that color independently of any light source Glfloat emission[] = {.5,0.0,0.0,1.0} glmaterialfv(gl_back,gl_emission,emission) 81

82 Shading a polygon Specify filling for front/back: glpolygonmode(gl_front_and_back, GL_FILL) Specify a shading model Flat glshademodel(gl_flat); Gouraud glshademodel(gl_smooth) Putting it together: 1. Specify lights 2. Specify shading model 3. Specify material properties for surface 4. Render polygons 82

83 Example Specify lights Specify shading model Specify material properties for surface Render polygons GLfloat light_position[] = {1.0,1.0,1.0,0.0); gllightfv(gl_light0, GL_POSITION, light_position); glenable(gl_lighting); glenable(gl_light0); glshademodel(gl_smooth); GLfloat mat_specular[] = {1.0,1.0,1.0,1.0}; GLfloat mat_shininess[] = {50.0}; glmaterialfv(gl_front, GL_SPECULAR, mat_specular); glmaterialfv(gl_front, GL_SHININESS, mat_shininess); glenable(gl_depth_test); glbegin(gl_polygon) glnormal3fv(n1); glvertex3fv(v1); glnormal3fv(n2); glvertex3fv(v2); glnormal3fv(n3); glvertex3fv(v3); glend(); 83

Illumination & Shading: Part 1

Illumination & Shading: Part 1 Illumination & Shading: Part 1 Light Sources Empirical Illumination Shading Local vs Global Illumination Lecture 10 Comp 236 Spring 2005 Computer Graphics Jargon: Illumination Models Illumination - the

More information

Illumination and Shading

Illumination and Shading Illumination and Shading Computer Graphics COMP 770 (236) Spring 2007 Instructor: Brandon Lloyd 2/14/07 1 From last time Texture mapping overview notation wrapping Perspective-correct interpolation Texture

More information

Topic 9: Lighting & Reflection models 9/10/2016. Spot the differences. Terminology. Two Components of Illumination. Ambient Light Source

Topic 9: Lighting & Reflection models 9/10/2016. Spot the differences. Terminology. Two Components of Illumination. Ambient Light Source Topic 9: Lighting & Reflection models Lighting & reflection The Phong reflection model diffuse component ambient component specular component Spot the differences Terminology Illumination The transport

More information

Topic 9: Lighting & Reflection models. Lighting & reflection The Phong reflection model diffuse component ambient component specular component

Topic 9: Lighting & Reflection models. Lighting & reflection The Phong reflection model diffuse component ambient component specular component Topic 9: Lighting & Reflection models Lighting & reflection The Phong reflection model diffuse component ambient component specular component Spot the differences Terminology Illumination The transport

More information

Computer Graphics. Illumination and Shading

Computer Graphics. Illumination and Shading () Illumination and Shading Dr. Ayman Eldeib Lighting So given a 3-D triangle and a 3-D viewpoint, we can set the right pixels But what color should those pixels be? If we re attempting to create a realistic

More information

Overview. Shading. Shading. Why we need shading. Shading Light-material interactions Phong model Shading polygons Shading in OpenGL

Overview. Shading. Shading. Why we need shading. Shading Light-material interactions Phong model Shading polygons Shading in OpenGL Overview Shading Shading Light-material interactions Phong model Shading polygons Shading in OpenGL Why we need shading Suppose we build a model of a sphere using many polygons and color it with glcolor.

More information

Illumination & Shading

Illumination & Shading Illumination & Shading Light Sources Empirical Illumination Shading Lecture 15 CISC440/640 Spring 2015 Illumination Models Computer Graphics Jargon: Illumination - the transport luminous flux from light

More information

Sung-Eui Yoon ( 윤성의 )

Sung-Eui Yoon ( 윤성의 ) CS380: Computer Graphics Illumination and Shading Sung-Eui Yoon ( 윤성의 ) Course URL: http://sglab.kaist.ac.kr/~sungeui/cg/ Course Objectives (Ch. 10) Know how to consider lights during rendering models

More information

Shading and Illumination

Shading and Illumination Shading and Illumination OpenGL Shading Without Shading With Shading Physics Bidirectional Reflectance Distribution Function (BRDF) f r (ω i,ω ) = dl(ω ) L(ω i )cosθ i dω i = dl(ω ) L(ω i )( ω i n)dω

More information

Three-Dimensional Graphics V. Guoying Zhao 1 / 55

Three-Dimensional Graphics V. Guoying Zhao 1 / 55 Computer Graphics Three-Dimensional Graphics V Guoying Zhao 1 / 55 Shading Guoying Zhao 2 / 55 Objectives Learn to shade objects so their images appear three-dimensional Introduce the types of light-material

More information

Lighting. CSC 7443: Scientific Information Visualization

Lighting. CSC 7443: Scientific Information Visualization Lighting Why Lighting? What light source is used and how the object response to the light makes difference Ocean looks bright bluish green in sunny day but dim gray green in cloudy day Lighting gives you

More information

Why we need shading?

Why we need shading? 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 Light-material interactions cause each point to have a different

More information

INF3320 Computer Graphics and Discrete Geometry

INF3320 Computer Graphics and Discrete Geometry INF3320 Computer Graphics and Discrete Geometry Visual appearance Christopher Dyken and Martin Reimers 23.09.2009 Page 1 Visual appearance Real Time Rendering: Chapter 5 Light Sources and materials Shading

More information

Reading. Shading. Introduction. An abundance of photons. Required: Angel , Optional: OpenGL red book, chapter 5.

Reading. Shading. Introduction. An abundance of photons. Required: Angel , Optional: OpenGL red book, chapter 5. Reading Required: Angel 6.1-6.5, 6.7-6.8 Optional: Shading OpenGL red book, chapter 5. 1 2 Introduction So far, we ve talked exclusively about geometry. What is the shape of an obect? How do I place it

More information

Today s class. Simple shadows Shading Lighting in OpenGL. Informationsteknologi. Wednesday, November 21, 2007 Computer Graphics - Class 10 1

Today s class. Simple shadows Shading Lighting in OpenGL. Informationsteknologi. Wednesday, November 21, 2007 Computer Graphics - Class 10 1 Today s class Simple shadows Shading Lighting in OpenGL Wednesday, November 21, 27 Computer Graphics - Class 1 1 Simple shadows Simple shadows can be gotten by using projection matrices Consider a light

More information

Reading. Shading. An abundance of photons. Introduction. Required: Angel , 6.5, Optional: Angel 6.4 OpenGL red book, chapter 5.

Reading. Shading. An abundance of photons. Introduction. Required: Angel , 6.5, Optional: Angel 6.4 OpenGL red book, chapter 5. Reading Required: Angel 6.1-6.3, 6.5, 6.7-6.8 Optional: Shading Angel 6.4 OpenGL red book, chapter 5. 1 2 Introduction An abundance of photons So far, we ve talked exclusively about geometry. Properly

More information

CS Computer Graphics: Illumination and Shading I

CS Computer Graphics: Illumination and Shading I CS 543 - Computer Graphics: Illumination and Shading I by Robert W. Lindeman gogo@wpi.edu (with help from Emmanuel Agu ;-) Illumination and Shading Problem: Model light/surface point interactions to determine

More information

CS Computer Graphics: Illumination and Shading I

CS Computer Graphics: Illumination and Shading I CS 543 - Computer Graphics: Illumination and Shading I by Robert W. Lindeman gogo@wpi.edu (with help from Emmanuel Agu ;-) Illumination and Shading Problem: Model light/surface point interactions to determine

More information

CEng 477 Introduction to Computer Graphics Fall

CEng 477 Introduction to Computer Graphics Fall Illumination Models and Surface-Rendering Methods CEng 477 Introduction to Computer Graphics Fall 2007 2008 Illumination Models and Surface Rendering Methods In order to achieve realism in computer generated

More information

Illumination Model. The governing principles for computing the. Apply the lighting model at a set of points across the entire surface.

Illumination Model. The governing principles for computing the. Apply the lighting model at a set of points across the entire surface. Illumination and Shading Illumination (Lighting) Model the interaction of light with surface points to determine their final color and brightness OpenGL computes illumination at vertices illumination Shading

More information

Illumination and Shading

Illumination and Shading Illumination and Shading Illumination (Lighting) Model the interaction of light with surface points to determine their final color and brightness OpenGL computes illumination at vertices illumination Shading

More information

Illumination & Shading

Illumination & Shading Illumination & Shading Goals Introduce the types of light-material interactions Build a simple reflection model---the Phong model--- that can be used with real time graphics hardware Why we need Illumination

More information

Light Transport Baoquan Chen 2017

Light Transport Baoquan Chen 2017 Light Transport 1 Physics of Light and Color It s all electromagnetic (EM) radiation Different colors correspond to radiation of different wavelengths Intensity of each wavelength specified by amplitude

More information

Today. Global illumination. Shading. Interactive applications. Rendering pipeline. Computergrafik. Shading Introduction Local shading models

Today. Global illumination. Shading. Interactive applications. Rendering pipeline. Computergrafik. Shading Introduction Local shading models Computergrafik Thomas Buchberger, Matthias Zwicker Universität Bern Herbst 2008 Today Introduction Local shading models Light sources strategies Compute interaction of light with surfaces Requires simulation

More information

CSE 167: Introduction to Computer Graphics Lecture #6: Lights. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2016

CSE 167: Introduction to Computer Graphics Lecture #6: Lights. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2016 CSE 167: Introduction to Computer Graphics Lecture #6: Lights Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2016 Announcements Thursday in class: midterm #1 Closed book Material

More information

Comp 410/510 Computer Graphics. Spring Shading

Comp 410/510 Computer Graphics. Spring Shading Comp 410/510 Computer Graphics Spring 2017 Shading Why we need shading Suppose we build a model of a sphere using many polygons and then color it using a fixed color. We get something like But we rather

More information

Illumination & Shading I

Illumination & Shading I CS 543: Computer Graphics Illumination & Shading I Robert W. Lindeman Associate Professor Interactive Media & Game Development Department of Computer Science Worcester Polytechnic Institute gogo@wpi.edu

More information

w Foley, Section16.1 Reading

w Foley, Section16.1 Reading Shading w Foley, Section16.1 Reading Introduction So far, we ve talked exclusively about geometry. w What is the shape of an object? w How do I place it in a virtual 3D space? w How do I know which pixels

More information

Shading. Brian Curless CSE 457 Spring 2015

Shading. Brian Curless CSE 457 Spring 2015 Shading Brian Curless CSE 457 Spring 2015 1 Reading Required: Angel chapter 5. Optional: OpenGL red book, chapter 5. 2 Basic 3D graphics With affine matrices, we can now transform virtual 3D objects in

More information

Objectives. Introduce Phong model Introduce modified Phong model Consider computation of required vectors Discuss polygonal shading.

Objectives. Introduce Phong model Introduce modified Phong model Consider computation of required vectors Discuss polygonal shading. Shading II 1 Objectives Introduce Phong model Introduce modified Phong model Consider computation of required vectors Discuss polygonal shading Flat Smooth Gouraud 2 Phong Lighting Model A simple model

More information

Shading. CSE 457 Winter 2015

Shading. CSE 457 Winter 2015 Shading CSE 457 Winter 2015 Reading Required: Angel chapter 5. Optional: OpenGL red book, chapter 5. 2 Basic 3D graphics With affine matrices, we can now transform virtual 3D objects in their local coordinate

More information

CPSC 314 LIGHTING AND SHADING

CPSC 314 LIGHTING AND SHADING CPSC 314 LIGHTING AND SHADING UGRAD.CS.UBC.CA/~CS314 slide credits: Mikhail Bessmeltsev et al 1 THE RENDERING PIPELINE Vertices and attributes Vertex Shader Modelview transform Per-vertex attributes Vertex

More information

Today. Global illumination. Shading. Interactive applications. Rendering pipeline. Computergrafik. Shading Introduction Local shading models

Today. Global illumination. Shading. Interactive applications. Rendering pipeline. Computergrafik. Shading Introduction Local shading models Computergrafik Matthias Zwicker Universität Bern Herbst 2009 Today Introduction Local shading models Light sources strategies Compute interaction of light with surfaces Requires simulation of physics Global

More information

Ambient reflection. Jacobs University Visualization and Computer Graphics Lab : Graphics and Visualization 407

Ambient reflection. Jacobs University Visualization and Computer Graphics Lab : Graphics and Visualization 407 Ambient reflection Phong reflection is a local illumination model. It only considers the reflection of light that directly comes from the light source. It does not compute secondary reflection of light

More information

Computer Graphics (CS 543) Lecture 7b: Intro to lighting, Shading and Materials + Phong Lighting Model

Computer Graphics (CS 543) Lecture 7b: Intro to lighting, Shading and Materials + Phong Lighting Model Computer Graphics (CS 543) Lecture 7b: Intro to lighting, Shading and Materials + Phong Lighting Model Prof Emmanuel Agu Computer Science Dept. Worcester Polytechnic Institute (WPI) Why do we need Lighting

More information

CS 4600 Fall Utah School of Computing

CS 4600 Fall Utah School of Computing Lighting CS 4600 Fall 2015 Utah School of Computing Objectives Learn to shade objects so their images appear three-dimensional Introduce the types of light-material interactions Build a simple reflection

More information

Introduction to Computer Graphics 7. Shading

Introduction to Computer Graphics 7. Shading Introduction to Computer Graphics 7. Shading National Chiao Tung Univ, Taiwan By: I-Chen Lin, Assistant Professor Textbook: Hearn and Baker, Computer Graphics, 3rd Ed., Prentice Hall Ref: E.Angel, Interactive

More information

Computer Graphics (CS 4731) Lecture 16: Lighting, Shading and Materials (Part 1)

Computer Graphics (CS 4731) Lecture 16: Lighting, Shading and Materials (Part 1) Computer Graphics (CS 4731) Lecture 16: Lighting, Shading and Materials (Part 1) Prof Emmanuel Agu Computer Science Dept. Worcester Polytechnic Institute (WPI) Why do we need Lighting & shading? Sphere

More information

CS Surface Rendering

CS Surface Rendering CS10101001 Surface Rendering Junqiao Zhao 赵君峤 Department of Computer Science and Technology College of Electronics and Information Engineering Tongji University Surface rendering How do we choose a color

More information

Computer Graphics. Shading. Based on slides by Dianna Xu, Bryn Mawr College

Computer Graphics. Shading. Based on slides by Dianna Xu, Bryn Mawr College Computer Graphics Shading Based on slides by Dianna Xu, Bryn Mawr College Image Synthesis and Shading Perception of 3D Objects Displays almost always 2 dimensional. Depth cues needed to restore the third

More information

Illumination in Computer Graphics

Illumination in Computer Graphics Illumination in Computer Graphics Ann McNamara Illumination in Computer Graphics Definition of light sources. Analysis of interaction between light and objects in a scene. Rendering images that are faithful

More information

Graphics and Visualization

Graphics and Visualization International University Bremen Spring Semester 2006 Recap Hierarchical Modeling Perspective vs Parallel Projection Representing solid objects Displaying Wireframe models is easy from a computational

More information

Ligh%ng and Shading. Ligh%ng and Shading. q Is this a plate or a ball? q What color should I set for each pixel?

Ligh%ng and Shading. Ligh%ng and Shading. q Is this a plate or a ball? q What color should I set for each pixel? Ligh%ng and Shading Ligh%ng and Shading Is this a plate or a ball? What color should I set for each pixel? 1 Physical Reality As light hits the surface: Part is absorbed Part is reflected Visible light

More information

Light Sources. Spotlight model

Light Sources. Spotlight model lecture 12 Light Sources sunlight (parallel) Sunny day model : "point source at infinity" - lighting - materials: diffuse, specular, ambient spotlight - shading: Flat vs. Gouraud vs Phong light bulb ambient

More information

Reflection and Shading

Reflection and Shading Reflection and Shading R. J. Renka Department of Computer Science & Engineering University of North Texas 10/19/2015 Light Sources Realistic rendering requires that we model the interaction between light

More information

Shading. Why we need shading. Scattering. Shading. Objectives

Shading. Why we need shading. Scattering. Shading. Objectives Shading Why we need shading Objectives Learn to shade objects so their images appear three-dimensional Suppose we build a model of a sphere using many polygons and color it with glcolor. We get something

More information

WHY WE NEED SHADING. Suppose we build a model of a sphere using many polygons and color it with glcolor. We get something like.

WHY WE NEED SHADING. Suppose we build a model of a sphere using many polygons and color it with glcolor. We get something like. LIGHTING 1 OUTLINE Learn to light/shade objects so their images appear three-dimensional Introduce the types of light-material interactions Build a simple reflection model---the Phong model--- that can

More information

Simple Lighting/Illumination Models

Simple Lighting/Illumination Models Simple Lighting/Illumination Models Scene rendered using direct lighting only Photograph Scene rendered using a physically-based global illumination model with manual tuning of colors (Frederic Drago and

More information

Today we will start to look at illumination models in computer graphics

Today we will start to look at illumination models in computer graphics 1 llumination Today we will start to look at illumination models in computer graphics Why do we need illumination models? Different kinds lights Different kinds reflections Basic lighting model 2 Why Lighting?

More information

CMSC427 Shading Intro. Credit: slides from Dr. Zwicker

CMSC427 Shading Intro. Credit: slides from Dr. Zwicker CMSC427 Shading Intro Credit: slides from Dr. Zwicker 2 Today Shading Introduction Radiometry & BRDFs Local shading models Light sources Shading strategies Shading Compute interaction of light with surfaces

More information

Lighting/Shading III. Week 7, Wed Mar 3

Lighting/Shading III. Week 7, Wed Mar 3 University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2010 Tamara Munzner Lighting/Shading III Week 7, Wed Mar 3 http://www.ugrad.cs.ubc.ca/~cs314/vjan2010 reminders News don't need to tell

More information

Display Issues Week 5

Display Issues Week 5 CS 432/637 INTERACTIVE COMPUTER GRAPHICS Display Issues Week 5 David Breen Department of Computer Science Drexel University Based on material from Ed Angel, University of New Mexico Objectives Consider

More information

Shading , Fall 2004 Nancy Pollard Mark Tomczak

Shading , Fall 2004 Nancy Pollard Mark Tomczak 15-462, Fall 2004 Nancy Pollard Mark Tomczak Shading Shading Concepts Shading Equations Lambertian, Gouraud shading Phong Illumination Model Non-photorealistic rendering [Shirly, Ch. 8] Announcements Written

More information

CS5620 Intro to Computer Graphics

CS5620 Intro to Computer Graphics So Far wireframe hidden surfaces Next step 1 2 Light! Need to understand: How lighting works Types of lights Types of surfaces How shading works Shading algorithms What s Missing? Lighting vs. Shading

More information

Virtual Reality for Human Computer Interaction

Virtual Reality for Human Computer Interaction Virtual Reality for Human Computer Interaction Appearance: Lighting Representation of Light and Color Representation of Light and Color Do we need to represent all I! to represent a color C(I)? Representation

More information

Shading. Brian Curless CSE 557 Autumn 2017

Shading. Brian Curless CSE 557 Autumn 2017 Shading Brian Curless CSE 557 Autumn 2017 1 Reading Optional: Angel and Shreiner: chapter 5. Marschner and Shirley: chapter 10, chapter 17. Further reading: OpenGL red book, chapter 5. 2 Basic 3D graphics

More information

Shading Intro. Shading & Lighting. Light and Matter. Light and Matter

Shading Intro. Shading & Lighting. Light and Matter. Light and Matter Shading Intro Shading & Lighting Move from flat to 3-D models Orthographic view of sphere was uniformly color, thus, a flat circle A circular shape with many gradations or shades of color Courtesy of Vincent

More information

C O M P U T E R G R A P H I C S. Computer Graphics. Three-Dimensional Graphics V. Guoying Zhao 1 / 65

C O M P U T E R G R A P H I C S. Computer Graphics. Three-Dimensional Graphics V. Guoying Zhao 1 / 65 Computer Graphics Three-Dimensional Graphics V Guoying Zhao 1 / 65 Shading Guoying Zhao 2 / 65 Objectives Learn to shade objects so their images appear three-dimensional Introduce the types of light-material

More information

Shading I Computer Graphics I, Fall 2008

Shading I Computer Graphics I, Fall 2008 Shading I 1 Objectives Learn to shade objects ==> images appear threedimensional Introduce types of light-material interactions Build simple reflection model Phong model Can be used with real time graphics

More information

University of British Columbia CPSC 314 Computer Graphics Sep-Dec Tamara Munzner (guest lecturing) Lighting/Shading

University of British Columbia CPSC 314 Computer Graphics Sep-Dec Tamara Munzner (guest lecturing) Lighting/Shading University of British Columbia CPSC 314 Computer Graphics Sep-Dec 2010 Tamara Munzner (guest lecturing) Lighting/Shading Lighting 2 Rendering Pipeline Geometry Database Model/View Transform. Lighting Perspective

More information

Lecture 15: Shading-I. CITS3003 Graphics & Animation

Lecture 15: Shading-I. CITS3003 Graphics & Animation Lecture 15: Shading-I CITS3003 Graphics & Animation E. Angel and D. Shreiner: Interactive Computer Graphics 6E Addison-Wesley 2012 Objectives Learn that with appropriate shading so objects appear as threedimensional

More information

Lessons Learned from HW4. Shading. Objectives. Why we need shading. Shading. Scattering

Lessons Learned from HW4. Shading. Objectives. Why we need shading. Shading. Scattering Lessons Learned from HW Shading CS Interactive Computer Graphics Prof. David E. Breen Department of Computer Science Only have an idle() function if something is animated Set idle function to NULL, when

More information

Illumination Models & Shading

Illumination Models & Shading Illumination Models & Shading Lighting vs. Shading Lighting Interaction between materials and light sources Physics Shading Determining the color of a pixel Computer Graphics ZBuffer(Scene) PutColor(x,y,Col(P));

More information

CS130 : Computer Graphics Lecture 8: Lighting and Shading. Tamar Shinar Computer Science & Engineering UC Riverside

CS130 : Computer Graphics Lecture 8: Lighting and Shading. Tamar Shinar Computer Science & Engineering UC Riverside CS130 : Computer Graphics Lecture 8: Lighting and Shading Tamar Shinar Computer Science & Engineering UC Riverside Why we need shading Suppose we build a model of a sphere using many polygons and color

More information

Illumination and Shading

Illumination and Shading CT4510: Computer Graphics Illumination and Shading BOCHANG MOON Photorealism The ultimate goal of rendering is to produce photo realistic images. i.e., rendered images should be indistinguishable from

More information

Computer Graphics. Illumination Models and Surface-Rendering Methods. Somsak Walairacht, Computer Engineering, KMITL

Computer Graphics. Illumination Models and Surface-Rendering Methods. Somsak Walairacht, Computer Engineering, KMITL Computer Graphics Chapter 10 llumination Models and Surface-Rendering Methods Somsak Walairacht, Computer Engineering, KMTL Outline Light Sources Surface Lighting Effects Basic llumination Models Polygon

More information

5.2 Shading in OpenGL

5.2 Shading in OpenGL Fall 2017 CSCI 420: Computer Graphics 5.2 Shading in OpenGL Hao Li http://cs420.hao-li.com 1 Outline Normal Vectors in OpenGL Polygonal Shading Light Sources in OpenGL Material Properties in OpenGL Example:

More information

Color and Light CSCI 4229/5229 Computer Graphics Fall 2016

Color and Light CSCI 4229/5229 Computer Graphics Fall 2016 Color and Light CSCI 4229/5229 Computer Graphics Fall 2016 Solar Spectrum Human Trichromatic Color Perception Color Blindness Present to some degree in 8% of males and about 0.5% of females due to mutation

More information

Introduction to Computer Graphics. Farhana Bandukwala, PhD Lecture 14: Light Interacting with Surfaces

Introduction to Computer Graphics. Farhana Bandukwala, PhD Lecture 14: Light Interacting with Surfaces Introduction to Computer Graphics Farhana Bandukwala, PhD Lecture 14: Light Interacting with Surfaces Outline Computational tools Reflection models Polygon shading Computation tools Surface normals Vector

More information

ECS 175 COMPUTER GRAPHICS. Ken Joy.! Winter 2014

ECS 175 COMPUTER GRAPHICS. Ken Joy.! Winter 2014 ECS 175 COMPUTER GRAPHICS Ken Joy Winter 2014 Shading To be able to model shading, we simplify Uniform Media no scattering of light Opaque Objects No Interreflection Point Light Sources RGB Color (eliminating

More information

LIGHTING AND SHADING

LIGHTING AND SHADING DH2323 DGI15 INTRODUCTION TO COMPUTER GRAPHICS AND INTERACTION LIGHTING AND SHADING Christopher Peters HPCViz, KTH Royal Institute of Technology, Sweden chpeters@kth.se http://kth.academia.edu/christopheredwardpeters

More information

Chapter 10. Surface-Rendering Methods. Somsak Walairacht, Computer Engineering, KMITL

Chapter 10. Surface-Rendering Methods. Somsak Walairacht, Computer Engineering, KMITL Computer Graphics Chapter 10 llumination Models and Surface-Rendering Methods Somsak Walairacht, Computer Engineering, KMTL 1 Outline Light Sources Surface Lighting Effects Basic llumination Models Polygon

More information

CSE 167: Lecture #7: Color and Shading. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2011

CSE 167: Lecture #7: Color and Shading. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2011 CSE 167: Introduction to Computer Graphics Lecture #7: Color and Shading Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2011 Announcements Homework project #3 due this Friday,

More information

Shading in OpenGL. Outline. Defining and Maintaining Normals. Normalization. Enabling Lighting and Lights. Outline

Shading in OpenGL. Outline. Defining and Maintaining Normals. Normalization. Enabling Lighting and Lights. Outline CSCI 420 Computer Graphics Lecture 10 Shading in OpenGL Normal Vectors in OpenGL Polygonal Shading Light Source in OpenGL Material Properties in OpenGL Approximating a Sphere [Angel Ch. 6.5-6.9] Jernej

More information

Lights, Colour and Materials In OpenGL

Lights, Colour and Materials In OpenGL Illumination Models Lights, Colour and Materials In OpenGL Illumination models are used to generate the colour of an object s surface at a given point on that surface. The factors that govern the illumination

More information

CSE 167: Lecture #8: Lighting. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2011

CSE 167: Lecture #8: Lighting. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2011 CSE 167: Introduction to Computer Graphics Lecture #8: Lighting Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2011 Announcements Homework project #4 due Friday, October 28 Introduction:

More information

CSE 681 Illumination and Phong Shading

CSE 681 Illumination and Phong Shading CSE 681 Illumination and Phong Shading Physics tells us What is Light? We don t see objects, we see light reflected off of objects Light is a particle and a wave The frequency of light What is Color? Our

More information

Shading. Reading. Pinhole camera. Basic 3D graphics. Brian Curless CSE 557 Fall Required: Shirley, Chapter 10

Shading. Reading. Pinhole camera. Basic 3D graphics. Brian Curless CSE 557 Fall Required: Shirley, Chapter 10 Reading Required: Shirley, Chapter 10 Shading Brian Curless CSE 557 Fall 2014 1 2 Basic 3D graphics With affine matrices, we can now transform virtual 3D objects in their local coordinate systems into

More information

Methodology for Lecture. Importance of Lighting. Outline. Shading Models. Brief primer on Color. Foundations of Computer Graphics (Spring 2010)

Methodology for Lecture. Importance of Lighting. Outline. Shading Models. Brief primer on Color. Foundations of Computer Graphics (Spring 2010) Foundations of Computer Graphics (Spring 2010) CS 184, Lecture 11: OpenGL 3 http://inst.eecs.berkeley.edu/~cs184 Methodology for Lecture Lecture deals with lighting (teapot shaded as in HW1) Some Nate

More information

CSCI 4620/8626. Computer Graphics Illumination Models and Surface Rendering Methods (Chapter 17)

CSCI 4620/8626. Computer Graphics Illumination Models and Surface Rendering Methods (Chapter 17) CSCI 4620/8626 Computer Graphics Illumination Models and Surface Rendering Methods (Chapter 17) Last update: 2016-04-19 Realism! Realistic displays of a scene use! Perspective projections of objects! Application

More information

CS452/552; EE465/505. Lighting & Shading

CS452/552; EE465/505. Lighting & Shading CS452/552; EE465/505 Lighting & Shading 2-17 15 Outline! More on Lighting and Shading Read: Angel Chapter 6 Lab2: due tonight use ASDW to move a 2D shape around; 1 to center Local Illumination! Approximate

More information

Lighting and Shading II. Angel and Shreiner: Interactive Computer Graphics 7E Addison-Wesley 2015

Lighting and Shading II. Angel and Shreiner: Interactive Computer Graphics 7E Addison-Wesley 2015 Lighting and Shading II 1 Objectives Continue discussion of shading Introduce modified Phong model Consider computation of required vectors 2 Ambient Light Ambient light is the result of multiple interactions

More information

OpenGl Pipeline. triangles, lines, points, images. Per-vertex ops. Primitive assembly. Texturing. Rasterization. Per-fragment ops.

OpenGl Pipeline. triangles, lines, points, images. Per-vertex ops. Primitive assembly. Texturing. Rasterization. Per-fragment ops. OpenGl Pipeline Individual Vertices Transformed Vertices Commands Processor Per-vertex ops Primitive assembly triangles, lines, points, images Primitives Fragments Rasterization Texturing Per-fragment

More information

Lighting Models. CS116B Chris Pollett Mar 21, 2004.

Lighting Models. CS116B Chris Pollett Mar 21, 2004. Lighting Models CS116B Chris Pollett Mar 21, 2004. Outline Overview Light Sources Surface Lighting Effect Basic Illumination Models Overview An illumination model (lighting model) is used to calculate

More information

Introduction. Lighting model Light reflection model Local illumination model Reflectance model BRDF

Introduction. Lighting model Light reflection model Local illumination model Reflectance model BRDF Shading Introduction Affine transformations help us to place objects into a scene. Before creating images of these objects, we ll look at models for how light interacts with their surfaces. Such a model

More information

S U N G - E U I YO O N, K A I S T R E N D E R I N G F R E E LY A VA I L A B L E O N T H E I N T E R N E T

S U N G - E U I YO O N, K A I S T R E N D E R I N G F R E E LY A VA I L A B L E O N T H E I N T E R N E T S U N G - E U I YO O N, K A I S T R E N D E R I N G F R E E LY A VA I L A B L E O N T H E I N T E R N E T Copyright 2018 Sung-eui Yoon, KAIST freely available on the internet http://sglab.kaist.ac.kr/~sungeui/render

More information

CS Illumination and Shading. Slide 1

CS Illumination and Shading. Slide 1 CS 112 - Illumination and Shading Slide 1 Illumination/Lighting Interaction between light and surfaces Physics of optics and thermal radiation Very complex: Light bounces off several surface before reaching

More information

Lighting/Shading II. Week 7, Mon Mar 1

Lighting/Shading II. Week 7, Mon Mar 1 University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2010 Tamara Munzner Lighting/Shading II Week 7, Mon Mar 1 http://www.ugrad.cs.ubc.ca/~cs314/vjan2010 News Homework 3 out today Homework

More information

Color and Light. CSCI 4229/5229 Computer Graphics Summer 2008

Color and Light. CSCI 4229/5229 Computer Graphics Summer 2008 Color and Light CSCI 4229/5229 Computer Graphics Summer 2008 Solar Spectrum Human Trichromatic Color Perception Are A and B the same? Color perception is relative Transmission,Absorption&Reflection Light

More information

Virtual Reality for Human Computer Interaction

Virtual Reality for Human Computer Interaction Virtual Reality for Human Computer Interaction Appearance: Lighting Representation of Light and Color Do we need to represent all I! to represent a color C(I)? No we can approximate using a three-color

More information

Local Illumination. CMPT 361 Introduction to Computer Graphics Torsten Möller. Machiraju/Zhang/Möller

Local Illumination. CMPT 361 Introduction to Computer Graphics Torsten Möller. Machiraju/Zhang/Möller Local Illumination CMPT 361 Introduction to Computer Graphics Torsten Möller Graphics Pipeline Hardware Modelling Transform Visibility Illumination + Shading Perception, Interaction Color Texture/ Realism

More information

Shading. Brian Curless CSE 457 Spring 2017

Shading. Brian Curless CSE 457 Spring 2017 Shading Brian Curless CSE 457 Spring 2017 1 Reading Optional: Angel and Shreiner: chapter 5. Marschner and Shirley: chapter 10, chapter 17. Further reading: OpenGL red book, chapter 5. 2 Basic 3D graphics

More information

Surface Rendering Methods

Surface Rendering Methods Surface Rendering Methods 6 th Week, 2008 Sun-Jeong Kim Polygon Rendering Methods Determining the surface intensity at every projected pixel position using an illumination model Light-material interactions

More information

CS 148, Summer 2012 Introduction to Computer Graphics and Imaging

CS 148, Summer 2012 Introduction to Computer Graphics and Imaging http://www.ann.jussieu.fr/~frey/papers/scivi/cook%20r.l.,%20a%20reflectance%20model%20for%20computer%20graphics.pdf CS 148, Summer 2012 Introduction to Computer Graphics and Imaging f(~v 2 ) A 3 A 1 f(~v

More information

CS580: Ray Tracing. Sung-Eui Yoon ( 윤성의 ) Course URL:

CS580: Ray Tracing. Sung-Eui Yoon ( 윤성의 ) Course URL: CS580: Ray Tracing Sung-Eui Yoon ( 윤성의 ) Course URL: http://sglab.kaist.ac.kr/~sungeui/gcg/ Recursive Ray Casting Gained popularity in when Turner Whitted (1980) recognized that recursive ray casting could

More information

Rendering. Illumination Model. Wireframe rendering simple, ambiguous Color filling flat without any 3D information

Rendering. Illumination Model. Wireframe rendering simple, ambiguous Color filling flat without any 3D information llumination Model Wireframe rendering simple, ambiguous Color filling flat without any 3D information Requires modeling interaction of light with the object/surface to have a different color (shade in

More information

CS452/552; EE465/505. Intro to Lighting

CS452/552; EE465/505. Intro to Lighting CS452/552; EE465/505 Intro to Lighting 2-10 15 Outline! Projection Normalization! Introduction to Lighting (and Shading) Read: Angel Chapter 5., sections 5.4-5.7 Parallel Projections Chapter 6, sections

More information

Lighting affects appearance

Lighting affects appearance Lighting affects appearance 1 Source emits photons Light And then some reach the eye/camera. Photons travel in a straight line When they hit an object they: bounce off in a new direction or are absorbed

More information

CSE 167: Introduction to Computer Graphics Lecture #6: Colors. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2013

CSE 167: Introduction to Computer Graphics Lecture #6: Colors. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2013 CSE 167: Introduction to Computer Graphics Lecture #6: Colors Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2013 Announcements Homework project #3 due this Friday, October 18

More information

Computer Graphics Lighting

Computer Graphics Lighting Lighting 1 Mike Bailey mjb@cs.oregonstate.edu This work is licensed under a Creative Commons Attribution-NonCommercial- NoDerivatives 4.0 International License Lighting.pptx Why Do We Care About Lighting?

More information