duck

duck

Dec 14th, 2010
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. Shader "Custom/Splat Specular" {
  2. Properties {
  3. _MainTex ("Tex2 (RGB)", 2D) = "white" {}
  4. _MainTex2 ("Tex2 (RGB)", 2D) = "white" {}
  5. _Splat ("Splat", 2D) = "white" {}
  6. _Color ("Main Color", Color) = (1,1,1,1)
  7. _SpecColor ("Specular Color", Color) = (0.5, 0.5, 0.5, 1)
  8. _Shininess ("Shininess", Range (0.01, 1)) = 0.078125
  9.  
  10. }
  11. SubShader {
  12. Tags { "RenderType"="Opaque" }
  13. LOD 300
  14.  
  15. CGPROGRAM
  16. #pragma surface surf BlinnPhong
  17.  
  18. sampler2D _MainTex;
  19. sampler2D _MainTex2;
  20. sampler2D _Splat;
  21. float4 _Color;
  22. float _Shininess;
  23.  
  24. struct Input {
  25. float2 uv_MainTex;
  26. float2 uv_MainTex2;
  27. };
  28.  
  29. void surf (Input IN, inout SurfaceOutput o) {
  30.  
  31. half4 c1 = tex2D (_MainTex, IN.uv_MainTex);
  32. half4 c2 = tex2D (_MainTex2, IN.uv_MainTex2);
  33. float s = tex2D (_Splat, IN.uv_MainTex).r;
  34.  
  35. float midDip = saturate((0.25-(abs(s-0.5)))*2);
  36.  
  37. half4 u = lerp(c1,c2,s);
  38. o.Albedo = (u.rgb - midDip*0.25) * _Color.rgb;
  39. o.Gloss = u.a;
  40. o.Alpha = u.a * _Color.a;
  41. o.Specular = _Shininess;
  42.  
  43.  
  44. }
  45. ENDCG
  46. }
  47. FallBack "Diffuse"
  48. }
Advertisement
Add Comment
Please, Sign In to add comment