Projection Shadow*

In this bonus task you can create a simple shadow for your chopper. For this use the projection shadow approach.

First, find out additional details about the projection shadows from the web. The goal here is to take the chopper's geometry and use a combination of the shear, scale and possibly translation transformations to put the geometry down, where the shadow should be. Remember that all those transformations work in relation to the current origin.

Currently we have not discussed light sources yet, but assume that you have light coming from some uniform direction. For example the vector towards the light from all points could be just $(1, 1, 0)$.

In this task have only one floor, which the shadow is projected to. So remove all the walls and the ceiling from the chopper project's hangar. Make also the floor bigger, so that the shadow would not go over it.

In the projection shadows algorithm the next step is to shear the geometry based on the direction towards the light source. Depending on your direction, the shear operation will be different. It would be excellent if you could incorporate the direction into your shear matrix (not just hardcode fixed values).

After this the final transformation would be to squash the geometry down to the floor. You want to be careful here, if the shadow geometry has exactly the same coordinates as the floor, then the GPU might not know, which of the surfaces need to be in front of another. Try to come up with a cleaver way to solve this as well.

In code I expect you to put together a shadowMatrix somewhere. That matrix should incorporate all the transformations required for this projection. You also have to figure out in which space to apply that matrix. You need to send those transformations to the vertex shader – will they be as a separate uniform or incorporated into some other matrix, is up to you to decide.

The final result should look something like this:

The camera does not have to be moving in your solution. :)

For the color just put a shadowy color value. As we have not discussed blending yet either, you do not have to make a transparent shadow in this task.

;