Presentation is loading. Please wait.

Presentation is loading. Please wait.

Lighting & Shading.

Similar presentations


Presentation on theme: "Lighting & Shading."— Presentation transcript:

1 Lighting & Shading

2 Illumination Without Local Global

3 Global Illumination Interaction with matter
Consider multiple reflections, transmission, shadows Rendering Equation: BRDF

4 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.

5 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 scene where ka is the ambient material coefficient of reflection with 0.0 <= ka <= 1.0 and Ia is the intensity of the ambient light

6 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

7 Local Illumination Diffuse Lighting
Power per unit area arriving at point x depends on the angle of the surface to the light direction (Johann Friedrich Lambert) dA dA‘ Iin N J

8 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 certain kd N L Intersection Point

9 Local Illumination Specular Lighting Glossy/smooth material
Light is mostly reflected into the directions around the mirror direction RL of L Diffuse Glossy Specular

10 Local Illumination Specular Lighting: 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  ) a cosn N RL eye L a V J J

11 Local Illumination Careful! If a light is situated behind the object (α > 90°) then cos(α) < 0.  Discard negative intensity values by clamping the dot products dot to the range [0,1] ! dot = max(0,dot) ka = 0.1 kd = 0.5 ks = 0.4 Phong Ambient Diffuse Specular

12 Incorporating color So far we have only dealt with Intensity:
One possible approach to incorporate color: 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

13 Color of Material and Light
Usually we define Colors as 3 component vector C(r,g,b) Therefore the Phong model becomes: Camb global ambient lighting color defined once in the whole scene Cdiff defined per material Cspec specified per light source (To increase flexibility the specular color can additionally be scaled by a color defined per material)

14 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) Pixel Shader Texture, Constant Buffer Stage (PS) Output Merger States Stage (OM) Output Data Buffer, Texture, Constant Buffer

15 Shading: Flat vs. Gouraud vs. Phong
Phong Lighting Flat Shading Phong Lighting Gouraud Shading Phong Lighting Phong Shading

16 Shading: Gouraud vs. Phong
Gouraud Shading Phong Shading evaluates lighting per vertex evaluates lighting per fragment


Download ppt "Lighting & Shading."

Similar presentations


Ads by Google