2023/10/25 - 12:23

\build a simple reflection m,odel that can be used in real time
- it should give us a range of surfaces
- introduce a diffuse, specular, and ambient components

Simple model that can be computed quite quickly
it has 3 components:
- diffuse: rough/soft
- specular: shiny
- ambient: background light level
→ we can add coloured ambient light to emulate reflected colours but its not actually whats happening

Phone lighting uses four vectors
- n: surface normal
- l: to light source
- v: to capera
- r: perfect refelctor
- if the angle between v and r is really small, it means your viewer is lined up pretty well with the perfect relfection and will see the spectral highlight

Diffuse surface:
- light is scattered equally in all directions
- amount of light reflected only depends on the angle between the normal and the direction towards the light
→ amount of relflected light = cos theta = l dot n
→ D (reflected intensity) = kd(diffuse surface reflection coefficient)Id(incoming light intensity) (l dot n)
- sunset analogy

Specular surface
- most serfaces are neither perfectly diffuse or specular
- phong proposed using a term that dropps off as the angle (phi?) between the viewer and the ideal reflection increasrs
- phi is the angle between the viewer and the perfect reflection
→ S(reflected intensity) = k(specular surface reflection coefficient)Is(incoming light intensity) (v dot r) ^ alpha (shininess coefficient)
→ alpha (taking cos the power of alpha) is how much you have to be aligned with the perfect reflection vector in order for it to be considered. e.g. metal will have a small one but plastic will have a broader specular highlight
→ by taking cos to a higher power, we can reign in the angle that you have to be within in order to see the specular highlight.
→ if we're to the power of 1 itll be broader and duller, but higher powers tighten the bound

Ambient
- A = ka(ambient surface reflection coefficient)Ia(intensity of ambient light)
→ if we're to the power of 1 itll be broader and duller, but higher powers tighten the bound


Material properties
- each material has separate diffuse, specular, and ambient terms to allow for maximum flexibility
- we can give each polygon a different material
- each term for a material has separate RGB components
- opengL would be more flexible than what is possible in the real world
- nine material color coefficients for each surface:
→ diffuse(kdr,kdg,kdb)
→ specular(ksr,ksg,ksb)
→ ambient(kar,kag,kab)
→ AND a shininess coefficient alpha (this is not transparency)

in a phone model, we add the results from each light source
we can calculate the contribution from each light source indepently and just add them up, because they dont affect each other
every light you add will increase the computational cost of rendering every polygon
in openGL you can have different diffuse specular and ambient color properties

Adding the components
- for each light source and each color component, the phong model can be written as
- I = D + S + A
- I = (kdIdldotn)...
- Ired = (kdrIdrldotn) + (ksrIsr(vdotr)^alpha) + (karIar)
- ...repear G and B

Index