From GPWiki
Jump to: navigation, search


Michael Ashikhmin and Peter Shirley published their lighting model in June 2000 and were inspired in part by Gregory Ward’s work covered in the previous chapter. Like Ward’s model theirs is also anisotropic in nature.

Also like Ward’s contribution, this model is based on empirical measurements (specifically those of metals and plastics) but Ashikhmin and Shirley put a much greater emphasis on the physical plausibility of the results. Conservation of energy is one of the fundamental requirements of a true BRDF and this provides the motivation behind many of the terms in their equations.

Similar to the previously covered Cook-Torrance model Ashikhmin and Shirley employ Fresnel weighting in the specular term so as to get physically accurate reflection. This causes a problem for energy conservation and as a consequence they propose a non-Lambertian diffuse term. This subtle but important difference allows this model to express reflectance characteristics that no Lambertian model can. In practice this makes evaluation of the diffuse term much more involved than previous models where much of the computation cost was for the specular term.

The Equation

The entire model can be summarised by the following simple summation:

\rho \left ( Light,View \right ) = \rho_d \left ( Light,View \right ) + \rho_s \left ( Light,View \right )

In the same way as all other models the current position and surface normal are available during evaluation. Their model relies on four additional parameters:

Rd Diffuse colour
Rs Specular colour at normal incidence
Nu, Nv Phong-like exponents to control the shape of the specular lobe. Nu=Nv results in an isotropic highlight.

The original publication claims an emphasis on intuitive parameters which is largely true, but by comparison to Strauss’ attempt the 0 to 10,000 range for Nu and Nv doesn’t seem quite so sensible!

The Diffuse Term

The following equation is for the non-Lambertian diffuse component:

\rho_d = \frac{28 \times R_d}{23 \times \pi} \times \left ( 1 - R_s \right ) \times \left ( 1 - \left ( 1 - \frac{Normal \bullet Light}{2} \right ) ^5 \right ) \times \left ( 1 - \left ( 1 - \frac{Normal \bullet View}{2} \right ) ^5 \right )

If performance is more important than physical plausibility and accuracy then it would still be valid to replace the above equation with a more conventional Lambertian one. It is worth considering this option alongside ‘Level Of Detail’ algorithms as it’s a simple substitution that could greatly reduce the computation cost of this model.

The Specular Term

\rho_s = \frac{\sqrt{\left ( n_u + 1 \right ) \times \left ( n_v + 1 \right )} \times \left ( Normal \bullet Half \right )^{n_u \times \cos^2 \phi + n_v \times \sin^2 \phi}}{8 \times \pi \times \left ( Half \bullet Light \right ) \times max \left ( \left ( Normal \bullet Light \right ), \left ( Normal \bullet View \right ) \right )} \times F \left ( Half \bullet Light \right )

Schlick’s Fresnel approximation ([Schlick94]) makes a re-appearance in this model, but it would be possible to use the more complex methods described in previous chapters. This may well be a useful consideration for code-reuse.

F\left(x\right) = R_s + \left ( 1 - R_s \right ) \times \left (1 - x \right )^5

The Implementation

The original equations in their paper rely on vector mathematics from the outset such that only the specular term needs a slight modification to eliminate the cosine evaluation and replace it with a more GPU-friendly dot product operation:

Specular term requires U and V vectors – tangent and bitangent to normal; if implemented in a pixel shader these become <1,0,0> and <0,1,0> and the equation can be simplified. However for cases where these axis’ are not readily available the same simplification and work-around from the previous chapter can be used.

The following HLSL function represents the entire Ashikhmin-Shirley lighting model:

float4 psAshikhminShirley
            in VS_OUTPUT f
        ) : SV_TARGET
    // Make sure the interpolated inputs and
    // constant parameters are normalized
    float3 n = normalize( f.normal );
    float3 l = normalize( -vLightDirection );
    float3 v = normalize( pCameraPosition - );
    float3 h = normalize( l + v );
    // Define the coordinate frame
    float3 epsilon = float3( 1.0f, 0.0f, 0.0f );
    float3 tangent = normalize( cross( n, epsilon ) );
    float3 bitangent = normalize( cross( n, tangent ) );
    // Generate any useful aliases
    float VdotN = dot( v, n );
    float LdotN = dot( l, n );
    float HdotN = dot( h, n );
    float HdotL = dot( h, l );
    float HdotT = dot( h, tangent );
    float HdotB = dot( h, bitangent );
    float3 Rd = cDiffuse;
    float3 Rs = 0.3f;
    float Nu = fAnisotropy.x;
    float Nv = fAnisotropy.y;
    // Compute the diffuse term
    float3 Pd = (28.0f * Rd) / ( 23.0f * 3.14159f );
    Pd *= (1.0f - Rs);
    Pd *= (1.0f - pow(1.0f - (LdotN / 2.0f), 5.0f));
    Pd *= (1.0f - pow(1.0f - (VdotN / 2.0f), 5.0f));
    // Compute the specular term
    float ps_num_exp = Nu * HdotT * HdotT + Nv * HdotB * HdotB;
    ps_num_exp /= (1.0f - HdotN * HdotN);
    float Ps_num = sqrt( (Nu + 1) * (Nv + 1) );
    Ps_num *= pow( HdotN, ps_num_exp );
    float Ps_den = 8.0f * 3.14159f * HdotL;
    Ps_den *= max( LdotN, VdotN );
    float3 Ps = Rs * (Ps_num / Ps_den);
    Ps *= ( Rs + (1.0f - Rs) * pow( 1.0f - HdotL, 5.0f ) );
    // Composite the final value:
    return float4( Pd + Ps, 1.0f );


In a similar way to Ward’s model presented in the previous chapter, the two main inputs into Ashikhmin and Shirley’s model are the Nu and Nv values. The ranges of these are between 0 and 10,000 yet they generate a similar grid of samples to image 8.3. The following three images capture some of the extremes when applied to a real mesh:

Image 9.1.png
Image 9.1
Image 9.2.png
Image 9.2
Image 9.3.png
Image 9.3

The first of the three, image 9.1, shows horizontal highlights following the appropriate contours on the skin of the horse. Image 9.2 shows an isotropic distribution whereas image 9.3 goes to the other extreme and shows vertical highlights.

The assembly listing for this model weighs in at 71 instructions – making it one of the more complex models covered in this section of the book. However it is possible to generate ‘hybrid’ models by changing the diffuse and specular terms around.

With some experimentation to find ideal values this model satisfies the empirical measurements of metals and plastics. These two materials will be commonly used, thus having another model that can generate plausible results is no bad thing.


[Ashikhmin-Shirley00] “An anisotropic Phong light reflection model”, Michael Ashikhmin and Peter Shirley. Technical Report UUCS-00-014, Computer Science Department, University of Utah, June 2000.

[Schlick94] “An inexpensive BRDF model for physically-based rendering.” Christophe Schlick, Computer Graphics Forum, 13(3):233—246, 1994.

Navigate to other chapters in this section:

Foundation & Theory Direct Light Sources Techniques For Dynamic Per-Pixel Lighting Phong and Blinn-Phong Cook-Torrance Oren-Nayar Strauss Ward Ashikhmin-Shirley Comparison and Summary