i
i
i
i
i
i
i
i
270 7. Advanced Shading
In principle, BRDF equations apply in the local frame of the surface
defined by the vectors n, t,andb. In practice, they can be evaluated in
any coordinate system (or more than one) as long as care is taken never
to perform an operation between vectors in different coordinate systems.
Per-pixel BRDF evaluation is often combined with normal mapping. In
principle, normal mapping perturbs the entire local frame, not just the
normal. Isotropic BRDFs rarely require tangent or bitangent vectors, so
perturbing the normal vector is sufficient. When shading with anisotropic
BRDFs, it is important to perturb any tangent or bitangent vectors used.
Anisotropic BRDFs introduce the possibility of per-pixel modification of
the tangent direction—use of textures to perturb both the normal and
tangent vectors is called frame mapping [618]. Frame mapping can enable
effects such as brushed swirls on metal or curly hair.
Some BRDFs are defined as a combination of subexpressions defined
analytically and subexpressions defined by values stored in one- or two-
dimensional data tables (see Section 7.6). These semi-analytic BRDFs are
computed much like fully analytic BRDFs, but with the addition of texture
lookups for the tabulated subexpressions.
Even for fully analytically defined BRDFs, there might be a perfor-
mance benefit in extracting a subexpression that is a function of one or two
variables and tabulating its values in a texture for lookup while rendering.
In the past, when computation was costly relative to texture lookups, this
was a very common practice. Now computation is relatively cheap—a rule
of thumb in 2007 was that one texture operation is equivalent to ten arith-
metic operations (or more).
20
This number will keep growing as graphics
hardware evolves [1400]. Only the most complex subexpressions will ben-
efit from being factored into a texture. To avoid losing the parametric
qualities of the BRDF, it is preferable for factored subexpressions to be
independent of the BRDF’s parameters.
BRDFs using non-parametric representations are more difficult to ren-
der efficiently. In the case of BRDFs defined as an orthonormal expansion
of bases such as spherical harmonics, rendering is straightforward—just
evaluate the basis functions—but due to the large number of coefficients
computation is likely to be expensive. More importantly, if the BRDF is
spatially varying, then a very large number of texture reads is needed to
read all of the coefficients, further reducing performance.
BRDFs that use factored representations are easier to render, since a
relatively small number of textures are read (usually two). Inverse Shade
Trees [740] use a larger number of textures (about twenty for the examples
given) but most of them are one dimensional. This is still well within
the capabilities of modern accelerators, but the large number of texture
20
This holds true for an NVIDIA G80, and it is likely that ATI is similar.