Komputer Grafik 2 AK 045206 Pencahayaan Lighting Realisme

  • Slides: 34
Download presentation
Komputer Grafik 2 (AK 045206) Pencahayaan (Lighting) Realisme dan Pencahayaan 1

Komputer Grafik 2 (AK 045206) Pencahayaan (Lighting) Realisme dan Pencahayaan 1

Komputer Grafik 2 (AK 045206) Outline • Pengenalan Pencahayaan • Sumber sumber Cahaya :

Komputer Grafik 2 (AK 045206) Outline • Pengenalan Pencahayaan • Sumber sumber Cahaya : Ambient, langsung, titik, dll • Hukum Cosinus Lambert/ difusi • Model Phong Realisme dan Pencahayaan 2

Komputer Grafik 2 (AK 045206) Introduction • Typical three step development process 1. Understand

Komputer Grafik 2 (AK 045206) Introduction • Typical three step development process 1. Understand the real system – how does light work (Physics) 2. Determine what matters to us – what can we sense (Psyc) 3. Engineer a system that remains true to the portion of reality we can appreciate Realisme dan Pencahayaan 3

Komputer Grafik 2 (AK 045206) Solving the Lighting Problem – We somewhat understand the

Komputer Grafik 2 (AK 045206) Solving the Lighting Problem – We somewhat understand the perception of light (color) – We engineered a solution to representing and generating color using computers – We need to understand the interplay of light and objects Realisme dan Pencahayaan 4

Komputer Grafik 2 (AK 045206) Optical Illusion Realisme dan Pencahayaan 5

Komputer Grafik 2 (AK 045206) Optical Illusion Realisme dan Pencahayaan 5

Komputer Grafik 2 (AK 045206) Lighting • Remember, we know how to rasterize –

Komputer Grafik 2 (AK 045206) Lighting • Remember, we know how to rasterize – Given a 3 D triangle and a 3 D viewpoint, we know which pixels represent the triangle • But what color should those pixels be? Realisme dan Pencahayaan 6

Komputer Grafik 2 (AK 045206) Lighting • If we’re attempting to create a realistic

Komputer Grafik 2 (AK 045206) Lighting • If we’re attempting to create a realistic image, we need to simulate the lighting of the surfaces in the scene – Fundamentally simulation of physics and optics – As you’ll see, we use a lot of approximations (a. k. a perceptually based hacks) to do this simulation fast enough Realisme dan Pencahayaan 7

Komputer Grafik 2 (AK 045206) Definitions • Illumination: the transport of energy from light

Komputer Grafik 2 (AK 045206) Definitions • Illumination: the transport of energy from light sources to surfaces & points – Note: includes direct and indirect illumination Images by Henrik Wann Jensen Realisme dan Pencahayaan 8

Komputer Grafik 2 (AK 045206) Definitions • Lighting: the process of computing the luminous

Komputer Grafik 2 (AK 045206) Definitions • Lighting: the process of computing the luminous intensity (i. e. , outgoing light) at a particular 3 D point, usually on a surface • Shading: the process of assigning colors to pixels (why the distinction? ) Realisme dan Pencahayaan 9

Komputer Grafik 2 (AK 045206) Definitions • Illumination models fall into two categories: –

Komputer Grafik 2 (AK 045206) Definitions • Illumination models fall into two categories: – Empirical: simple formulations that approximate observed phenomenon – Physically based: models based on the actual physics of light interacting with matter • We mostly use empirical models in interactive graphics for simplicity • Increasingly, realistic graphics are using physically based models Realisme dan Pencahayaan 10

Komputer Grafik 2 (AK 045206) Components of Illumination • Two components of illumination: light

Komputer Grafik 2 (AK 045206) Components of Illumination • Two components of illumination: light sources and surface properties • Light sources (or emitters) – Spectrum of emittance (i. e. , color of the light) – Geometric attributes • Position • Direction • Shape – Directional attenuation – Polarization Realisme dan Pencahayaan 11

Komputer Grafik 2 (AK 045206) Components of Illumination • Surface properties – Reflectance spectrum

Komputer Grafik 2 (AK 045206) Components of Illumination • Surface properties – Reflectance spectrum (i. e. , color of the surface) – Subsurface reflectance – Geometric attributes • Position • Orientation • Micro structure Realisme dan Pencahayaan 12

Komputer Grafik 2 (AK 045206) Simplifications for Interactive Graphics – Only direct illumination from

Komputer Grafik 2 (AK 045206) Simplifications for Interactive Graphics – Only direct illumination from emitters to surfaces – Simplify geometry of emitters to trivial cases Realisme dan Pencahayaan 13

Komputer Grafik 2 (AK 045206) Ambient Light Sources • Objects not directly lit are

Komputer Grafik 2 (AK 045206) Ambient Light Sources • Objects not directly lit are typically still visible – e. g. , the ceiling in this room, undersides of desks • This is the result of indirect illumination from emitters, bouncing off intermediate surfaces • Too expensive to calculate (in real time), so we use a hack called an ambient light source – No spatial or directional characteristics; illuminates all surfaces equally – Amount reflected depends on surface properties Realisme dan Pencahayaan 14

Komputer Grafik 2 (AK 045206) Ambient Light Sources • For each sampled wavelength (R,

Komputer Grafik 2 (AK 045206) Ambient Light Sources • For each sampled wavelength (R, G, B), the ambient light reflected from a surface depends on – The surface properties, kambient – The intensity, Iambient, of the ambient light source (constant for all points on all surfaces ) • Ireflected = kambient Iambient Realisme dan Pencahayaan 15

Komputer Grafik 2 (AK 045206) Ambient Light Sources • A scene lit only with

Komputer Grafik 2 (AK 045206) Ambient Light Sources • A scene lit only with an ambient light source: Light Position Not Important Viewer Position Not Important Surface Angle Not Important Realisme dan Pencahayaan 16

Komputer Grafik 2 (AK 045206) Directional Light Sources • For a directional light source

Komputer Grafik 2 (AK 045206) Directional Light Sources • For a directional light source we make simplifying assumptions – Direction is constant for all surfaces in the scene – All rays of light from the source are parallel • As if the source were infinitely far away from the surfaces in the scene • A good approximation to sunlight • The direction from a surface to the light source is important in lighting the surface Realisme dan Pencahayaan 17

Komputer Grafik 2 (AK 045206) Directional Light Sources • The same scene lit with

Komputer Grafik 2 (AK 045206) Directional Light Sources • The same scene lit with a directional and an ambient light source Light Position Not Important Surface Angle Important Viewer Position Not Important Realisme dan Pencahayaan 18

Komputer Grafik 2 (AK 045206) Point Light Sources • A point light source emits

Komputer Grafik 2 (AK 045206) Point Light Sources • A point light source emits light equally in all directions from a single point • The direction to the light from a point on a surface thus differs for different points: – So we need to calculate a normalized vector to the light source for every point we light: l p Realisme dan Pencahayaan 19

Komputer Grafik 2 (AK 045206) Point Light Sources • Using an ambient and a

Komputer Grafik 2 (AK 045206) Point Light Sources • Using an ambient and a point light source: Light Position Important Viewer Position Important Surface Angle Important Realisme dan Pencahayaan 20

Komputer Grafik 2 (AK 045206) Other Light Sources • Spotlights are point sources whose

Komputer Grafik 2 (AK 045206) Other Light Sources • Spotlights are point sources whose intensity falls off directionally. – Requires color, point direction, falloff parameters – Supported by Open. GL Realisme dan Pencahayaan 21

Komputer Grafik 2 (AK 045206) Other Light Sources • Area light sources define a

Komputer Grafik 2 (AK 045206) Other Light Sources • Area light sources define a 2 D emissive surface (usually a disc or polygon) – Good example: fluorescent light panels – Capable of generating soft shadows (why? ) Realisme dan Pencahayaan 22

Komputer Grafik 2 (AK 045206) Lambert’s Cosine Law • Ideal diffuse surfaces reflect according

Komputer Grafik 2 (AK 045206) Lambert’s Cosine Law • Ideal diffuse surfaces reflect according to Lambert’s cosine law: The energy reflected by a small portion of a surface from a light source in a given direction is proportional to the cosine of the angle between that direction and the surface normal • These are often called Lambertian surfaces • Note that the reflected intensity is independent of the viewing direction, but does depend on the surface orientation with regard to the light source Realisme dan Pencahayaan 23

Komputer Grafik 2 (AK 045206) Lambert’s Law Realisme dan Pencahayaan 24

Komputer Grafik 2 (AK 045206) Lambert’s Law Realisme dan Pencahayaan 24

Komputer Grafik 2 (AK 045206) Computing Diffuse Reflection • The angle between the surface

Komputer Grafik 2 (AK 045206) Computing Diffuse Reflection • The angle between the surface normal and the incoming light is the angle of incidence: l n • Idiffuse = kd Ilight cos • In practice we use vector arithmetic: • Idiffuse = kd Ilight (n • l) Realisme dan Pencahayaan 25

Komputer Grafik 2 (AK 045206) Diffuse Lighting Examples • We need only consider angles

Komputer Grafik 2 (AK 045206) Diffuse Lighting Examples • We need only consider angles from 0° to 90° (Why? ) • A Lambertian sphere seen at several different lighting angles: Realisme dan Pencahayaan 26

Komputer Grafik 2 (AK 045206) Phong Lighting • The most common lighting model in

Komputer Grafik 2 (AK 045206) Phong Lighting • The most common lighting model in computer graphics was suggested by Phong: • The nshiny term is a purely empirical constant that varies the rate of falloff • Though this model has no physical basis, it works (sort of) in practice Realisme dan Pencahayaan v 27

Komputer Grafik 2 (AK 045206) Phong Lighting: The nshiny Term • This diagram shows

Komputer Grafik 2 (AK 045206) Phong Lighting: The nshiny Term • This diagram shows how the Phong reflectance term drops off with divergence of the viewing angle from the ideal reflected ray: Viewing angle – reflected angle • What does this term control, visually? Realisme dan Pencahayaan 28

Komputer Grafik 2 (AK 045206) Calculating Phong Lighting • The cos term of Phong

Komputer Grafik 2 (AK 045206) Calculating Phong Lighting • The cos term of Phong lighting can be computed using vector arithmetic: – V is the unit vector towards the viewer – R is the ideal reflectance direction • An aside: we can efficiently calculate r? Realisme dan Pencahayaan v 29

Komputer Grafik 2 (AK 045206) Calculating The R Vector • This is illustrated below:

Komputer Grafik 2 (AK 045206) Calculating The R Vector • This is illustrated below: Realisme dan Pencahayaan 30

Komputer Grafik 2 (AK 045206) Phong Examples • These spheres illustrate the Phong model

Komputer Grafik 2 (AK 045206) Phong Examples • These spheres illustrate the Phong model as l and nshiny are varied: Realisme dan Pencahayaan 31

Komputer Grafik 2 (AK 045206) The Phong Lighting Model • Let’s combine ambient, diffuse,

Komputer Grafik 2 (AK 045206) The Phong Lighting Model • Let’s combine ambient, diffuse, and specular components: • Commonly called Phong lighting – Note: once per light – Note: once per color component – Do ka, kd, and ks vary with color component? Realisme dan Pencahayaan 32

Komputer Grafik 2 (AK 045206) Phong Lighting: Intensity Plots Realisme dan Pencahayaan 33

Komputer Grafik 2 (AK 045206) Phong Lighting: Intensity Plots Realisme dan Pencahayaan 33

Komputer Grafik 2 (AK 045206) Referensi • 1: , 4: Graphics. Slides 09. pdf

Komputer Grafik 2 (AK 045206) Referensi • 1: , 4: Graphics. Slides 09. pdf , 5: , 8: , Global. Illumination. ppt, local. Illumination. ppt , 9: Lecture 14 • Buku Teks : 1. F. S. Hill, Jr. , COMPUTER GRAPHICS – Using Open GL, Second Edition, Prentice Hall, 2001 2. Foley, van Dam, Feiner, Hughes, and Philips, Introduction to Computer Graphics, Addison Wesley, 2000 • Lecture Notes / Slide-Presentation / Referensi lain yang diperoleh melalui internet : 3. Andries van Dam, Introduction to Computer Graphics, Slide Presentation, Brown University, 2003, (folder : brown. Uni) 4. ________, Interactive Computer Graphic, Slide Presentation, (folder : Lect_IC_AC_UK) 5. Michael CS 488/688 Mc. Cool, : Introduction to Computer Graphics, Lecture Notes, University of Waterloo, 2003 (lecturenotes. pdf) 6. ________, Computer Science 559, Slide Presentation, Wisconsin University, (folder : Lect_Wisc_EDU) 7. http: //graphics. lcs. mit. edu/classses/6. 837/F 98/Lecture 4/Slide 23. ht ml , Slide Presentation, MIT, (folder : MIT_Course. Note) 8. ________, CS 319 : Advance Topic in Computer Graphics, Slide Presentation, (folder : uiuc_cs) 9. ________, CS 445/645 : Introduction to Computer Graphics, Slide Presentation, (folder : COMP_GRAFIK) 10. Gladimir V. G. Baranoski, CS 488 : Introduction to Computer Graphics , Waterloo University 11. Prof. Peter Panfilov , http: //cse. yeditepe. edu. tr/~osertel/courses/CSE 484/index. html 12. http: //www. cl. cam. ac. uk/Teaching/1998/AGraphics/l 3 a. html Realisme dan Pencahayaan 34