利用镜面反射让游戏闪耀起来 - 创建Phong高光类型
2017-11-29 11:47
387 查看
Shader "Phong" { Properties { _MainTex("MainTex", 2D) = "white" {} _MainTint("Mainint", Color) = (1, 1 ,1 ,1) _SpecPower("SpecPower", Range(0, 30)) = 1 _SpecularColor("SpecColor", Color) = (1, 1, 1, 1) } SubShader { Tags { "RenderType" = "Opaque" } LOD 200 CGPROGRAM #pragma surface surf Phong sampler2D _MainTex; float4 _MainTint; float _SpecPower; float4 _SpecularColor; inline fixed4 LightingPhong(SurfaceOutput s, fixed3 lightDir, half3 viewDir, fixed atten) { float diff = dot(s.Normal, lightDir); float3 reflectionVector = normalize(2.0 * s.Normal * diff - lightDir); float spec = pow(max(0, dot(reflectionVector, viewDir)), _SpecPower); float3 finalSpec = _SpecularColor.rgb * spec; fixed4 c; c.rgb = (s.Albedo * _LightColor0 * diff) + (_LightColor0 * spec); c.a = 1.0; return c; } struct Input { float2 uv_MainTex; }; void surf(Input IN, inout SurfaceOutput o) { half4 c = tex2D(_MainTex, IN.uv_MainTex); o.Albedo = c.rgb; o.Alpha = c.a; } ENDCG } }
相关文章推荐
- 利用镜面反射让游戏闪耀起来 - 创建各向异性高光类型
- 利用镜面反射让游戏闪耀起来 - 金属与软高光
- 利用镜面反射让游戏闪耀起来 - 使用贴图对模型的高光进行遮罩
- UnityShader学习笔记(八)利用镜面反射让游戏闪耀起来
- 利用镜面反射让游戏闪耀起来 - 利用Unity3D内置的高光模型
- 利用反射来动态创建实例和调用方法
- C# 利用反射动态创建对象[转]
- Unity 游戏开发技巧集锦之材质的应用的创建反射材质
- 利用反射方式,动态引用程序集创建类
- 利用反射——创建长度可变的数组
- 利用反射动态创建实例并调用方法
- 利用反射创建对象
- 利用反射创建对象
- 利用反射机制通过配置文件在对象池创建对象
- Unity 游戏开发技巧集锦之材质的应用的创建反射材质
- C#利用反射动态创建对象
- C#利用反射机制创建对象
- 利用反射,创建Android的SQL语句,极大提高速率
- C#利用反射动态创建对象 带参数的构造函数和String类型
- StructureMap.dll 中的 GetInstance 重载 + 如何利用 反射动态创建泛型类