Lecture #6: Lighting

Computer graphics in Game development

Ivan Belyavtsev

25.01.2020

Wavefront OBJ file recall

  • # - comment
  • v - vertex
  • vn - normals
  • vt - texture coordinates
  • f - face (polygon) - list of vertexes, normals, and tex coordinates [1]

Wavefront OBJ file continue

  • mtllib [external .mtl file name] - material descriptor
  • usemtl [material name] - next faces should be drawn with [materal name] color

[1]

Wavefront MTL material format

  • newmtl [material name] - set up material name
  • illum [mode] - illumination model
  • Ka - ambient color
  • Kd - diffuse color
  • Ks - specular color
  • Ns - specular exponent
  • map_Kd - duffuse texture [1]

Definitions

  • \(\vec{P}\) - shaded point
  • \(\vec{N}\) - normal at \(\vec{P}\)
  • \(\vec{L}\) - light direction
  • \(\vec{V}\) - view direction

Phong model (simplified)

\[L(\vec{P}) = Ka + \sum_{lights}{[Kd\vec{N} \cdot \vec{L} + Ks(\vec{V} \cdot \vec{R})^{Ns}]}\]

\[\vec{R} = 2(\vec{N} \cdot \vec{L})\vec{N}−\vec{L}\]

[2], [3]

“Lighting” experiment

Experiment

Let’s implement it together

“Lighting” experiment

What is the new knowledge?

References

1. Wavefront obj file format summary // FileFormat.Info.

2. Phong B.T. Illumination for computer generated pictures // Commun. ACM. New York, NY, USA: Association for Computing Machinery, 1975. Vol. 18, № 6. Pp. 311–317.

3. The phong model, introduction to the concepts of shader, reflection models and brdf [Electronic resource]. 2015. URL: https://github.com/akalenuk/wordsandbuttons/blob/master/pages/interactive_guide_to_homogeneous_coordinates.html.