Graphics Reference
In-Depth Information
done for Phong shading. In addition, the fragment shader must get whatever
extra information is needed to describe the directional reflection; in this case,
that is the tangent vector to the sphere normal to the polar arc through the
point. The fragment shader then carries out the ambient and diffuse light com-
putations for regular ADS lighting and computes the specular part of the light
based on the new light direction.
The particular kind of anisotropic shading shown in Figure 6.7 is a com-
puter graphics “classic,” going back to the late 1980s. The specular reflection is
not given by the usual term
S = L S * M S * ( R E ) SH ,
but by the term
dl = T L ,
de = T E ,
dl TL
SH
de TE
SLM lde
=•
=∗∗∗+−∗∗−∗
(
(
1
dldl
)(
1
dede
))
,
S
S
where T is the tangent vector (the direction of the brushing or hair), L is the
light vector, E is the eye vector, and SH is the shininess. In the code snippet
below, taken from the fragment shader, the values of the tangent, light, and
eye vectors, and the value of vColor , are assumed to have been computed
separately in the associated vertex shader. The anisotropic shading param-
eters uKa , uKd , and uKs are assumed to be passed into the shader, and the color
vColor is used for all three components of the ADS lighting model.
Figure 6.7. Anisotropic lighting in human hair (left); a sphere with anisotropic shading
(right).
Search WWH ::




Custom Search