Presentation is loading. Please wait.

Presentation is loading. Please wait.

Computer Graphics (fall,2010) School of Computer Science University of Seoul Minho Kim.

Similar presentations


Presentation on theme: "Computer Graphics (fall,2010) School of Computer Science University of Seoul Minho Kim."— Presentation transcript:

1 Computer Graphics (fall,2010) School of Computer Science University of Seoul Minho Kim

2 Chapter 8 Rendering Faces for Visual Realism

3 Illumination

4 Light & Color

5 Light Reflection ● Reflected spectrum = incoming light spectrum * reflectance spectrum of the surface ● Diffusive & specular reflections

6 Diffusive Reflection ● Simplification in computer graphics ● Reflected equally to all directions ● Lambertian reflection Lambertian reflection

7 Rendering Equation

8 Rendering Equation (cont'd) ● Reflected light ● Transmitted light? → See this slidethis slide ● To be solved for realistic rendering ● Based on the law of conservation of energy ● Does not capture all the aspects ● Too difficult to solve → approximation requiredapproximation ● Ray-tracing – specular inter-reflections Ray-tracing ● Radiosity – diffuse inter-reflections Radiosity

9 Real-Time Rendering ● Ray-tracing & radiosity are still too complex for real-time rendering → Further approximation required ● Approximations ● Geometry – triangles with independent normals ● Wavelength – three independent color components (RGB) ● Computation – local illuminations only (no inter- reflection, no shadow)local illuminations ● Reflections – decomposed into diffuse/specular/ambient reflections ● Lights – positional & directional lights only

10 Blinn-Phong Shading Model ● OpenGL lighting (shading) model ● Assumed to be broken into (independent) RGB components ● Materials characterized by the percentage of the incoming RGB components that are reflected ● Four (independent) components ● Ambient: bounced & scattered many times, no direction known, lightpos/viewer-independent ● Diffuse: bounced & scattered in all directions, viewer-independent, lightpos-dependent ● Specular: reflected in a preferential direction, lightpos/viewer-dependent ● Emissive: emits light, not affected by lights, not affect lighting

11 Blinn-Phong Shading Model (cont'd) ● Meaning of four components (ambient, diffuse, specular, emissive) for each color ● Lights – intensity ● Materials – reflected proportion

12 Diffusive Reflection Model ● Scatters uniformly in all directions ● The amount of reflected light follows the Lambertian law Lambertian law

13 Phong Specular Reflection Model ● Empirical model, not based on physics

14 Blinn Specular Reflection Model ● Reflection vector needs not be computed → faster computation ● Halfway vector is used instead → different exponent is required for the (almost) same result

15 Ambient Light ● Without ambient light, surfaces not facing any light are rendered completely in black.

16 Putting All Together... ● For each color component (RGB) ● For each light

17 Gauraud Shading (Gauraud Interpolation) ● Normals only at the vertices → how to compute lighting for the interior of triangles? ● Phong interpolation Phong interpolation ● Lighting computation for each pixel using interpolated normal vectors → a.k.a. “per-pixel lighting” ● High cost, good result ● Gauraud interpolation Gauraud interpolation ● Lighting computation at vertices only, color values are interpolated → a.k.a. “per-vertex lighting” ● Low cost, poor result ● OpenGL http://wiki.services.openoffice.org/wiki/Documentation/OOoAuthors_User_Manual/Draw_Guide/Dialog_page_Shadin g

18 OpenGL Lighting ● Per-vertex lighting → (unit) normal vector required for each vertex ● Blinn-Phong shading model + Gouraud shadingGouraud shading ● OpenGL lighting equation OpenGL lighting equation ● Global ambient light ● Material needs to be set for each vertex ● Emissive color for material ● Materials can be set for front/back face separately ● Lights transformed by modelview matrix (not projection matrix) ● No shadow (only a vertex-light pair is considered) ● Reflected light not considered anymore (local illumination)

19 OpenGL Lights ● At least eight lights supported ● Enabled by glEnable(GL_LIGHTING) ● Each light should be enabled by glEnable(GL_LIGHT#) ● Set by glLight glLight ● Directional & positional lights ● Position or direction ● Ambient/diffuse/specular intensity ● Spot light properties ● Attenuation ● Set by glLightModel glLightModel ● Global ambient light ● Performance vs. quality

20 OpenGL Material ● Set as “state” ● Set for each vertex ● Set by glMaterial glMaterial ● Front/back/front&back ● Ambient/diffuse/specular reflectance ● Emissive color ● Shininess – specular exponent

21 OpenGL Vertex Color ● Vertex color = material emission at that vertex + the global ambient light scaled by the material's ambient property at that vertex + the ambient, diffuse, and specular contributions from all the light sources, properly attenuated

22 OpenGL Vertex Color (cont'd) ● Material emission: ● Scaled global ambient light: ● Contributions from light sources = attenuation factor * spotlight effect * (ambient term + diffuse term + specular term) ● Attenuation factor: ● Spotlight effect: 1 / 0 / ● Ambient term: ● Diffuse term: ● Specular term:

23 Programming ● Lighting enabled – glEnable(GL_LIGHTING) ● For each light ● Turned on – glEnable(GL_LIGHT#) ● Set up (type, position, intensity of each component) – glLight* ● For each object (triangle) ● Material (per face & component) – glMaterial* ● Normal vectors – glNormal* ● Requres unit normal vector – GL_NORMALIZE, GL_RESCALE_NORMAL


Download ppt "Computer Graphics (fall,2010) School of Computer Science University of Seoul Minho Kim."

Similar presentations


Ads by Google