Question by
liubara · Dec 01, 2018 at 03:23 AM ·
shadersshader programmingshaderlabshader writingproblema
Anisotropic Shader, How Does It Works? Help
It would be very helpful if someone explained to me what this line does to create the anisotropic or ring/follow surface direction reflection of an anisotropic reflection, or the explanation of anisotropic reflection in general, thank you.
{
fixed3 h = normalize(normalize(lightDir) + normalize(viewDir));
float NdotL = saturate(dot(s.Normal, lightDir));
fixed HdotA = dot(normalize(s.Normal + s.AnisoDir.rgb), h);
float aniso = max(0, sin(radians((HdotA + _AnisoOffset) * 180))); // THIS LINE
float spec = saturate(dot(s.Normal, h));
spec = saturate(pow(lerp(spec, aniso, s.AnisoDir.a), s.Gloss * 128) * s.Specular);
fixed4 c;
c.rgb = ((s.Albedo * _LightColor0.rgb * NdotL) + (_LightColor0.rgb * spec)) * (atten * 2);
c.a = 1;
clip(s.Alpha - _Cutoff);
return c;
}
This is a code taken from unity's documentation.
Comment