200 likes | 319 Vues
ייצוג בעולם 3D. ייצוג מצולעים (פוליגונים). צלע. משולש. V1. קודקוד. T1. e3. e0. T2. צלע e0 : {v1,v2}. T0. V0. משולש T2 :{v0,v1,v2}. T3. e1. e2. דוגמאות. כך זה נראה בגדול. נוסיף צבע לעולם. ועוד תאורה . נעדן את התאורה . עכשיו זה נראה בסדר. עם כל השיפורים.
E N D
ייצוג בעולם 3D • ייצוג מצולעים (פוליגונים) צלע משולש V1 קודקוד T1 e3 e0 T2 צלעe0 : {v1,v2} T0 V0 משולשT2 :{v0,v1,v2} T3 e1 e2
Illumination and Shading Reflection Specular Light in • How to shade a surface • Position (Light/Surface) • Orientation (Light/Surface) • Characteristics (Light/Surface) • Local Illumination Models • Individual point and • The light source/s Illuminate it • Global Illumination Models • The light source and • The interchange of light between all the surfaces Reflection (diffuse) Internal Reflection Transmitted Light emission
I = k i Ambient Light • Non reflective • Self-luminous • Illumination equation • I is the resulting intensity • Ki is the object’s intrinsic intensity • An ambient illumination variable is associated with each point • Evaluating the ambient equation <==> Lighting the object.
I = I k cos(q) p d Diffuse Reflection • Point light source • The brightness depends on the angle qbetween direction to the light L and the surface normal N • If the light bean • Has cross sectional deferential are dA • It intercepts an area dA/cos(q) of the surface. q N q N dA dA/cos(q ) S2 S1
Combining Shading Models Series of pictures of sphere illuminated by diffuse reflection model only using different Kd values (0.4, 0.55, 0.7, 0.85,1.0). Series of pictures of sphere illuminated by ambient and diffuse reflection model. Ia = Ib = 1.0, Kd = 0.4 and Ka = {0.0, 0.15, 0.30, 0.45, 0.60}
Specular Reflection Phone Illumination N R L Developed by Phong Bui-Toung for nonperfect reflection. The model assumes that the maximum specular reflection occurs when is zero and falls off sharply as increases. The rapid falloff is approximated by cos () . V n I = IaKa+ fatt Id [KdOd cos() +W()cos ()] n Od :Object diffuse factor. W():Factor of specular reflection light
Shading Models for Polygons Shading We can shade a surface by calculating the surface normal at each visible point and applying the desired model at that point. Constant Flat Shading Applies an illumination model one to determine a singles intensity value that is then used to shade the entire polygon. Interpolated Shading Shading information is linearly interpolated across triangle from illumination values determined at it vertices
Polygon Mesh Shading Gouraud Shadingextends the concept of interpolated shading applied to individual polygons by interpolating polygon vertex illumination values that take into account the surface being approximated. A vertex intensity is computed by using the vertex normal with any desired shading model. Phong Shadinginterpolates the surface normal vector, rather than the intensity. Interpolation occurs across a polygon span on a scan line.
Interpolated Shading Problems • Polygonal Silhouette • Perspective distortion • Orientation dependence • Problem at shared vertices • Inaccurate vertex normal
Light & Material in OpenGL GLfloatlit_mbient[] = {0.2, 0.2, 0.2, 1.0}; GLfloatlit_diffuse[] = {1.0, 1.0, 1.0, 1.0}; GLfloatlit_specular[] = {1.0, 1.0, 1.0, 1.0}; GLfloatlit_position[] = {-2.0, 1.0, 3.0, 1.0}; GLfloatlit_spot_dir[] = {-1.0, -1.0, -1.0}; GLfloatlit_shine[] = {50.0}; glShadeModel(GL_SMOOTH); glEnable(GL_LIGTING); glEnable(GL_LIGHT0); glLightfv(GL_LIGHT0, GL_POSITION, lit_ position); glLightfv(GL_LIGHT0, GL_AMBIENT, lit_ ambient); glLightfv(GL_LIGHT0, GL_DIFFUSE, lit_diffuse); glLightfv(GL_LIGHT0, GL_SPECULAR, lit_specular); glLightfv(GL_LIGHT0, GL_SPECULAR, lit_specular); glLightfv(GL_LIGHT0, GL_SHININESS, lit_shine);