# Phong lighting model

The Phong lighting model is a lighting model in 3D computer graphics that is used to calculate the lighting of objects. The model was named after its developer Bùi Tường Phong and was first presented in 1975 ( Illumination for Computer Generated Pictures , June 1975).

The Phong model is suitable for representing smooth, plastic-like surfaces. The highlight of the surface is described by the term , the parameter determining the roughness of the surface. ${\ displaystyle \ cos ^ {n} (\ theta)}$ ${\ displaystyle n}$ It is a completely empirical model that is not built on any physical basis. This means that it contradicts the law of conservation of energy , which dictates that a surface can reflect at most as many photons as it hits. Other lighting models such as the Schlick or Cook-Torrance model , however, are completely or at least approximately physically plausible. In addition, the Phong lighting model is slow to calculate compared to the Blinn lighting model , which enables a comparable image quality. Despite its shortcomings, the Phong lighting model is still widely used due to its simplicity.

## formula

### Simplifications of the Phong lighting model

• Light sources are point-like
• the geometry of the surfaces, except for the surface normals, is ignored
• diffuse and specular reflection is only modeled locally
• ambient reflection is modeled globally

### Composition of the reflected light

In the Phong lighting model, the reflection of light is described as a combination of ambient, ideally diffuse and ideally specular reflection.

${\ displaystyle I _ {\ text {out}} = I _ {\ text {ambient}} + I _ {\ text {diffuse}} + I _ {\ text {specular}}}$ The individual components are described below.

### Ambience component of the reflected light

The ambient component of the reflected light is independent of the angle of incidence of the light beam of the point light source and of the viewing angle of the observer of the scene. It depends on the ambient light, which is constant for all points on all surfaces, and an empirically determined reflection factor (material constant).

${\ displaystyle I _ {\ text {ambient}} = I _ {\ text {a}} \, k _ {\ text {ambient}}}$ With

• ${\ displaystyle I _ {\ text {a}}}$ ... the intensity of the ambient light
• ${\ displaystyle k _ {\ text {ambient}}}$ ... material constant

### Diffuse component of the reflected light

With diffuse reflection, the light is reflected in all directions regardless of the viewer's position ( Lambert's law ). The light intensity of the reflected light from the point light source nevertheless depends on the angle of incidence, since the illuminance of the surface changes with the angle of incidence. The light intensity of the diffuse component is thus dependent on the angle of incidence of the light beam from the point light source and on an empirically determined reflection factor (material constant), but independent of the viewing angle of the observer of the scene.

${\ displaystyle {\ begin {array} {lcl} I _ {\ text {diffuse}} & = & I _ {\ text {in}} \, k _ {\ text {diffuse}} \, \ cos \ varphi \\ & = & I _ {\ text {in}} \, k _ {\ text {diffuse}} \, ({\ vec {L}} \ cdot {\ vec {N}}) \ end {array}}}$ With

• ${\ displaystyle I _ {\ text {in}}}$ ... luminous intensity of the incident light beam from the point light source
• ${\ displaystyle k _ {\ text {diffuse}}}$ ... empirically determined reflection factor for diffuse components of the reflection
• ${\ displaystyle \ varphi}$ ... angle between the normal vector of the surface and the unit vector in the direction of the incident light beam${\ displaystyle {\ vec {N}}}$ ${\ displaystyle {\ vec {L}}}$ ### Specular component of the reflected light

With specular reflection, the light is reflected in a certain area around the ideal reflection direction. The light intensity of the reflected light depends on the angle of incidence of the light beam from the point light source, on an empirically determined reflection factor (material constant) as well as the surface properties and the viewing angle of the observer of the scene.

${\ displaystyle {\ begin {array} {lcl} I _ {\ text {specular}} & = & I _ {\ text {in}} \, k _ {\ text {specular}} \, \ cos ^ {n} \ theta \\ & = & I _ {\ text {in}} \, k _ {\ text {specular}} \, ({\ vec {R}} \ cdot {\ vec {V}}) ^ {n} \ end {array }}}$ With

• ${\ displaystyle I _ {\ text {in}}}$ ... luminous intensity of the incident light beam from the point light source
• ${\ displaystyle k _ {\ text {specular}}}$ ... empirically determined reflection factor for specular components of the reflection
• ${\ displaystyle \ theta}$ ... the angle between the ideal reflection direction of the emerging light beam and the viewing direction of the observer${\ displaystyle {\ vec {R}}}$ ${\ displaystyle {\ vec {V}}}$ • ${\ displaystyle n}$ ... constant exponent to describe the surface properties (rough less than 32, smooth greater than 32, would be a perfect mirror)${\ displaystyle n = \ infty}$ Furthermore, a normalization factor should be used, which ensures that the brightness does not decrease with large mirror exponents ( ). ${\ displaystyle n}$ It is usually taken as a useful factor . ${\ displaystyle {\ frac {n + 2} {2 \, \ pi}}}$ This results in the following formula for calculating the specular reflection:

${\ displaystyle {\ begin {array} {lcl} I _ {\ text {specular}} & = & I _ {\ text {in}} \, k _ {\ text {specular}} \, {\ frac {n + 2} {2 \, \ pi}} \, \ cos ^ {n} \ theta \\ & = & I _ {\ text {in}} \, k _ {\ text {specular}} \, {\ frac {n + 2} {2 \, \ pi}} \, ({\ vec {R}} \ cdot {\ vec {V}}) ^ {n} \ end {array}}}$ ### Complete formula

And here is the compound formula for the Phong lighting model:

${\ displaystyle {\ begin {array} {lcl} I _ {\ text {out}} & = & I _ {\ text {a}} \, k _ {\ text {ambient}} + I _ {\ text {in}} \ , k _ {\ text {diffuse}} \, \ cos \ varphi + I _ {\ text {in}} \, k _ {\ text {specular}} \, {\ frac {n + 2} {2 \, \ pi }} \, \ cos ^ {n} \ theta \\ & = & I _ {\ text {a}} \, k _ {\ text {ambient}} + I _ {\ text {in}} \, (k _ {\ text {diffuse}} \, \ cos \ varphi + k _ {\ text {specular}} \, {\ frac {n + 2} {2 \, \ pi}} \, \ cos ^ {n} \ theta) \\ & = & I _ {\ text {a}} \, k _ {\ text {ambient}} + I _ {\ text {in}} \, \ left [k _ {\ text {diffuse}} \, ({\ vec {L }} \ cdot {\ vec {N}}) + k _ {\ text {specular}} \, {\ frac {n + 2} {2 \, \ pi}} \, ({\ vec {R}} \ cdot {\ vec {V}}) ^ {n} \ right] \ end {array}}}$ With

${\ displaystyle k _ {\ text {diffuse}} + k _ {\ text {specular}} <= 1}$ ${\ displaystyle k _ {\ text {ambient}} <= 1}$ ### Multiple light sources

If there are several light sources, the respective components are first calculated separately for each light source and then added up.