Shadow Lab

In this lab you will add shadows to your terrain renderer.

Light Source and Occluders

Your first challenge is to add an animated light source and objects that will eventually cast shadows on the terrain. Follow these steps:

Position a light source somewhere above the terrain.
Animate the light source in some way so that the shadows of checkpoint 2 will dance around.
Add a couple of objects floating in the air above the terrain.
Show your animated illumination and floating objects to your instructor to receive credit.

Shadows

Your second challenge is to cast shadows. Follow these steps:

Create a depth texture.
Create a FBO.
Render the scene to the depth texture whenever the light source changes position.
When rendering the scene normally, send along a textureFromWorld matrix for the depth texture to your shader.
Darken the fragments that are in shadow.
Show your instructor your working renderer to receive credit.