Presentation is loading. Please wait.

# Komputer Grafik 2 (AK045206) Realisme dan Pencahayaan 1/34 Pencahayaan (Lighting)

## Presentation on theme: "Komputer Grafik 2 (AK045206) Realisme dan Pencahayaan 1/34 Pencahayaan (Lighting)"— Presentation transcript:

Komputer Grafik 2 (AK045206) Realisme dan Pencahayaan 1/34 Pencahayaan (Lighting)

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

Komputer Grafik 2 (AK045206) Realisme dan Pencahayaan 3/34 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

Komputer Grafik 2 (AK045206) Realisme dan Pencahayaan 4/34 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

Komputer Grafik 2 (AK045206) Realisme dan Pencahayaan 5/34 Optical Illusion

Komputer Grafik 2 (AK045206) Realisme dan Pencahayaan 6/34 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?

Komputer Grafik 2 (AK045206) Realisme dan Pencahayaan 7/34 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

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

Komputer Grafik 2 (AK045206) Realisme dan Pencahayaan 9/34 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?)

Komputer Grafik 2 (AK045206) Realisme dan Pencahayaan 10/34 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

Komputer Grafik 2 (AK045206) Realisme dan Pencahayaan 11/34 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

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

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

Komputer Grafik 2 (AK045206) Realisme dan Pencahayaan 14/34 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

Komputer Grafik 2 (AK045206) Realisme dan Pencahayaan 15/34 Ambient Light Sources For each sampled wavelength (R, G, B), the ambient light reflected from a surface depends on –The surface properties, k ambient –The intensity, I ambient, of the ambient light source (constant for all points on all surfaces ) I reflected = k ambient I ambient

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

Komputer Grafik 2 (AK045206) Realisme dan Pencahayaan 17/34 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

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

Komputer Grafik 2 (AK045206) Realisme dan Pencahayaan 19/34 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: p l

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

Komputer Grafik 2 (AK045206) Realisme dan Pencahayaan 21/34 Other Light Sources Spotlights are point sources whose intensity falls off directionally. –Requires color, point direction, falloff parameters –Supported by OpenGL

Komputer Grafik 2 (AK045206) Realisme dan Pencahayaan 22/34 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? )

Komputer Grafik 2 (AK045206) Realisme dan Pencahayaan 23/34 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

Komputer Grafik 2 (AK045206) Realisme dan Pencahayaan 24/34 Lambert’s Law

Komputer Grafik 2 (AK045206) Realisme dan Pencahayaan 25/34 Computing Diffuse Reflection The angle between the surface normal and the incoming light is the angle of incidence: I diffuse = k d I light cos  In practice we use vector arithmetic: I diffuse = k d I light (n l) nl 

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

Komputer Grafik 2 (AK045206) Realisme dan Pencahayaan 27/34 Phong Lighting The most common lighting model in computer graphics was suggested by Phong: The n shiny 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 v

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

Komputer Grafik 2 (AK045206) Realisme dan Pencahayaan 29/34 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? v

Komputer Grafik 2 (AK045206) Realisme dan Pencahayaan 30/34 Calculating The R Vector This is illustrated below:

Komputer Grafik 2 (AK045206) Realisme dan Pencahayaan 31/34 Phong Examples These spheres illustrate the Phong model as l and n shiny are varied:

Komputer Grafik 2 (AK045206) Realisme dan Pencahayaan 32/34 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 k a, k d, and k s vary with color component?

Komputer Grafik 2 (AK045206) Realisme dan Pencahayaan 33/34 Phong Lighting: Intensity Plots

Komputer Grafik 2 (AK045206) Realisme dan Pencahayaan 34/34 Referensi 1:, 4:GraphicsSlides09.pdf, 5:, 8:, GlobalIllumination.ppt, localIllumination.ppt, 9:Lecture14 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 : brownUni) 4._______________, Interactive Computer Graphic, Slide- Presentation, (folder : Lect_IC_AC_UK) 5.­­­­­­­­­­­­­­­­­­­­­Michael McCool, CS 488/688 :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/F98/Lecture4/Slide23.ht ml, Slide-Presentation, MIT, (folder : MIT_CourseNote)http://graphics.lcs.mit.edu/classses/6.837/F98/Lecture4/Slide23.ht ml 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/CSE484/index.html http://cse.yeditepe.edu.tr/~osertel/courses/CSE484/index.html 12.http://www.cl.cam.ac.uk/Teaching/1998/AGraphics/l3a.htmlhttp://www.cl.cam.ac.uk/Teaching/1998/AGraphics/l3a.html

Download ppt "Komputer Grafik 2 (AK045206) Realisme dan Pencahayaan 1/34 Pencahayaan (Lighting)"

Similar presentations

Ads by Google