光照模型

自发光

===========

环境光

fixed3 ambient = UNITY_LIGHTMODEL_AMBIENT.xyz;

漫反射

兰伯特定律Lambert's law

diffuse = c light * m diffuse * max(0,  dot (n * l)  )

l为光源方向,c为光源颜色,m为漫反射颜色

===

半兰伯特模型

diffuse = c light * m diffuse * (0.5 * (dot(n* l)) + 0.5)

把以前都为0 的值修改到0到0.5之间


高光反射

phong模型

specular = c light * m specular * max ( 0 ,   dot (v * r ) )  gloss次方

gloss 为光泽度,越光泽,点越小

c为光源颜色

m为材质颜色


blinn模型

specular = c light * m specular * max ( 0 , n * h) gloss 次方

h为l和v的和



o.color = ambient + diffuse










猜你喜欢

转载自blog.csdn.net/a133900029/article/details/80736489