i
i
i
i
i
i
i
i
7.8. Implementing BRDFs 273
Given the scale shown in the image, it is appropriate to model the
cylinder as a smooth mesh (macroscale), and represent the bumps with a
normal map (mesoscale). A Blinn-Phong BRDF with a fixed cosine power
is chosen to model the microscale normal distribution function (NDF). This
combined representation models the cylinder appearance well at this scale.
But what happens when the scale of observation changes?
Study Figure 7.45. The black-framed figure at the top shows a small
part of the surface, covered by four normal map texels. For each normal
map texel, the normal is shown as a red arrow, surrounded by the cosine
lobe NDF, shown in black. The normals and NDF implicitly specify an
underlying surface structure, which is shown in cross section. The large
hump in the middle is one of the bumps from the normal map, and the
small wiggles are the microscale surface structure. Each texel in the normal
map, combined with the cosine power, can be seen as collecting the NDF
across the surface area covered by the texel.
The ideal representation of this surface at a lower resolution would
exactly represent the NDFs collected across larger surface areas. The center
of the figure (framed in purple) shows this idealized representation at half
and one quarter of the original resolution. The gray dotted lines show which
areas of the surface are covered by each texel. This idealized representation,
if used for rendering, would most accurately represent the appearance of
the surface at these lower resolutions.
In practice, the representation of the surface at low resolutions is the
responsibility of the lower mipmap levels in the mipmap chain. At the
bottom of the figure, we see two such sets of mipmap levels. On the bottom
left (framed in green) we see the result of averaging and renormalizing
the normals in the normal map, shown as NDFs oriented to the averaged
normals. These NDFs do not resemble the ideal ones—they are pointing
in the same direction, but they do not have the same shape. This will lead
to the object not having the correct appearance. Worse, since these NDFs
are so narrow, they will tend to cause aliasing, in the form of flickering
highlights.
We cannot represent the ideal NDFs directly with the Blinn-Phong
BRDF. However, if we use a gloss map, the cosine power can be varied from
texel to texel. Let us imagine that, for each ideal NDF, we find the rotated
cosine lobe that matches it most closely (both in orientation and overall
width). We store the center direction of this cosine lobe in the normal
map, and its cosine power in the gloss map. The results are shown on the
bottom right (framed in yellow). These NDFs are much closer to the ideal
ones. With this process, the appearance of the cylinder can be represented
much more faithfully than with simple normal averaging, as can be seen in
Figure 7.46.