Presentation is loading. Please wait.

Presentation is loading. Please wait.

Visual Appearance Chapter 4 Tomas Akenine-Möller Department of Computer Engineering Chalmers University of Technology.

Similar presentations


Presentation on theme: "Visual Appearance Chapter 4 Tomas Akenine-Möller Department of Computer Engineering Chalmers University of Technology."— Presentation transcript:

1 Visual Appearance Chapter 4 Tomas Akenine-Möller Department of Computer Engineering Chalmers University of Technology

2 Tomas Akenine-Mőller © 2002 Overview of today’s lecture Refresher on simple lighting models – Plus some new stuff Fog Gamma correction Transparency and alpha

3 Tomas Akenine-Mőller © 2002 Compute lighting at vertices, then interpolate over triangle How compute lighting? We could set colors per vertex manually For a little more realism, compute lighting from – Light sources – Material properties – Geometrical relationships light Geometry blue red green Rasterizer

4 Tomas Akenine-Mőller © 2002 Refresher on lighting Diffuse component : i diff i=i amb +i diff +i spec Diffuse is Lambert’s law: Photons are scattered equally in all directions

5 Tomas Akenine-Mőller © 2002 Lighting Specular component : i spec Diffuse is dull (left) Specular: simulates a highlight

6 Tomas Akenine-Mőller © 2002 Specular component: Phong Phong specular highlight model Reflect l around n: n l r -l-l Read about Blinns highlight formula: (n. h) m

7 Tomas Akenine-Mőller © 2002 Ambient component: i amb Ad-hoc – tries to account for light coming from other surfaces Just add a constant color:

8 Tomas Akenine-Mőller © 2002 Lighting i=i amb +i diff +i spec This is just a hack! Has little to do with how reality works! ++ = DEMO

9 Tomas Akenine-Mőller © 2002 Additions to the lighting equation Depends on distance: 1/(a+bt+ct ) Can have more lights: just sum their respective contributions Different light types: 2

10 Tomas Akenine-Mőller © 2002 What’s lighting and what’s shading? Lighting: the interaction between light and matter Shading: do lighting (at vertices) and determine pixel’s colors from these Three types of shading: – Flat, Goraud, and Phong

11 Tomas Akenine-Mőller © 2002 Fog Simple atmospheric effect – A little better realism – Help in determining distances Color of fog: color of surface: How to compute f ? 3 ways: linear, exponential, exponential-squared Linear:

12 Tomas Akenine-Mőller © 2002 Fog example Often just a matter of – Choosing fog color – Choosing fog model – Turning it on

13 Tomas Akenine-Mőller © 2002 Gamma correction If input to gun is 0.5, then you don’t get 0.5 as output in intensity Instead, gamma correct that signal: gives linear relationship

14 Tomas Akenine-Mőller © 2002 Gamma correction I =intensity on screen V =input voltage (electron gun) a,  and  are constants for each system Common gamma values: 2.3-2.6 Assuming  =0, gamma correction is:

15 Tomas Akenine-Mőller © 2002 Why is it important to care about gamma correction? Portability across platforms Image quality – Texturing – Interpolation One solution is to put gamma correction in hardware…

16 Tomas Akenine-Mőller © 2002 Transparency and alpha Transparency – Very simple in real-time contexts The tool: alpha blending (mix two colors) Alpha (  ) is another component in the frame buffer, or on triangle – Represents the opacity – 1.0 is totally opaque – 0.0 is totally transparent The over operator: Rendered object

17 Tomas Akenine-Mőller © 2002 Transparency Need to sort the transparent objects – Render back to front Lots of different other blending modes Can store RGB  in textures as well Two ways: – Unmultiplied – Premultiplied


Download ppt "Visual Appearance Chapter 4 Tomas Akenine-Möller Department of Computer Engineering Chalmers University of Technology."

Similar presentations


Ads by Google