Presentation is loading. Please wait.

Presentation is loading. Please wait.

Computer Graphics Ken-Yi Lee National Taiwan University (the slides are adapted from Bing-Yi Chen and Yung-Yu Chuang)

Similar presentations


Presentation on theme: "Computer Graphics Ken-Yi Lee National Taiwan University (the slides are adapted from Bing-Yi Chen and Yung-Yu Chuang)"— Presentation transcript:

1 Computer Graphics Ken-Yi Lee National Taiwan University (the slides are adapted from Bing-Yi Chen and Yung-Yu Chuang)

2 Illumination and Shading  Illumination Models Phong Illumination Model  Shading Models for Polygons  Shadows  Transparency  Global Illumination  Recursive Ray Tracing  Radiosity  The Rendering Pipeline

3 Illumination Models  Interaction of light with the surface. Viewing Objects (Shape & Color) Light Sources Reflectance

4 Light Source Models  Real light sources are complicated.  General light sources are difficult to work with. The number of light paths between a light source and a point on the surface may not be only one but infinity.

5 Simple Light Source Models  Point Light Position and Color (Intensity)  Directional light Direction and Color (Intensity)  Spotlight Direction, Cone angle, Color (Intensity), etc.  Ambient Light Color (Intensity) Less parameters Efficient computation Less parameters Efficient computation

6 Illumination Models  Interaction of light with the surface. Reflectance Light Sources

7 Interaction of Light with a Point Incident Light Reflected Light Normal Surface Refracted Light Absorption Reflection Refraction

8 Reflectance Models smooth surfacerough surface

9 Simple Reflectance Models  Specular Reflectance  Diffuse Reflectance (Lambertian)

10 [Recap] Illumination Models  Interaction of light with the surface. Viewing Objects (Shape & Color) Light Sources Reflectance

11 Direct/Indirect Lighting Direct LightingDirect + Indirect Lighting

12 Local/Global Illumination  Local Illumination Only consider the relationship between light sources and a single primitive  When you calculate the illumination, you won’t need the information of any other primitive.  Global Illumination Consider the relationship between light sources and all primitives  When you calculate the illumination, you should take other primitives into account.

13 Phong Illumination Model  A local illumination model that can be computed rapidly  Three components: Ambient (Indirect lighting) Diffuse Specular ambientdiffuse specular

14 Ambient Component  The component approximates the indirect lighting by a constant.  : ambient light intensity (color)  : ambient reflection coefficient (0 ~ 1)  : color of the object Light Source PropertyMaterial Property

15 Diffuse Component  The component describes the diffuse reflection of rough surfaces.  : intensity (color) of the point light source  : diffuse reflection coefficient (0 ~ 1)  : color of the object θ N Lambertian Cosine Law

16 Examples 0.40.55 0.7 0.85 1.0 Diffuse reflection component with different 0.00.15 0.3 0.45 0.6 ambient and diffuse reflection components with different and

17 Specular Reflectance

18 Specular Component  The component describes the specular reflection of smooth (shiny/glossy) surfaces.  : intensity (color) of the point light source  : specular reflection coefficient (0 ~ 1)  : shininess N R V L

19 Shininess ( ) n=1 n=2 n=3 n=10

20 Examples

21 Comparison diffusediffuse + specular

22 Phong Illumination Model ambientdiffuse specular ambientdiffusespecular

23 Light Source Attenuation  Light source attenuation determines how fast the light intensity (color) decreases with distance.  : attenuation factor  : constant, linear, and quadratic attenuation coefficient  : distance from light source to object

24 Phong Illumination Model N R V L θ

25 Reflection Vector ( )

26 The Halfway Vector ( ) (Blinn-Phong)

27 Multiple Light Sources  If there are light sources, then

28 Shading Models for Polygons  Why we need shading ?  Shading models: Flat Shading Gouraud Shading Phong Shading

29 Flat Shading  Same normal, light vector and view vector across whole polygon Compute illumination only once for each polygon

30 Gouraud Shading  Interpolate the intensities computed at vertices

31 Intensity Interpolation

32 Comparison Flat Shading Gouraud Shading

33 Smoothed Normal Vector Gouraud Shading Phong Shading

34  Interpolate the normal vectors of vertices, and compute illumination at each pixel

35 Normal Interpolation

36 Gouraud v.s. Phong Shading GouraudPhongGouraudPhong

37 Flat Shading

38 Gouraud Shading

39 Phong Shading

40 Texture Mapping = Pattern Mapping

41 Bump Mapping & Displacement Mapping Copyright©2003, Microsoft

42 The Rendering Pipeline  Local Illumination Pipelines z-buffer and Gouraud shading z-buffer and Phong shading list-priority algorithm and Phong shading

43 Rendering Pipeline for z-buffer & Gouraud shading (OpenGL) Viewing transformation db traversal Modeling transformation Trivial accept / reject LightingClipping Divide by W, map to 3D viewport RasterizationDisplay

44 Rendering Pipeline for z-buffer & Phong shading (OpenGL with GLSL) Viewing transformation db traversal Modeling transformation Trivial accept / reject Clipping Divide by W, map to 3D viewport Rasterization (with lighting) Display

45 Rendering Pipeline for list-priority algorithm & Phong shading Viewing transformation db traversal Modeling transformation Trivial accept / reject Clipping Divide by W, map to 3D viewport Rasterization (with lighting) Display Preliminary visible-surface determination New db New db traversal

46 Global Effects  Some global effects are very important to visual quality. Therefore, we may want to utilize the existing rendering pipeline (local illumination model) to add (approximated) global effects. Use multiple passes with per-pixel buffers  Common global effects : Shadow Transparency

47 Shadows   How to determine ? Shadow mapping  Not accurate enough Shadow volumes  Performance issues

48 Scan-Line Generation of Shadows Viewer Light Current scan line A A’A’ B a b c d

49 Shadow Volumes Light Object A B C shadow polygons

50 Shadow Volumes z x A B C V

51 Transparency  Blending  Z-buffer Turn off

52 Global Illumination  Popular methods: Ray Tracing  Static view  View-dependent effect Radiosity  Static light (diffuse scene) from Wikipedia

53 Ray Tracing

54 Recursive Ray Tracing  Only consider three directions: Perfect reflected ray Perfect refracted ray Shadow ray Perfect reflected ray Shadow ray Perfect refracted ray

55 Reflection

56 Ray Tracing Results

57 Monte Carlo Ray Tracing  Randomly select one direction: Tracing ray Shadow ray

58 Ray Tracing Results

59

60

61

62 Radiosity  Split the scene into many patches  Simulate light transmission between every patch pair. Assume diffuse reflectance

63 The Radiosity Equation (1)  : radiosity of patch : rate at which light is emitted from patch : reflectivity of patch : form factor (configuration factor) : area of patch  since  thus

64 The Radiosity Equation (2)  rearranging terms  therefore  progressive refinement

65 Computing Form Factors visible or invisible 1 0

66 Hemisphere

67 Hemicube

68

69 Rendering Pipeline for radiosity & Gouraud shading (OpenGL) Viewing transformation db traversal Modeling transformation Trivial accept / reject Clipping Divide by W, map to 3D viewport RasterizationDisplay Vertex intensity calculation using radiosity method New db New db traversal

70 Rendering Pipeline for ray tracing db traversal Modeling transformation Ray tracingDisplay


Download ppt "Computer Graphics Ken-Yi Lee National Taiwan University (the slides are adapted from Bing-Yi Chen and Yung-Yu Chuang)"

Similar presentations


Ads by Google