implement reflection, one must determine how the viewing vector from the camera
reflects off the surface, using the reflect
function in GLSL.
the reflected vector must be in world coordinates, there are two options:
inverseViewMatrix = glm::inverse(pCamera->GetViewMatrix());pEMProgram->SetUniform("matrices.inverseViewMatrix", inverseViewMatrix);
- Perform the reflection in world
is the approach taken In the OpenGL Shading Language Cookbook
requires knowledge of the model matrix (independent of the view matrix)
- Perform the reflection in eye
coordinates, then rotate the reflected point to world coordinates.
requires knowledge of the inverse view matrix.