Lecture 08: Lighting and shadows

Computer graphics in Game development

Ivan Belyavtsev

6.11.2020

Rendering equation

\[L_o(X, \vec{\omega_o}) = L_e(X, \vec{\omega_o}) + \int_S L_i(X, \vec{\omega_o}) f_{X,\vec{n}}(\vec{\omega_i}, \vec{\omega_o}) |\vec{\omega_i} \cdot \vec{n} | d{\omega_i} \] [1]

Phong law

\[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]

“Lighting” experiment

TODO

  • Load a scene from an OBJ file
  • Intersect all triangles
  • Add anisotropic light
  • Apply a simplified Phong model

“Lighting” experiment

Reference

From: https://github.com/djbelyak/basic-of-ray-tracing

“Lighting” experiment

What is the new knowledge?

  • Tinyobjlib usage
  • How to bring BRDF to our code

Shadow rays

From: https://www.researchgate.net/figure/1-This-figure-demonstrates-the-concept-of-ray-tracing-A-ray-is-cast-from-the-camera_fig1_236342499

“Shadow rays” experiment

TODO

  • Implement shadow ray casting
  • Apply shadows to the final image
  • Fix a shadow acne

“Shadow rays” experiment

Reference

From: https://github.com/djbelyak/basic-of-ray-tracing

“Shadow rays” experiment

What is the new knowledge?

  • How to implement hard shadows
  • How to fix shadow acne

References

1.
McGuire M. The graphics codex. 2.14 ed. Casual Effects, 2018.
2.
Phong B.T. Illumination for computer generated pictures // Commun. ACM. New York, NY, USA: Association for Computing Machinery, 1975. Vol. 18, № 6. P. 311–317.
// reveal.js plugins