Computer Graphics as Virtual Photography real camera photo Photographic Photography: scene (captures processing print Material Properties light) processing Illumination Models / BRDFs camera Computer 3D synthetic tone model Graphics: models image reproduction (focuses simulated lighting) Lighting vs. Shading Shading • Commonly misused terms. • Computing the light that leaves a point • Shading point - point under investigation • What’s the difference? • Illumination model - function or algorithm used to • Lighting / Illumination designates the interaction describe the reflective characteristics of a given between materials and light sources. surface. • Shading is the process of determining the color of • Shading model – algorithm for using an illumination a pixel. model to determine the color of a point on a surface. – Usually determined by lighting. • For efficiency’s sake, most illumination models are – Could use other methods: random color, NPR, etc. approximations. Bi-directional Reflectance Functions (BRDF) Reflections • Ambient – light uniformly incident from the environment • Diffuse – light scattered equally in all directions • Ambient and Diffuse – color of material plays a part • Specular – highlights connected with mirrorness • Specular – mostly color of light 1
BRDF BRDF Geometry • Bi-directional Reflectance Function = φ θ φ θ BRDF f ( , , , ) r i i r r At a given point, gives relative reflected illumination in any direction with respect to incoming illumination coming from any direction; Note: The θ ’s are elevation, ϕ ’s are measured about the surface normal. The i ’s refer to the incident ray; the r ’s to the reflected ray. BRDF BRDF • Can return any positive value. • Simplifying Assumptions wrt the BRDF • Generally wavelength specific. – Light enters and leaves from the same point. • Not necessarily true BRDF = φ θ φ θ λ • Subsurface scattering f ( , , , , ) • Skin, marble r i i r r – Light of a given wavelength will only reflect back light of that same wavelength • Not necessarily true • Light Interference • Oily patches, peacock feathers Illumination Models Illumination Modeling • Four approaches • Illumination model - function or algorithm – Simplistic used to describe the reflective • Based on physics, abiet with many assumptions characteristics of a given surface. – Heuristic • The kludge! • Revise to… • Usually simple, yet not physically based – function or algorithm used in approximating the – Simulation BRDF. • Employ physical model • More complex than heuristic, but more accurate – Empirical • Use measured samples 2
Illumination Models Illumination Models • Illumination Models and Viewing Direction • Geometry – Generally, BRDFs are independent of viewing N V direction H viewer normal – Most Illumination models take viewing Half-way direction into consideration R S reflection source Illumination Models Illumination Models • Recall from Linear Algebra • Geometry – N - normal vector u – S - direction of incoming light θ – R - direction of perfect mirror reflection v – H - halfway between light direction and • = θ viewing direction. u v u v cos – V - viewing direction. Just one reason to normalize! Illumination Modeling Illumination Models • Four approaches • BRDF Viewer – Simplistic – bv by Szymon Rusinkiewicz (Princeton) • Lamertian – http://graphics.stanford.edu/~smr/brdf/bv – Heuristic – SGI, Linux, and Java versions although not • Phong readily available for Java. I have it, if you want – Simulation it, and you’ll need to load Java3D as well! • Cook-Torrance – Empirical • Use measured samples 3
Simplistic Lambert’s Cosine Law • Lambertian Model • The reflected luminous intensity in any direction from a perfectly – Perfectly diffuse surface diffusing surface varies as the cosine – reflection is constant in all directions (k d ) of the angle between the direction of – Independent of viewer direction incident light and the normal vector of – Based on Lambert’s cos law. the surface. – Sometimes mistakenly attributed to Gouraud. • Intuitively • Gouraud didn’t introduce a new lighting model, just a shading method. – cross-sectional area of the “beam” intersecting an element of surface area is smaller for greater angles with the normal. Lambertian Model Lambertian Model • Lambert Model • BRDF Viewer http://graphics.stanford.edu/~smr/brdf/bv = θ = • L ( V ) L S k cos L ( V ) L k ( N S ) d S d Those Were the Days Phong Model • (Or: how not to motivate a 21 st century • Phong Model computer graphics paper.) – introduces specular (mirror-like) reflections • “In trying to improve the quality of the synthetic – Viewer direction becomes more important images, we do not expect to be able to display the – three components object exactly as it would appear in reality, with • ambient - background light (k a ) texture, overcast shadows, etc. We hope only to display an image that approximates the real object • diffuse - Lambertian reflection (k d ) closely enough to provide a certain degree of • specular – mirror-like reflection(k s ) realism.” – Bui Tuong Phong, 1975 4
Phong Model Phong-Blinn Model – Uses halfway angle rather than reflected ∑ ∑ = + • + • k L ( V ) k L k L ( S N) k L ( R V) e a a d i i s i i i i ∑ ∑ = + • + • ambient k diffuse specular L ( V ) k L k L ( S N) k L ( H N) e a a d i i s i i i i ambient diffuse specular Note: L n are radiance terms, include both light and material info Phong-Blinn Model Physically based – based on physics of a surface • BRDF Viewer • Actually developed by Torrance & Sparrow, physicists. http://graphics.stanford.edu/~smr/brdf/bv • Jim Blinn was the first to apply to CG • Cook & Torrance’s was the first complete implementation – components • microfacet model - describes geometry of surface – And how much the microfacets shadow each other. • Fresnel term - describes reflectance • Roughness - describes microfacet distribution. Cook-Torrance Model Cook-Torrance Model • Microfacets • Microfacets – surface is composed of V shaped grooves (microfacets) – Light interactions with microfacets • Reflect - causes specular reflections • Scatter - causes diffuse reflections 5
Cook-Torrance Model Cook-Torrance Model • Microfacets – GeometryTerm • Fresnel Equation for polarized light – Some microfacets may shadow others – Describes reflectance as a function of: • Wavelength of incident light ( λ ) • Index of refraction ( η ( λ )) • Extinction coefficient (ease at which wave can penetrate a surface) ( κ ( λ )) • Angle of incidence ( θ ) ⎧ ⎫ • • • • 2 ( N H)(N V) 2 ( N H)(N S) = ⎨ ⎬ G min 1 , , • • ⎩ ⎭ (V H) (V H) Note: S from before is the L in these diagrams Cook-Torrance Model Cook-Torrance Model • Fresnel equations for polarized light • Fresnel + − θ + θ 2 2 2 a b 2 a cos cos = Perpendicular component – If all quantities known, use Fresnel equations Fs + + θ + θ 2 2 2 2 cos cos a b a – If not, approximate using reflectance off normal • See [Glassner] or [Cook/Torrance81] for details + − θ θ + θ θ 2 2 2 2 a b 2 a sin tan sin tan Parallel component = F F + + θ θ + θ θ p s 2 2 2 2 a b 2 a sin tan sin tan a, b are functions 1 1 = + of η , κ , and θ F F F s p 2 2 η , κ are functions F is total reflectance of λ Cook-Torrance Model Cook-Torrance Model • Roughness • Roughness – Characterizes the distribution of the slopes of the microfacets – Roughness parameter, m • m between 0 -1 • small m - smooth surface, specular reflectance − α = − α 2 2 ((tan ) / m ) ( / m ) e D ce • large m - rough surface, diffuse reflectance = D α 2 4 m cos – Statistical models Gaussian Model Beekman Model c is arbitrary constant 6
Cook-Torrance Model Cook-Torrance Model • Roughness • Putting it all together = + f sf df r s d specular diffuse total reflectance × × 1 1 F D G = = f f s π d π • • ( N S)(N V) Where D is the roughness function, F is the Fresnel function, and G is the geometrical attenuation factor from previous pages Cook-Torrance Model Cook-Torrance Models • Complete Cook-Torrance Model • examples ∑ = + • ϖ L L R L ( N S i )( f ) d r a a i r i i Parameters for f r : � � m – roughness value � Type of material (determines terms for Fresnel eqn) � Wavelength of incident light (determines terms for Fresnel eqn) � Diffuse / specular contribution constants � L a R a is the ambient radiance reflected by R a � L i is the light’s radiance Cook-Torrance Models Cook-Torrance Model • BRDF Viewer • Summary – Complicated model based on physics http://graphics.stanford.edu/~smr/brdf/bv – Components • Microfacets • Fresnel equation • Roughness – Want accuracy? Go to the source! 7
Recommend
More recommend