170 likes | 488 Views
Lighting & Shading. Illumination. Without. Local. Global. Global Illumination. Interaction with matter Consider multiple reflections, transmission, shadows Rendering Equation :. BRDF. Local Illumination - Phong Lighting. General Idea:
E N D
Illumination Without Local Global
Global Illumination • Interaction with matter • Consider multiple reflections, transmission, shadows Rendering Equation: BRDF
Local Illumination - Phong Lighting General Idea: • Consider only (non-area) light sources that are directly visible from the point on the objects surface without reflections. • Each point is illuminated independent of its “global” surroundings (except “self”-occlusion of light sources) • Idea: Approximate illumination by three additive components, representing ambient, diffuse and specular lighting.
Local Illumination Ambient Lighting • Hack for replacing true global illumination (i.e. light bouncing off from other objects) • No direction • Incoming light component that is identical everywhere in the whole scenewhere • ka is the ambient material coefficient of reflection with0.0 <= ka <= 1.0 and • Ia is the intensity of the ambient light
Local Illumination Diffuse Lighting • Rough material • Brightness ~ incoming Energy (Lambertian reflection) • Object scatters light into all directions equally • Heuristic reflection model but plausible for certain materials
Local Illumination Diffuse Lighting Power per unit area arriving at point xdepends on the angle of the surface to the light direction (Johann Friedrich Lambert) N Iin J dA‘ J dA
Local Illumination Diffuse Lighting • Rough material • Brightness ~ incoming Energy (Lambertian reflection) • Object scatters light into all directions equally • Heuristic reflection model but physically plausible for certainkd N L Intersection Point
Local Illumination SpecularLighting • Glossy/smooth material • Light is mostly reflected into the directions around the mirror direction RL of L Diffuse Glossy Specular
Local Illumination SpecularLighting: The Phong model • Use cosine power as heuristic • Light is mostly reflected into the directions around the mirror direction RL of L (Rapid decay) • Perfect mirroring only in direction RL(perfect mirror: n ) cosn a N RL eye L a V J J
Local Illumination Careful! If a lightissituatedbehindtheobject (α > 90°) then cos(α) < 0. Discard negative intensityvaluesbyclampingthedotproductsdottotherange [0,1] ! dot = max(0,dot) ka= 0.1 kd= 0.5 ks= 0.4 Phong Specular Ambient Diffuse
Incorporatingcolor • So farwehaveonly dealt withIntensity: Onepossibleapproachtoincorporatecolor: • diffusely reflected light results from the reflection via multiple scattering events in the micro-scale geometry reflected light is coloured by selective absorption by the surface i.e. a green surface absorbs all wavelengths except green • specularly reflected light interacts once with the surface and is thus not “coloured” by the surface i.e. the reflection of a light source remains the colour of the source
Color of Material and Light Usuallywedefine Colors as 3 componentvectorC(r,g,b) ThereforethePhong model becomes: Cambglobal ambientlightingcolordefinedonce in thewholescene Cdiffdefined per material Cspecspecified per lightsource (Toincreaseflexibilitythespecularcolorcanadditionallybescaledby a colordefined per material)
Graphics Pipeline (DirectX 10) IB Input Data VB Memory Input Assembler Buffer Resources: Stage (IA) Buffers, Textures, Constant Buffers Vertex Shader Texture, Constant Buffer Stage (VS) Geometry Shader Texture, Constant Buffer Stage (GS) Stream Output Buffer Stage (SO) Rasterizer Stage (RS) Texture, Constant Buffer Pixel Shader Stage (PS) States Output Merger Stage (OM) Output Data Buffer, Texture, Constant Buffer
Shading: Flat vs. Gouraud vs. Phong PhongLighting Flat Shading PhongLighting GouraudShading PhongLighting PhongShading
Shading: Gouraud vs. Phong GouraudShading PhongShading evaluateslighting per vertex evaluateslighting per fragment