Shader Programming

In my Advanced Shader course, we were required to have a project created that would demonstrate all of the basic and advanced shaders that we were taught in class, aswell as one of our own custom shaders. Here is a listing of each shader and it's description:

Diffuse Shading: The simplest shader taught in class. It calculates the color of the pixel by taking its base original color and multiplying it by the light calculated on the normal. This was the first shader we learnt, but gave us a very good idea of what happens in the pipeline.

Specular Mapping: This shader actually uses two textures loaded into the shader. The first shader is the actual texture of the object, which is then used with the second texture that determinds where and how much the light illuminates the object. This is useful for when a particular object may have parts that will shine on light more than in other places.

Normal Mapping: Two textures are used again, one is the texture of the object, but the second is mapped to calculate the normals that are used to determine the reflected light. With normal mapping, it gives the illusion that a perfectly smooth or flat object/plane actually has complex geometry.

Environment Mapping: A texture is passed in to calculate the color that is shown on a specific pixel which is determined by the reflection of the geometry. My example uses Environment Mapping ontop of a Normal Mapped object, resulting in a detailed shiny object.

Shadow Mapping: A few techniques are used here to project shadows onto the terrain. The shadows are first drawn onto a buffer from a projected light source and are then used to draw from the depth buffer onto drawn objects.

Motion Blur: Every frame is drawn to a texture buffer which are all then taken into the shader and blended appropriately so that the newer frames will have more strength than some of the older frames. This is one of a few post-processing effects we covered in the course. There are an endless number of post-processing effects that can alter the scene, such as blur, sepia, mosaic and much more.

Alpha-Blending: For our final Game Project, I decided to take our normal single-textured bland terrain, and make an alpha-blending shader to wrap around it. The terrain takes a few textures in and then takes in an alpha-map which uses its RGB values to tell what the strength of the alpha for each texture at a specific location. This allows a very smooth transition from one texture to another.