From Graphics to Visualization
Introduction Light Sources Surface Lighting Effects Basic (Local ) Illumination Models Polgon-Rendering Methods Texture Mapping Transparenc and Blending Visualization Pipeline outline
Introduction Illumination Model (Lighting/Shading Model) Calculation of color on an illuminated position on the surface of an object Surface Rendering A procedure for appling a lighting model to obtain pixels colors for all projected surface positions
Light Sources Point Source Diverging ra paths from a point light source
Light Sources Distributed Light Source Light ras from an infinitel distant light source illuminate an object along nearl parallel light paths
Surface Lighting Effects Diffuse reflections from a surface (dull/rough surface) (shin surface) Specular reflection superimposed on diffuse reflection vectors (Global Illumination) Surface lighting effects are produced b a combination of illumination from light sources and reflection from other surfaces.
Illumination Models Rendering methods differ in approximating lighting effects Global illumination: ra tracing, accurate b computationall expensive Local illumination: relate the illumination of a given scene point directl to the light set, not to an other scene points If we denote the angle of incidence between the incoming Light direction and the surface
) Ambient Light I ambdif f ka I 2) Diffuse Reflection Basic (Local )Illumination a Models If we denote the angle of incidence between the incoming Light direction and the surface normal as θ Angle of incidence θ between the unit lightsource direction vector L and the unit normal vector N at a surface position.
2) Diffuse Reflection Basic (Local )Illumination Models I I,diff =K d I l cos θ I I,diff =K d I l (N L) k d : diffuse-reflection coefficient, or diffuse reflectivit. Lambertian reflectors Lambert s cosine law Total Diffuse-reflection of a single point-source illumination I diff kai a kai a, k I ( N d l L), if N L 0 if N L 0
Basic (Local )Illumination Models 3) Specular Reflection and Phong Model Specular reflection angle equals angle of incidence θ Phong Specular-Reflection Model (Phong Model) I l, spec I ksil ( V R) 0.0, W ( l, spec n s ) I, if V R if V R l cos n s 0 and N L 0 0 or N L 0 (2-4) (2-5)
Basic (Local )Illumination Models 3) Specular Reflection and Phong Model Modeling specular reflections (shaded area) with parameter n s The projection of either L or R onto the direction of the normal vector N has a magnitude equal to N L. R (2N L) N L
Basic (Local )Illumination Models 3) Specular Reflection and Phong Model Specular reflections from a spherical surface for varing specular parameter values and a single light source
Basic (Local )Illumination Models 3) Specular Reflection and Phong Model Halfwa vector H along the bisector of the angle between L and V. H L V L V
Color Intensit Calculations Phong Algorithm: I = I a + I d + I s I a: ambient reflection I d : diffuse reflection I s : specular reflection I l L N α α β R V I a =k a I e I d =k d I l cosα here cosα =(L N) I s =k s I l cos m β here cosβ=(r V) P L, N, R, V are vectors Multiple light sources: I I a n i I d r i i I s C i r constant Here r i is ithe distance to the light i and C is a i
Shading Technique To Render Solid Surfaces Determines How Surfaces Will Be Filled Process for Computing the Color Intensit Value for Each Pixel Contained in a Polgon The Most Common Shading Techniques Are: Flat Shading glshademodel (GL_FLAT); Gouraud Shading glshademodel (GL_SMOOTH); Phong Shading (OpenGL b default doesn't do phong shading )
Shading Techniques No Shading Flat Shading Gouraud Shading Phong Shading
Flat Shading
Flat Shading Constant Shading Or Flat Shading The Simplest and Cheapest and Therefore Fastest Shading Method Filling An Entire Polgon with One Color Intensit This Model is Onl Valid (Realistic) If: The light source is imagined to be at infinit The viewer is at infinit The polgon is not an approximation to a curved surface
Gouraud Shading
Gouraud Shading Also called Smooth shading Color Interpolation Algorithm Interpolation along polgon edges Interpolation across polgon surfaces V2 V V3 Color Values Given On A Per Vertex Basis Interpolation Along The Edges Interpolation Across The Surface
Gouraud Shading Illustration I 2 s ( x, ) 2 2 s I a I ( x, ) I s I b I 3 ( x, ) 3 3 I I ( ) I ( ) a s 2 2 s 2 I I I ( ) I ( ) b s 3 3 s 3 s x b x a I ( x x ) I ( x x ) a b s b s a I a j I, a, j Ia I I I I, I, I I j a 2 ( I I ) I 2 b, j b, j b b 3 ( I I ) I 3 i s i s s s x b x a ( I I ) b a
Phong Shading
Phong Shading An Interpolation Process Similar To Gouraud Shading Interpolation Over Normal Vector Instead of Vertex Color Normal vectors tell about an objects orientation Surface orientation is important in respect to the position of The observer/viewer of a scene The source of lighting Creates greater realism than Gouraud shading Speciall when combined with an illumination model Usuall implemented through application software Ver computing intense
Phong Shading Illustration (, ) x 2 2 (, ) x 3 3 s N N 3 N 2 N a N b N s ) ( ) ( 2 2 2 s s a N N N ) ( ) ( 3 3 3 s s b N N N ) ( ) ( a s b s b a a b s x x N x x N x x N ), ( x
Fill (Filled) Area Fill-Area Primitives -- An area filled with some solid color or a pattern Surface Tessellation -- Approximating a curved surface with polgon facets (a polgon mesh)
Texture Mapping Texture Mapping (a) Texture Image; (b) Texture-mapped object
Texture Mapping Texture Image
Texture Mapping Texture Mapping: Coordinates Transformations
Texture Mapping Texture Mapping
Transparenc and Blending The Gaussian Surface (a) as Background + (b) as Foreground => blended as (c) The Grid Height plot of e -(x^2+^2) drawn on top of the domain grid
Visualization Pipeline f( x, ) e ( x 2 2 ) Continuous data Data Acquisition float data[n_x,n_] Discrete dataset Data Mapping Class Quad Geometric object Rendering Displaed image