```// Blinn-Phong specular highlight
vec3 col = vec3(0.);
vec3 halfDir = normalize(viewDir + lightDir);
float nh = dot(normal, halfDir);
float spec = pow(nh, 100.);
col += nl * lightColor * albedo + specColor * spec;```

```// anisotropic highlighting
// http://web.engr.oregonstate.edu/~mjb/cs519/Projects/Papers/HairRendering.pdf
// 计算球在当前点的切线
vec3 tangent = SphereTangent(pos, normal);
// 切线偏移，可以移动“天使环”的位置，在上面链接里的PDF中详细说明，我不细说了
//float shift = texelFetch(iChannel0, ivec2(0), 0).r;
//shift = shift * 2. - 1.;
//tangent = ShiftTangent(tangent, normal, shift);
vec3 col = vec3(0.);
vec3 halfDir = normalize(viewDir + lightDir);
float dotTH = dot(tangent, halfDir);
// 关于dirAtten的计算说明见下文
float dirAtten = smoothstep(-1., 0., dotTH);
float sinTH = sqrt(1. - dotTH * dotTH);
// Kajiya-Kay Model
col += nl * lightColor * albedo + dirAtten * specColor * pow(sinTH, 100.);```

`float dirAtten = smoothstep(-1., 0., dotTH);`

```// pos是当前着色点的三维坐标
vec3 SphereTangent(vec3 pos, vec3 normal) {
vec3 posOffseted = pos;
posOffseted.y += 1.;
float D = - dot(normal, pos);
float distToPlane = dot(normal, posOffseted) + D;
vec3 proj = posOffseted - normal * distToPlane;
vec3 tangent = normalize(proj - pos);
return tangent;
}```