visualisatie
play

Visualisatie BMT Rendering Arjan Kok a.j.f.kok@tue.nl 1 Lecture - PowerPoint PPT Presentation

Visualisatie BMT Rendering Arjan Kok a.j.f.kok@tue.nl 1 Lecture overview Color Rendering Illumination 2 Visualization pipeline Raw Data Data Enrichment/Enhancement Derived Data Visualization Mapping Abstract Visualization


  1. Visualisatie BMT Rendering Arjan Kok a.j.f.kok@tue.nl 1

  2. Lecture overview • Color • Rendering • Illumination 2

  3. Visualization pipeline Raw Data Data Enrichment/Enhancement Derived Data Visualization Mapping Abstract Visualization Object Rendering Displayable Image 3

  4. Color • The electromagnetic spectrum visible to humans contains wavelengths ranging from about 400 to 700 nm • Light we see consists of different intensities of these wavelengths 4

  5. Color • The human eye contains three receptors (cones): for red, green and blue • Color we see is a combination of these Response curves 5

  6. Color systems • Color system • A way to represent color on a computer • Most used: • RGB • HSV 6

  7. RGB-model • 3 primary colors: Red, Green and Blue • Color cube: • Color = point in cube • Additive: • C = rR + gG + bB R B G 7

  8. HSV-model • More user oriented: based on intuitive perception • Hue (0-1 or 0-360°) • Saturation (0-1) • Value (0-1) • Color is point in cone 8

  9. Rendering • How do I generate an image of a scene? • Problems: • World is complex (shape, light) • World is 3 dimensional, screen is 2 dimensional 9

  10. Subdivide problem • Geometric modeling • How do we define shape of objects? • Projection and hidden surface removal • How do we determine what is visible on screen and what is not. • Shading • How do we model color, texture and contribution of light? • Rasterization • Determine pixel values for visible objects 10

  11. Graphics pipeline Geometric model Viewing Camera parameters Visible surface determination Light sources, Shading materials Rasterize Raster display 11

  12. Raster graphics • Currently “standard” for computer graphics • Screen is subdivided in grid of “squares”: picture elements or pixels • Per pixel: n bits information • Resolution: size of grid and number of bits per pixel 12

  13. Raster graphics hardware system bus display CPU system processor memory 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 1 1 1 0 1 0 1 video controller 0 1 1 1 0 0 1 0 0 1 1 1 0 0 1 0 0 0 0 0 0 0 1 0 monitor frame buffer 13

  14. Visualization pipeline Raw Data Data Enrichment/Enhancement Derived Data Visualization Mapping Abstract Visualization Object Rendering Displayable Image 14

  15. Graphics pipeline Geometric model Viewing Camera parameters Visible surface determination Light sources, Shading materials Rasterize Raster display 15

  16. Viewing • Given a 3D model, how do we project this model on screen? • Camera model • Eye/view point: • From which point do we look to the scene? • Target point or viewing direction: • Where do we look at? • Viewing angles: • What lens do we use? 16

  17. The camera 17

  18. Graphics pipeline Geometric model Viewing Camera parameters Visible surface determination Light sources, Shading materials Rasterize Raster display 18

  19. Why illumination 19

  20. Illumination • Illumination model • Illumination (and therefore color) of point on surface is determined by simulation of light in scene • Illumination model is approximation of real light transport • Shading method • determines for which points illumination is computed • determines how illumination for other points is computed 20

  21. Illumination models • Model(s) needed for • Emission of light • Scattering light at surfaces • Reception on camera • Desired model requirement • Accurate • Efficient to compute 21

  22. Point light source • Emits light equally in all directions • Parameters • Intensity I L • Position P (p x ,p y ,p z ) • Approximation for small light sources P 22

  23. Direction light source • Emits light in one direction • Can be regarded as point light source at infinity • E.g. sun • Parameters • Intensity I L • Direction D (d x ,d y ,d z ) D 23

  24. Surface illumination • When light arrives at surface, it can be • Absorbed • Reflected • Transmitted reflection absorption transmission 24

  25. Reflection model • Total intensity on point reflected in certain direction is determined by: • Diffusely reflected light • Specularly reflected light • Reflection of ambient light 25

  26. Diffuse reflection • Incoming light is reflected equally in all directions • Amount of reflected light depends only on angle of incident light viewer surface 26

  27. Diffuse reflection • Lambert’ law: Reflected energy from a surface is proportional to the cosine of the angle of direction of incoming light and normal of surface • I d = k d I L cos(θ) = k d I L ( N • L ) • k d is diffuse reflection coefficient N θ viewer L V surface 27

  28. Specular reflection • Models reflections of shiny surfaces θ θ 28

  29. Specular reflection • Shininess depends on roughness surface • Incident light is reflected unequally in all directions • Reflection strongest near mirror angle very shiny less shiny 29

  30. Specular reflection / Phong • Light intensity observed by viewer depends on angle of incident light and angle to viewer • Phong model: I s = k s I L cos n (α) = k s I L (V•R) n • k s is specular reflection coefficient • n is specular reflection exponent N θ θ L R α V 30

  31. Specular reflection / Phong increasing k s increasing n 31

  32. Ambient light • Even though parts of scene are not directly lit by light sources, they can still be visible • Because of indirect illumination 32

  33. Ambient light • “Ambient” light I A is an approach to this indirect illumination • Ambient light is independent of light sources and viewer position • Contribution of ambient light I = k a I a • k a is ambient reflection coefficient • I a is ambient light intensity (constant over scene) 33

  34. Total illumination model • Total intensity I total at point P seen by viewer is ( ) ∑ = + θ + α I k I I k cos( ) k cos n ( ) total a a i d i s i i ( ) ∑ = + ⋅ + ⋅ n I k I I k ( N L ) k ( V R ) total a a i d i s i i θ 1 θ 0 α 1 α 0 34

  35. Total illumination model • In previous formula k a , k d dependent on wavelength (different values for R, G and B) • Often division into color and reflection coefficient of surface ( ) ( ) ( ) n = + + θ + α ∑ I I k C I I k C cos k C cos totaal e a a a i d d i s s i i where: • 0 ≤ k a , k s , k s ≤ 1 (relative amounts) • C a is ambient reflected color of surface • C d is diffuse reflected color of surface • C s is specular reflected color of surface 35

  36. Only emission and ambient 36

  37. Including diffuse reflection 37

  38. Including specular reflection 38

  39. Illumination model • Given model: • Simple • Effective • Not real world • More advanced models possible 39

  40. Shading • Illumination model computes illumination for a point on surface • But how do we compute the illumination for all points on all (visible) surfaces? • Shading methods: • Flat shading • Gouraud shading • Phong shading 40

  41. Normal vectors • For illumination model we need normal vectors for • the cell center • the cell nodes • every pixel in the image 41

  42. Normal vectors • Cell normals • Node normals • Use the cross product • Compute cell normals of two cell edges for neighbor cells • Average cell normals × v 1 v 2 = n • + + + × n 1 n 2 n 3 n 4 v 1 v 2 = n • 4 42

  43. Flat shading • Determine illumination for one point on cell (e.g. center) • Use this illumination for all points on cell • Disadvantages: • Does not account for changing direction to light source over polygon • Does not account for changing direction to eye over polygon • Discontinuity at polygon boundaries (when curved surface approximated by polygon mesh 43

  44. Flat shading 44

  45. Gouraud shading • Based on interpolation of illumination values • Compute illumination for nodes of cell • Algorithm • for all nodes of cell • get node normal • compute node illumination using this normal • for all pixels in projection of polygon • compute pixel illumination by interpolation of node illuminations 45

  46. Gouraud shading ( ) = − α + α I 1 I I A 1 2 − y y I 1 α = 1 s − y y 1 2 ( ) = − β + β I 1 I I B 1 2 I A I B − y y y s β = 1 s I P − y y 1 3 I 2 = − γ + γ I ( 1 ) I I P A B I 3 − x x γ = A P − x x A B 46

  47. Gouraud shading 47

  48. Gouraud shading • Advantages • Interpolation is simple, hardware implementation • Continuous shading • Better results for curved surfaces • Disadvantages • Subtle illumination effects (e.g. highlights) require high subdivision of surface in very small polygons • Mach banding 48

More recommend