blinphong光照
来源:互联网 发布:网狐6603捕鱼源码 编辑:程序博客网 时间:2024/04/29 17:02
Shader "Custom/BlinPhong" { Properties { _MainTex ("Main Tex", 2D) = "white" {} _MainTint("Diffuse Tint",Color)=(1,1,1,1) _SpecularColor("Specular Color",Color)=(1,1,1,1) _SpecPower("Specular Power",Range(0,30))=1 } SubShader { Tags { "RenderType"="opaque" } LOD 200 CGPROGRAM // Physically based Standard lighting model, and enable shadows on all light types #pragma surface surf BlinPhong alpha:fade nolighting // Use shader model 3.0 target, to get nicer looking lighting #pragma target 3.0 sampler2D _MainTex; float4 _MainTint; float4 _SpecularColor; float _SpecPower; struct Input { float2 uv_MainTex; }; fixed4 LightingBlinPhong(SurfaceOutput s,fixed3 lightDir,half3 viewDir,fixed atten) { float NdotL=max(0,dot(s.Normal,lightDir)); //半角向量 float3 halfVector = normalize(lightDir+viewDir); float NdotH = max(0,dot(s.Normal,halfVector)); float finalSpec = pow(NdotH,_SpecPower)*_SpecularColor; //计算最终光照 fixed4 c; c.rgb = (s.Albedo*_LightColor0.rgb*max(0,NdotL)*atten)+(_LightColor0*finalSpec); c.a = s.Alpha; return c; } void surf (Input IN, inout SurfaceOutput o) { fixed4 c = tex2D(_MainTex,IN.uv_MainTex); o.Albedo = c.rgb; o.Alpha = c.a; } ENDCG } FallBack "Diffuse"}
0 0
- blinphong光照
- 光照
- 光照
- 光照
- 光照
- 光照
- 光照
- 光照
- 光照
- 光照
- 光照
- 光照
- 光照
- 光照
- 光照
- 光照模型
- 光照模型
- 光照模型
- ~Linux面试题汇总答案
- 还只知道“蓝瘦香菇”?来这里五分钟速成广西普通话十级
- 第58课: 广告点击广告累计点击数分析与实现
- Intent传递对象
- eclipse快捷键
- blinphong光照
- CODEVS 1066 引水入城
- java判断字符串是否为数字型字符串
- POJ 3050 Hopscotch
- JAVA Iterator 设计模式
- Redis 内存使用优化与存储
- c++11实现写优先的读写锁
- 为RecyclerView打造通用Adapter 让RecyclerView更加好用
- scanf,sscanf,fscanf