This is a personal exercise and implementation of "getting started with Unity Shader". Some of the content may be slightly different from that in the book. The implementation platform is Unity 2018.4.2f1 (64-bit).
 |
 |
 |
| 逐顶点高光反射(亮斑不连续) |
逐像素高光反射(完整phong模型) |
BlinnPhong(具有更亮的视觉效果) |
 |
 |
 |
| Bump Scale = -1 |
Bump Scale = 0 |
Bump Scale = 1 |
 |
 |
| 漫反射+未遮罩的高光反射 |
漫反射+遮罩的高光反射 |
模型本身具有复杂的遮挡关系,则因排序错误产生错误的透明效果。使用两个Pass可以解决这个问题其中第二个Pass与原始blend相同,而第一个Pass仅仅将模型深度值写入深度缓冲,而不输出颜色
 |
 |
 |
| Base + Additional Pass |
LightMode : Auto |
LightMode : NotImportant |
 |
 |
 |
 |
| No FallBack |
Only Fallback |
Fall +(*shadow) |
UNITY_LIGHT_ATTENUATION实现 |
 |
 |
 |
| AlphaTest, Shadow正常 |
AlphaBlend,没有shadow |
AlphaBlend+强制Fallback设置为Vertexlit |
 |
 |
| 使用rendertoCubemap的先后顺序会造成不同效果,观察可知,前者的纹理较为透亮,而后者有些混沌 |
|
 |
 |
 |
| 可通过参数控制圆形纹理的亮度,大小,颜色和模糊程度 |
|
|
 |
 |
| EdgesOnly在原图和纯色之前插值得到最终像素值 |
|
 |
 |
| 在高斯模糊的基础上完成 |
|
 |
 |
| 累计缓存实现 |
深度纹理实现 |