March 2013
Intermediate to advanced
984 pages
26h 18m
English
The vertex shader for our procedural bump-map shader is shown in Example 8.9. This shader is responsible for computing the surface-local direction to the light and the surface-local direction to the eye. To do this, it accepts the incoming vertex position, surface normal, and tangent vector; computes the binormal; and transforms the eye space light direction and viewing direction, using the created surface-local transformation matrix. The texture coordinates are also passed on to the fragment shader because they are used to determine the position of our procedural bumps.
Example 8.9. Vertex Shader for Doing Procedural Bump Mapping
#version 330 coreuniform vec3 LightPosition;uniform mat4 MVMatrix;uniform ...