Phong光照模型下的逐顶点逐像素对比
Phong和Blinn-Phong光照模型高光对比
可以看出逐像素明显要比逐顶点顺滑很多(顶点之间的高光计算是通过线性插值计算的,而实际上高光反射部分的计算是非线性的)
Blinn模型比Phong的高光区域要更大亮一点 在实际中一般都用Blinn-Phong光照
Blinn光照模型计算高光反射公式
fixed3 HalfDir = normalize(viewDir+worldLight);
fixed3 specluar = _LightColor0.rgb * _Specluar.rgb * pow(saturate(dot(worldNormal,HalfDir)), _Gloss);
Phong模型计算高光公式
fixed3 worldNormal = normalize(i.worldNormal);
fixed3 worldLight = normalize(UnityWorldSpaceLightDir(i.worldPos));
fixed3 reflectDir = normalize(reflect(-worldLight,worldNormal));
fixed3 viewDir = normalize(UnityWorldSpaceViewDir(i.worldPos));
fixed3 specluar = _LightColor0.rgb * _Specluar.rgb * pow(saturate(dot(reflectDir,viewDir)), _Gloss);