Direct X 9 Shaders

Environment/ Bump Mapping

This shader uses both Bump Mapping and Environment Mapping. The main reason for using bump mapping is to allow the model to appear to contain a hight level of detail while still having a low polygon count. This is achieved by using a height map along with the texture to effect the diffuse and spec lighting of each pixel.

Environment Mapping is used to create a reflection or mirror-like effect. This is accomplished by calculating the reflection vector from the camera's point of view onto the surface of a cube map texture of the room or whatever surrounds it. This finds the correct pixel colour that is reflected back from the cube map and adds its value to the final pixel colour by a certain amount, depending on it's reflectivity.

Gloss / Shadow Mapping

This is an example of a Gloss Shader and Shadow Mapping. A gloss shader is used to add a reflective glow on selected areas of the model. This is done by using a greyscale texture along with the actual texture. The grey value of a matching pixel is multiplied by the lighting it would recieve, resulting in light areas of the greyscale texture would recieve full lighting while the dark areas would recieve nearly none.

Shadow Mapping is a way of creating a slightly more detailed shadow then just placing a blob on the ground below a model. It is actually a two-step process to be created. First, a new texture is created for the size of the entire screen and the shadow created by the object is drawn on it. The second step is when objects get drawn their depth (distance away from the viewer) is compared to that of what is being drawn. If the model is closer, the shadow does not show up. However, if the shadow would be closer it gets added to that pixel, darkening it's colour.

Toon Shader

This Toon shader uses a type of shading also known as Cell Shading. How it works is the diffuse lighting is calculated as you would normally for the model, then you clamp the result down to the value of the range it exists within. By doing this it gives the appearance of "layers" of colour, making it look more cartoony.

Sepia Shader

Sepia is a commonly used colouring scheme for "old-style" photos. It's achieved by using a formula to find the red, green, and blue values of a given pixel and muting them down into a specialized palette of various shades of brown.

Black & White Shader

Another commonly used colour scheme for "old-style" photos, black & white requires more then just finding some sum value and assigning it to all the colours. As with the Sepia Shader, it uses a formula to determine the grey value, which is then assigned to all the colours.

Morph Shader

This is a morph shader. They are commonly used in place of simple animations to reduce the work load for artists. The way it works is by having 2 versions of the model, one at each end of the "animation". It then interpolates the location of the vertices between the two meshes, controlled by a "weight" which controls the speed. In order for this type of morphing to work without greatly complicating matters the models must have the same number of vertices and be stored in the same order.