Implementing the shaders
The shaders in this chapter will implement Phong shading and the Phong reflection model. Remember that Phong shading interpolates vertex normals and creates a normal for every fragment. After that, the Phong reflection model describes the light that an object reflects as the addition of the ambient, diffuse, and specular interaction of the object with the light sources present in the scene.
To keep consistency with the Material Template Library (MTL) format, we will use the following convention for the uniforms that refer to material properties:
Material Uniform |
Description |
---|---|
|
Ambient property |
|
Diffuse property |
|
Specular property |
|
Optical density. We will not use this feature but you will see it on the MTL file. |
|
Specular exponent. A high exponent results in a tight, concentrated highlight. Ns values normally range from 0 to 1000. |
|
Transparency (alpha channel) |
|
Determines the illumination model for the object... |