Phong Lighting
From paper: Illumination for computer generated pictures
Phong is a local illumination model , because it only considers the to-be-shaded geometry relative to the light and does not consider other objects that might block the light. Therefore also no shadows are cast in pure Phong Lighting.
Components #
Phong Lighting consists of 3 Components
Ambient #
Reflected light of the environment, that is present everywhere.
with
, how much ambient light should influence the material
material color
component-wise multiply
Ambient light color
Diffuse #
Reflected light of the light source. Diffuse light is dependent on the surface normal and light direction, but independent on the view direction.
with:
, how diffuse the material should be (“roughness”)
vector to the light source
normal vector
dot product
light color
material color
Specular #
Reflected specular highlights, dependent on the light position, surface normal and view direction.
with:
, how shiny the material should be
reflection vector
view vector
,
of the angle between
and
how focussed the highlight is, bigger
more focussed
light color
[Only for metals] Material color
Light Sources #
Non-Area lights can be modelled useing Phong Lighting
- Point lights
- Directional lights
- Spot lights
- Sun light
When dealing with multiple light sources in a scene, evaluate the Phong Lighting model for each light and add the resulting fragment colors (additive light mixing).
Blinn-Phong Lighting #
- After James F. Blinn.
- Paper : models of light reflection for computer synthesized pictures
Mostly same as Phong Lighting but for calculating specular instead of:
do
with:
the “halfway vector” between the light and the view:
Then use the angle between and
to determine how much light hits the eye
- if
then
does not need to be calculated
Shading Models using Phong Lighting #
- Flat Shading
- Compute vertex colors in the VS with Phong Lighing, for each face, choose one vertex color
- Gouraud shading
- Compute vertex colors in the VS with Phong Lighting, let the GPU interpolate the vertex colors over the faces
- Phong Shading
- Pass everything to the PS/FS and do per pixel/fragment Phong Lighting