Phong Lighting

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.

phong_lighting_416d758ed798b4abdf75cd8a1d174b890b64ac7d.svg

with

  • phong_lighting_47395d2859880b3acc8fc57bb7af3645c2ea3ad4.svg, how much ambient light should influence the material
  • phong_lighting_391628cc593ede3c104d2d85eb1562ec83af076e.svg material color
  • phong_lighting_1b25236a114c9364fd957575c42f07e9e47cff57.svg component-wise multiply
  • phong_lighting_bfe76f61cbf74a7938f5f4226bb2ffee06ad12cb.svg 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.

phong_lighting_994332cdc102b701853ad8690abc25217b41112a.svg

with:

  • phong_lighting_1e7b2213ccd383e53821d809114505e15c0402a4.svg, how diffuse the material should be (“roughness”)
  • phong_lighting_9af53429d04f6ed89db204b0d0fbdb34a48db241.svg vector to the light source
  • phong_lighting_ccf6bd2b43710c6e98f1b9232958b6c5d8e95d61.svg normal vector
  • phong_lighting_86b781424887594d55436d6718fee46d30da5563.svg dot product
  • phong_lighting_4bcdbe7258f9266182ad3b9146f0c1d3796ee1c2.svg light color
  • phong_lighting_391628cc593ede3c104d2d85eb1562ec83af076e.svg material color

Specular #

Reflected specular highlights, dependent on the light position, surface normal and view direction.

phong_lighting_d3fdc8c754567d7cf108d0d328cbbf550967b48b.svg

with:

  • phong_lighting_f0f7c3db57d154c6957016bfcc03cdc5c9b44b7f.svg, how shiny the material should be
  • phong_lighting_a1b1c9aefe7511a14900a974928d2552d45732f0.svg reflection vector
  • phong_lighting_3c5a1433bab418383605202101ea1af568999744.svg view vector
  • phong_lighting_28efed50d370deef2ad0c13add0afe12c3932871.svg, phong_lighting_fe0ea1b977fdc44b380117526334da6d34166655.svg of the angle between phong_lighting_e0613b5f1cf4dee8abdad74368bd15e7e57d384e.svg and phong_lighting_3c5a1433bab418383605202101ea1af568999744.svg
  • phong_lighting_4d82a4c30de8e75ce1851da2f92080b507522034.svg how focussed the highlight is, bigger phong_lighting_dde164048a603e8cef7559ee87a350db3af9c458.svg more focussed
  • phong_lighting_be520c51ec0ee29c68b2f7b52a98064bb5c5b469.svg light color
  • phong_lighting_391628cc593ede3c104d2d85eb1562ec83af076e.svg [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 #

Mostly same as Phong Lighting but for calculating specular instead of: phong_lighting_d3fdc8c754567d7cf108d0d328cbbf550967b48b.svg do phong_lighting_8e4f711c011338f4dea5ceda99b1049f577ad032.svg with:

  • phong_lighting_53255f4ac7255abacfb04827a3450af8181b944d.svg the “halfway vector” between the light and the view: phong_lighting_498f9a576e1c52ad0abc1aef79d2aa2f34c94879.svg

Then use the angle between phong_lighting_ccf6bd2b43710c6e98f1b9232958b6c5d8e95d61.svg and phong_lighting_53255f4ac7255abacfb04827a3450af8181b944d.svg to determine how much light hits the eye

  • if phong_lighting_a5670ba24837563b827435df866990b438f081ca.svg then phong_lighting_6639e826c280b44cbfb7d23b4863ca88634c8465.svg
  • phong_lighting_e0613b5f1cf4dee8abdad74368bd15e7e57d384e.svg 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
Calendar October 22, 2023