September 2018
Intermediate to advanced
472 pages
15h 36m
English
In the blinnPhong method within the fragment shader, we start by computing the offset for the texture coordinate (the delta variable ). The bumpFactor constant is generally somewhere between 0 and 0.05. In this case, we use 0.015, but you'll need to tune this for your particular normal/height map. We offset the texture coordinate by the value of delta. We subtract rather than add here because ViewDir is actually pointing toward the viewer, so we need to offset in the opposite direction. Note that we also invert the height value, as discussed in the preceding analysis. Using the offset texture coordinate (tc), we compute the shading using the Blinn-Phong model with data from the normal map and color texture.
Read now
Unlock full access