CS530 - Spring 2020 Introduction to Scientific Visualization Graphics Primer Lecture 2 January 14, 2020
Introduction Computer Graphics vs. Visualization “Visualization methods transform data into primitives that are rendered using CG techniques” Today’s objective: understand basic concepts of CG necessary to use a visualization library like VTK CS530 / Spring 2020 : Introduction to Scientific Visualization. 01/14/2020 Graphics Primer 2
Outline Graphics Primitives Colors Shading Rasterization Cameras Fundamental Techniques CS530 / Spring 2020 : Introduction to Scientific Visualization. 01/14/2020 Graphics Primer 3
Graphics Primitives Points Positions in space 2D( x,y ), 3D( x,y,z ) coordinates “ 0-dimensional” objects CS530 / Spring 2020 : Introduction to Scientific Visualization. 01/14/2020 Graphics Primer 4
Graphics Primitives Lines 1-dimensional objects Polygonal description ( ”polyline” ) piecewise linear CS530 / Spring 2020 : Introduction to Scientific Visualization. 01/14/2020 Graphics Primer 5
Graphics Primitives Lines 1-dimensional objects Parametric description P : t 2 I 7! P ( t ) 2 I R n ( e.g., splines) P ( t ) CS530 / Spring 2020 : Introduction to Scientific Visualization. 01/14/2020 Graphics Primer 6
Graphics Primitives Surfaces 2-dimensional objects (in 3D) Polygonal description Triangle mesh (piecewise linear) CS530 / Spring 2020 : Introduction to Scientific Visualization. 01/14/2020 Graphics Primer 7
Graphics Primitives Surfaces 2-dimensional objects Parametric description P : ( u, v ) ⇤ I � J ⌅⇥ P ( u, v ) ⇤ I R n bi-quadratic, bi-cubic, Bezier, splines, NURBS... CS530 / Spring 2020 : Introduction to Scientific Visualization. 01/14/2020 Graphics Primer 8
Primitive Attributes Color Normal Opacity Texture coordinates CS530 / Spring 2020 : Introduction to Scientific Visualization. 01/14/2020 Graphics Primer 9
Outline Graphics Primitives Colors Shading Rasterization Cameras Fundamental Techniques CS530 / Spring 2020 : Introduction to Scientific Visualization. 01/14/2020 Graphics Primer 10
Colors RGB system Black 0,0,0 White 1,1,1 Red 1,0,0 Green 0,1,0 Blue 0,0,1 Yellow 1,1,0 Cyan 0,1,1 Magenta 1,0,1 Sky Blue 1/2,1/2, 1 CS530 / Spring 2020 : Introduction to Scientific Visualization. 01/14/2020 Graphics Primer 11
Colors RGB system encodes colors with 3 scalars Simplified models of human color perception More on the topic next week! CS530 / Spring 2020 : Introduction to Scientific Visualization. 01/14/2020 Graphics Primer 12
Outline Graphics Primitives Colors Shading Rasterization Cameras Fundamental Techniques CS530 / Spring 2020 : Introduction to Scientific Visualization. 01/14/2020 Graphics Primer 13
Shading Shading reveals the shape of 3D objects through their interaction with light Shading creates colors as a function of: surface properties surface normals lights Only covering basics here Surfaces show information, lights show surfaces, shading controls how CS530 / Spring 2020 : Introduction to Scientific Visualization. 01/14/2020 Graphics Primer 14
Shading Phong lighting model (1975): Light reflected by surface is combination of: Specular reflection Diffuse reflection Ambient reflection CS530 / Spring 2020 : Introduction to Scientific Visualization. 01/14/2020 Graphics Primer 15
Shading Phong lighting model (1975): Light reflected by surface is combination of: Specular reflection Diffuse reflection Ambient reflection CS530 / Spring 2020 : Introduction to Scientific Visualization. 01/14/2020 Graphics Primer 15
Shading Phong lighting model (1975): Light reflected by surface is combination of: Specular reflection Diffuse reflection Ambient reflection CS530 / Spring 2020 : Introduction to Scientific Visualization. 01/14/2020 Graphics Primer 15
Shading Phong lighting model (1975): Light reflected by surface is combination of: Specular reflection Diffuse reflection Ambient reflection http://en.wikipedia.org/wiki/Phong_shading CS530 / Spring 2020 : Introduction to Scientific Visualization. 01/14/2020 Graphics Primer 15
Shading Phong lighting model: Ambient reflection CS530 / Spring 2020 : Introduction to Scientific Visualization. 01/14/2020 Graphics Primer 16
Shading Phong lighting model: Ambient reflection Light intensity per light source and per color channel I = k s I s + k d I d + k a I a CS530 / Spring 2020 : Introduction to Scientific Visualization. 01/14/2020 Graphics Primer 16
Shading Phong lighting model: Ambient reflection Light intensity per light source and per color channel I = k s I s + k d I d + k a I a relative contributions (material specific) CS530 / Spring 2020 : Introduction to Scientific Visualization. 01/14/2020 Graphics Primer 16
Shading Phong lighting model: Ambient reflection Light intensity per light source and per color channel I = k s I s + k d I d + k a I a relative contributions (material specific) CS530 / Spring 2020 : Introduction to Scientific Visualization. 01/14/2020 Graphics Primer 16
Shading Phong lighting model: Specular Reflection mirror-like surfaces Specular reflection depends on position of the observer relative to light source and surface normal ⇥ n ⇥ r ⇥ l ⇥ θ v θ γ CS530 / Spring 2020 : Introduction to Scientific Visualization. 01/14/2020 Graphics Primer 17
Shading Phong lighting model: Specular Reflection • I s = I i cos n � = I i cos n < � r, � v > ⇥ n ⇥ r ⇥ l ⇥ θ v θ γ CS530 / Spring 2020 : Introduction to Scientific Visualization. 01/14/2020 Graphics Primer 18
Shading Phong lighting model: Diffuse Reflection Non-shiny surfaces Diffuse reflection depends only on relative position of light source and surface normal. ⇥ n ⇥ l θ CS530 / Spring 2020 : Introduction to Scientific Visualization. 01/14/2020 Graphics Primer 19
Shading Phong lighting model: Diffuse Reflection I d = I i cos ✓ = I i ( ~ n ) l · ~ I d = I i cos � = I i cos < � l, � n > ⇥ n ⇥ l θ CS530 / Spring 2020 : Introduction to Scientific Visualization. 01/14/2020 Graphics Primer 20
Shading Phong lighting model per color channel N X I i ( k d cos( θ ) + k s cos n ( γ )) I = k a I a + i =1 diffuse ambient light specular sum over all light sources ⇥ n ⇥ r ⇥ l ⇥ θ v θ γ CS530 / Spring 2020 : Introduction to Scientific Visualization. 01/14/2020 Graphics Primer 21
Outline Graphics Primitives Colors Shading Rasterization Cameras Fundamental Techniques CS530 / Spring 2020 : Introduction to Scientific Visualization. 01/14/2020 Graphics Primer 22
Rasterization Putting shaded polygons on screen Transform geometric primitives into pixels Lowest level: scan conversion Bresenham, midpoint algorithms CS530 / Spring 2020 : Introduction to Scientific Visualization. 01/14/2020 Graphics Primer 23
Rasterization Putting shaded polygons on screen Transform geometric primitives into pixels Lowest level: scan conversion Bresenham, midpoint algorithms CS530 / Spring 2020 : Introduction to Scientific Visualization. 01/14/2020 Graphics Primer 23
Rasterization Putting shaded polygons on screen Transform geometric primitives into pixels Lowest level: scan conversion Bresenham, midpoint algorithms CS530 / Spring 2020 : Introduction to Scientific Visualization. 01/14/2020 Graphics Primer 23
Rasterization Putting shaded polygons on screen Transform geometric primitives into pixels Lowest level: scan conversion Bresenham, midpoint algorithms CS530 / Spring 2020 : Introduction to Scientific Visualization. 01/14/2020 Graphics Primer 23
Rasterization Putting shaded polygons on screen Transform geometric primitives into pixels Lowest level: scan conversion Bresenham, midpoint algorithms CS530 / Spring 2020 : Introduction to Scientific Visualization. 01/14/2020 Graphics Primer 23
Rasterization Putting shaded polygons on screen Transform geometric primitives into pixels OpenGL (graphics library) takes care of such operations (under the hood in VTK) CS530 / Spring 2020 : Introduction to Scientific Visualization. 01/14/2020 Graphics Primer 24
Back to Shading Flat shading (Color constant per polygon) CS530 / Spring 2020 : Introduction to Scientific Visualization. 01/14/2020 Graphics Primer 25
Back to Shading Gouraud shading (1971) Shade vertices first, then interpolate * colors (*) More on interpolation in the coming weeks... CS530 / Spring 2020 : Introduction to Scientific Visualization. 01/14/2020 Graphics Primer 26
Back to Shading Phong shading Interpolate normals and shade every pixel separately Note: Phong lighting model ≠ Phong shading CS530 / Spring 2020 : Introduction to Scientific Visualization. 01/14/2020 Graphics Primer 27
Outline Graphics Primitives Colors Shading Rasterization Cameras Fundamental Techniques CS530 / Spring 2020 : Introduction to Scientific Visualization. 01/14/2020 Graphics Primer 28
Projections Perspective projection parallel lines do not necessarily remain parallel objects get larger as they get closer fly-through realism CS530 / Spring 2020 : Introduction to Scientific Visualization. 01/14/2020 Graphics Primer 29
Recommend
More recommend