Wiki
Clarifications for Angel's Interactive Computer Graphics

Section 5.10 (Worksheet 7)
Page last edited by Jeppe Revall Frisvad (jerf) 09/10-2017

The code for initializing the matrix M and setting the initial light position is faulty. The following lines

  light = vec3(0.0, 2.0, 0.0);

  light = vec3(a, b, c); // Location of light
  m = mat4(); // Shadow projection matrix initially an identity matrix

  m[11] = 0.0;
  m[5] = -1.0/light.y;

should have been as follows:

  light = vec3(0.0, 2.0, 0.0); // Location of light

  m = mat4(); // Shadow projection matrix initially an identity matrix

  m[3][3] = 0.0;
  m[3][1] = -1.0/light[1];

The render function works as listed in the case of static geometry and a dynamic light source. However, one should distinguish between the model and the view matrix if working with dynamic geometry. When drawing shadow polygons in this case, the model matrix should be applied first (to dynamically move the objects around the scene). After this, one may apply the matrices for translation, shadow projection, and translation back, then the view matrix, and finally the projection matrix.

Support: +45 45 25 74 43